:root {
    --bg-color: #000000;
    --text-color: #ffffff;
    --primary-color: #007bff;
    --primary-hover: #0056b3;
    --overlay-bg: rgba(0, 0, 0, 0.6);
}

/* CRITICAL: Ensure hidden attribute always works */
[hidden] {
    display: none !important;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    height: 100vh;
    height: 100dvh;
    /* Use dynamic viewport height for mobile browsers */
    overflow: hidden;
    /* Prevent scrolling */
}

/* ... existing styles ... */

.ui-overlay {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 150px;
    /* Fixed height for control area */
    padding-bottom: env(safe-area-inset-bottom);
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    display: flex;
    justify-content: center;
    /* Center horizontally */
    align-items: center;
    /* Center vertically */
    z-index: 999;
}

.status-box {
    position: fixed;
    top: 50px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 1000;
    pointer-events: none;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* Shutter Button Style */
#capture-btn {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background-color: transparent;
    border: 4px solid white;
    position: relative;
    padding: 0;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    /* Inner white circle */
}

#capture-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 56px;
    height: 56px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.1s;
}

#capture-btn:active::after {
    transform: translate(-50%, -50%) scale(0.9);
    background-color: #ddd;
}

/* Hide text inside shutter button */
#capture-btn {
    color: transparent;
    overflow: hidden;
}

/* Action Buttons (Retake/Share) */
.action-btn {
    cursor: pointer;
    border: none;
    font-weight: bold;
}

.action-btn.secondary-btn {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 14px 28px;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: 600;
    margin: 0 10px;
    min-width: 110px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.action-btn.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.error-msg {
    color: #ff3b30 !important;
    margin-top: 10px;
    font-size: 14px;
}

/* Scanner Styles */
.scanner-box {
    background: #000;
    padding: 10px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 90%;
    max-width: 400px;
}

.verify-content {
    background: #1a1a1a;
    border: 2px solid #25D366;
    /* Green Border */
}

.verify-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

.action-btn.share-btn {
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    color: white;
    padding: 14px 28px;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: 600;
    margin: 0 10px;
    border: none;
    box-shadow: 0 4px 16px rgba(37, 211, 102, 0.4);
    transition: all 0.3s ease;
}

.action-btn.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(37, 211, 102, 0.6);
}

/* Container for secondary buttons */
.button-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Fix: Ensure hidden attribute works even with display: flex defined */
.button-group[hidden] {
    display: none !important;
}

/* Immersive Camera Container */
.camera-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    /* Behind everything */
    background-color: #000;
}

#camera-feed,
#captured-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Fill the screen */
}

#captured-image {
    display: none;
    z-index: 10;
    /* Above video when shown */
}

#captured-image[src] {
    display: block;
}

/* Floating Name Input */
.name-input {
    position: fixed;
    top: auto;
    /* Clear the top property */
    bottom: 160px;
    /* Position just above the shutter button overlay */
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 1rem;
    text-align: center;
    backdrop-filter: blur(4px);
    z-index: 1001;
    /* Above status box */
    width: 200px;
    outline: none;
    transition: background 0.3s;
}

.name-input:focus {
    background: rgba(0, 0, 0, 0.8);
    border-color: var(--primary-color);
}

.name-input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

/* --- Modern Glassmorphism Login --- */

.login-overlay {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    /* Deep Blue Gradient */
    display: flex;
    justify-content: center;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
}

.login-box {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    padding: 15px 15px;
    border-radius: 24px;
    text-align: center;
    width: 90%;
    max-width: 340px;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: white;
}

.login-box h2 {
    margin-bottom: 10px;
    font-weight: 600;
    letter-spacing: 1px;
}

.login-box p {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 25px;
}

.login-input {
    width: 100%;
    padding: 15px;
    margin-bottom: 20px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: white;
    font-size: 16px;
    outline: none;
    transition: all 0.3s ease;
    text-align: center;
}

.login-input:focus {
    background: rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.02);
}

.login-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.action-btn {
    background: #00d2ff;
    background: linear-gradient(90deg, #00d2ff 0%, #3a7bd5 100%);
    border: none;
    padding: 15px;
    border-radius: 12px;
    color: white;
    font-weight: bold;
    font-size: 16px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    width: 100%;
}

.action-btn:active {
    transform: scale(0.96);
}

/* Floating User Badge - Modern Glass */
.user-badge {
    position: fixed;
    top: 20px;
    left: 20px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 10px 20px;
    border-radius: 24px;
    font-size: 15px;
    font-weight: 600;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    z-index: 100;
    letter-spacing: 0.5px;
}

/* Top Right QR Button */
.qr-icon-btn {
    position: absolute;
    top: 25px;
    right: 25px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    backdrop-filter: blur(5px);
    transition: all 0.2s;
    z-index: 2001;
}

.qr-icon-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.qr-icon-btn:active {
    transform: scale(0.95);
}