/* ==========================================
   DESIGN SYSTEM
========================================== */
:root {
    /* South African National Palette */
    --sa-green: #007749;
    --sa-gold: #FFB81C;
    --sa-red: #E03C31;
    --sa-blue: #001489;

    --primary-gradient: linear-gradient(135deg, var(--sa-green) 0%, #005a37 100%);
    --accent-gradient: linear-gradient(135deg, var(--sa-gold) 0%, #e6a619 100%);

    --bg-primary: #0a0e14;
    --bg-secondary: #111821;
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;

    --success-color: var(--sa-green);
    --danger-color: var(--sa-red);

    --glass-bg: rgba(17, 24, 39, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-blur: blur(12px);

    --radius-md: 0.75rem;
    --radius-lg: 1rem;

    --spacing-sm: 1rem;
    --spacing-md: 2rem;
    --spacing-lg: 3rem;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ==========================================
   HEADER
========================================== */
.header {
    padding: var(--spacing-sm) 0;
    backdrop-filter: var(--glass-blur);
    background: var(--glass-bg);
    border-bottom: 1px solid var(--glass-border);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo h1 {
    font-size: 1.5rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ==========================================
   MAIN LAYOUT
========================================== */
.main-content {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.split-container {
    display: flex;
    flex-direction: row-reverse;
    /* 🔥 STEPS LEFT */
    width: 100%;
    max-width: 1200px;
    height: 85%;
    gap: var(--spacing-lg);
}

/* ==========================================
   LEFT SIDEBAR — STEPS
========================================== */
.right-panel {
    flex: 1;
    max-width: 250px;
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 2.5rem 1.5rem;
    border-radius: 1.25rem;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.panel-header h3 {
    font-size: 1.2rem;
    margin-bottom: var(--spacing-md);
}

.step-indicator.vertical {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.step {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    opacity: 0.4;
    transition: all 0.3s ease;
}

.step.active,
.step.completed {
    opacity: 1;
}

.step-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

.step small {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.step-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0, 119, 73, 0.1);
    border: 1.5px solid rgba(0, 119, 73, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--sa-green);
}

.step.active .step-circle,
.step.completed .step-circle {
    background: var(--sa-green);
    border: none;
    color: white;
}

/* ==========================================
   RIGHT MAIN — CAMERA AREA
========================================== */
.left-panel {
    flex: 4;
    display: flex;
    flex-direction: column;
}

.verification-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 1.25rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}

/* CAMERA BIG */
.camera-container {
    flex: 1;
    background: #000;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 380px;
    max-width: 640px;
    margin: 0 auto;
    width: 100%;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#videoFeed {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* ==========================================
   UPLOAD AREA
========================================== */
.upload-area {
    text-align: center;
    padding: 5rem 2rem;
    border: 2px dashed var(--glass-border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.upload-icon {
    margin-bottom: 0.5rem;
}

.upload-title {
    font-size: 1.5rem;
    font-weight: 700;
}

.upload-text {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-top: -0.5rem;
    margin-bottom: 0.5rem;
}

/* ==========================================
   PROGRESS BAR
========================================== */
.step-progress {
    margin-top: 1.5rem;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.progress-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary-gradient);
    transition: width 0.3s ease;
}

/* ==========================================
   BUTTONS
========================================== */
.btn {
    padding: 1rem 2rem;
    border: none;
    border-radius: var(--radius-md);
    background: var(--primary-gradient);
    color: white;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ==========================================
   SUCCESS/FAILURE RESULTS
========================================== */
.result-success,
.result-failure {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    gap: 1.5rem;
}

.result-success h2 {
    font-size: 2.2rem;
    font-weight: 700;
    margin: 0;
}

.result-success p.welcome {
    font-size: 1.2rem;
    color: var(--text-primary);
    margin: -0.5rem 0 0.5rem 0;
}

.access-badge {
    padding: 0.6rem 2rem;
    border-radius: 50px;
    font-weight: 700;
    letter-spacing: 1px;
    font-size: 0.9rem;
}

.access-granted {
    border: 2px solid rgba(0, 119, 73, 0.5);
    background: rgba(0, 119, 73, 0.1);
    color: var(--sa-green);
}

.access-denied {
    border: 2px solid rgba(224, 60, 49, 0.5);
    background: rgba(224, 60, 49, 0.1);
    color: var(--sa-red);
}

.result-message {
    max-width: 400px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.btn-restart {
    background: var(--sa-blue);
    color: white;
    padding: 1rem 2.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 20, 137, 0.3);
}

.btn-restart:hover {
    background: #001ca7;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 20, 137, 0.4);
}

/* ==========================================
   PREMIUM INPUT DESIGN
   ========================================== */
.input-group {
    position: relative;
    width: 100%;
    margin-bottom: 1.5rem;
}

.form-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid var(--glass-border);
    border-radius: 12px;
    padding: 1.2rem 3rem 1.2rem 1.2rem !important;
    /* Force padding for group */
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    box-shadow: none;
    margin-top: 0 !important;
}

.input-group label {
    position: absolute;
    left: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
    transition: all 0.3s ease;
    font-size: 1rem;
    z-index: 10;
}

/* Floating label logic */
.form-input:focus~label,
.form-input:not(:placeholder-shown)~label {
    top: -10px;
    left: 10px;
    font-size: 0.85rem;
    color: #667eea;
    background: var(--bg-secondary);
    padding: 0 8px;
    font-weight: 700;
}

/* Input Icon */
.input-icon {
    position: absolute;
    right: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    transition: all 0.3s ease;
    opacity: 0.5;
    z-index: 10;
}

/* Focus Effects */
.form-input:focus {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.05);
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.15);
}

.form-input:focus~.input-icon {
    color: #667eea;
    opacity: 1;
}

.input-glow {
    position: absolute;
    inset: -2px;
    border-radius: 14px;
    background: var(--primary-gradient);
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
    filter: blur(8px);
}

.form-input:focus~.input-glow {
    opacity: 0.3;
}

/* ==========================================
   RESPONSIVE
========================================== */
@media (max-width: 900px) {
    .split-container {
        flex-direction: column;
    }

    .right-panel {
        max-width: 100%;
        border: none;
    }
}

/* Tablet & Smaller Desktop */
@media (max-width: 1024px) {
    .split-container {
        max-width: 95%;
        height: auto;
        min-height: fit-content;
    }

    .left-panel {
        flex: 2;
    }
}

/* Mobile Devices */
@media (max-width: 768px) {
    body {
        height: auto;
        min-height: 100vh;
        overflow-y: auto;
    }

    .main-content {
        align-items: flex-start;
        padding: 10px;
    }

    .split-container {
        flex-direction: column;
        height: auto;
        gap: 15px;
        width: 100%;
        max-width: 100%;
        margin: 0;
    }

    /* Steps move to a more compact horizontal box at top */
    .right-panel {
        max-width: 100%;
        order: -1;
        padding: 15px;
        border-radius: 12px;
        margin-bottom: 0;
        background: rgba(255, 255, 255, 0.03);
    }

    .panel-header h3 {
        font-size: 1rem;
        margin-bottom: var(--spacing-sm);
    }

    .step-indicator.vertical {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 5px;
        gap: 1rem;
        justify-content: space-between;
    }

    .step {
        flex-direction: column;
        text-align: center;
        min-width: 80px;
        gap: 0.5rem;
    }

    .step-content-text {
        font-size: 0.75rem;
    }

    .step-label {
        white-space: nowrap;
    }

    .step small {
        display: none;
        /* Hide sub-text on small mobile */
    }

    /* Main Camera Section */
    .left-panel {
        width: 100%;
    }

    .verification-card {
        padding: var(--spacing-sm);
    }

    .camera-container {
        min-height: 300px;
        /* Shorter on mobile */
        aspect-ratio: 4/3;
    }

    .section-heading {
        font-size: 1.25rem;
    }

    /* Result screens */
    .result-success svg,
    .result-failure svg {
        width: 80px;
        height: 80px;
    }

    h2 {
        font-size: 1.5rem !important;
    }
}

/* Very Small Devices */
@media (max-width: 480px) {
    .step-indicator.vertical {
        justify-content: flex-start;
    }

    .step-circle {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }

    .camera-container {
        min-height: 250px;
    }

    .upload-area {
        padding: var(--spacing-md);
    }

    .upload-icon svg {
        width: 48px;
        height: 48px;
    }
}