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

body {
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 50%, #0f0f0f 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

body::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.25) 0%, transparent 70%);
    border-radius: 50%;
    top: -300px;
    right: -300px;
    filter: blur(80px);
}

body::after {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.2) 0%, transparent 70%);
    border-radius: 50%;
    bottom: -250px;
    left: -250px;
    filter: blur(80px);
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(30px, 30px) scale(1.1); }
}

.logo {
    position: fixed;
    top: 30px;
    left: 30px;
    z-index: 100;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #ffffff 0%, #3b82f6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.language-selector {
    position: fixed;
    top: 30px;
    right: 30px;
    z-index: 100;
}

.language-selector select {
    background: rgba(30, 30, 30, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #ffffff;
    padding: 8px 12px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    appearance: none;
    cursor: pointer;
    outline: none;
    transition: all 0.3s ease;
}

.language-selector select:hover {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.language-selector select option {
    background-color: #1a1a1a;
    color: #ffffff;
}

.container {
    position: relative;
    z-index: 1;
    width: 90%; /* Use percentage for fluidity */
    max-width: 560px; /* Increased for a slightly "zoomed out" feel */
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: max-width 0.3s ease-in-out; /* Smooth transition */
}

.screen {
    width: 100%;
    opacity: 0;
    transform: translateY(30px);
    pointer-events: none;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) translateY(30px);
}

.screen.active {
    transform: translate(-50%, -50%) translateY(0);
}

.screen.active {
    opacity: 1;
    pointer-events: all;
}

.glass-card {
    background: rgba(18, 18, 18, 0.7);
    backdrop-filter: blur(20px);
    border-radius: 32px;
    padding: 50px 40px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.6),
        inset 0 1px 1px rgba(255, 255, 255, 0.05),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.greeting-text {
    font-size: 48px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 12px;
    letter-spacing: -1px;
    animation: slideIn 0.8s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.subtext {
    font-size: 17px;
    color: #a0a0a0;
    margin-bottom: 40px;
    font-weight: 400;
    letter-spacing: -0.2px;
}

.glow-button {
    width: 100%;
    padding: 18px;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.3px;
    color: white;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border: none;
    border-radius: 16px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    box-shadow:
        0 8px 24px rgba(59, 130, 246, 0.5),
        0 0 40px rgba(59, 130, 246, 0.3),
        inset 0 1px 1px rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

@keyframes pulse-glow {
    0% {
        box-shadow: 0 0 20px rgba(59, 130, 246, 0.4), 0 0 30px rgba(59, 130, 246, 0.2);
    }
    50% {
        box-shadow: 0 0 40px rgba(59, 130, 246, 0.8), 0 0 60px rgba(59, 130, 246, 0.5);
    }
    100% {
        box-shadow: 0 0 20px rgba(59, 130, 246, 0.4), 0 0 30px rgba(59, 130, 246, 0.2);
    }
}

.glow-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.glow-button:hover::before {
    left: 100%;
}

.glow-button:active {
    transform: scale(0.98);
}

.screen-title {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -1px;
    color: #ffffff;
    margin-bottom: 24px;
    text-align: center;
}

.input-group {
    margin-bottom: 32px;
}

.input-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #b0b0b0;
    margin-bottom: 12px;
}

.glass-input {
    width: 100%;
    padding: 18px 20px;
    font-size: 16px;
    font-family: 'Inter', sans-serif;
    letter-spacing: -0.3px;
    color: #ffffff;
    background: rgba(30, 30, 30, 0.6);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    outline: none;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.glass-input:focus {
    border-color: #3b82f6;
    box-shadow: 
        0 0 0 4px rgba(59, 130, 246, 0.15),
        0 0 30px rgba(59, 130, 246, 0.3);
    background: rgba(30, 30, 30, 0.8);
}

.glass-input::placeholder {
    color: #606060;
}

.camera-frame {
    width: 100%;
    aspect-ratio: 4/3;
    background: rgba(0, 0, 0, 0.9);
    border-radius: 20px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.5),
        inset 0 0 0 2px rgba(59, 130, 246, 0.3),
        0 0 60px rgba(59, 130, 246, 0.2);
}

#videoElement {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.scan-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.scan-line {
    position: absolute;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #3b82f6, transparent);
    box-shadow: 0 0 10px #3b82f6;
}

@keyframes scan {
    0%, 100% { top: 10%; }
    50% { top: 90%; }
}

.corner {
    position: absolute;
    width: 40px;
    height: 40px;
    border: 3px solid #3b82f6;
}

.corner.top-left {
    top: 20px;
    left: 20px;
    border-right: none;
    border-bottom: none;
}

.corner.top-right {
    top: 20px;
    right: 20px;
    border-left: none;
    border-bottom: none;
}

.corner.bottom-left {
    bottom: 20px;
    left: 20px;
    border-right: none;
    border-top: none;
}

.corner.bottom-right {
    bottom: 20px;
    right: 20px;
    border-left: none;
    border-top: none;
}

.instruction-text {
    text-align: center;
    color: #a0a0a0;
    font-size: 14px;
    letter-spacing: -0.2px;
    margin-bottom: 24px;
    font-weight: 500;
}

.status-badge {
    display: inline-block;
    padding: 8px 16px;
    background: rgba(59, 130, 246, 0.15);
    border-radius: 20px;
    color: #3b82f6;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-bottom: 20px;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.2);
}

.loader {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 10px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.hidden {
    display: none;
}

/* --- Responsive Adjustments --- */

/* Mobile first (up to 767px) */
@media (max-width: 767px) {
    .logo {
        top: 20px;
        left: 20px;
        font-size: 20px;
    }

    .language-selector {
        top: 20px;
        right: 20px;
    }
    
    .glass-card {
        padding: 40px 25px;
        border-radius: 24px;
    }

    .greeting-text {
        font-size: 36px;
    }

    .subtext {
            font-size: 16px;
        }
    }
    
    #referenceImageContainer {
        border: 2px dashed #ccc;
        padding: 1rem;
        border-radius: 8px;
        width: 80px;
        height: 80px;
        display: flex;
        justify-content: center;
        align-items: center;
        background-color: #fafafa;
        margin-bottom: 1rem;
        margin-left: auto; /* Center the image container */
        margin-right: auto;
    }
    
    #referenceImage {
        max-width: 100%;
        max-height: 100%;
    }
    
    #video-wrapper {
        position: relative;
        /* width: 640px; */ /* Removed for responsiveness */
        /* height: 480px; */ /* Removed for responsiveness */
        max-width: 100%;
        border: 2px solid #ddd;
        border-radius: 8px;
        overflow: hidden;
        aspect-ratio: 4/3; /* Maintain aspect ratio */
    }
    
    video, canvas {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }

    /* Face Verification Screen specific adjustments for small screens */
    #faceScreen .main-content {
        flex-direction: column; /* Stack vertically on small screens */
        gap: 20px;
    }
    
    #faceScreen .upload-container,
    #faceScreen .video-container {
        width: 100%; /* Full width for stacked elements */
    }

    /* Buttons in button-group to stack on small screens */
    .button-group {
        flex-direction: column;
    }

    .button-group .glow-button,
    .button-group .back-button {
        width: 100%;
        max-width: none;
    }

    .loan-option {
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 12px;
        padding: 20px;
        margin-bottom: 20px;
        transition: all 0.3s ease;
    }

    .loan-option:hover {
        background: rgba(255, 255, 255, 0.1);
        transform: translateY(-5px);
    }

    .loan-option h4 {
        color: #3b82f6;
        margin-bottom: 15px;
        font-size: 18px;
    }

    .loan-option p {
        color: #a0a0a0;
        font-size: 15px;
        line-height: 1.6;
        margin-bottom: 5px;
    }

    .loan-option p strong {
            color: #ffffff;
            font-weight: 600;
        }
    
    .bypass-button {
        margin-top: 20px;
        background: transparent;
        border: 1px solid #3b82f6;
        color: #3b82f6;
        animation: none; /* Remove the pulse-glow animation */
        box-shadow: none; /* Remove the box-shadow */
    }
    
    .bypass-button:hover {
        background: rgba(59, 130, 246, 0.15);
        color: white;
    }

    .back-button {
        width: 100%;
        padding: 18px;
        font-size: 17px;
        font-weight: 600;
        letter-spacing: -0.3px;
        color: #a0a0a0;
        background: transparent;
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: 16px;
        cursor: pointer;
        transition: all 0.3s ease;
        margin-top: 15px;
    }

    .back-button:hover {
        background: rgba(255, 255, 255, 0.05);
        border-color: #a0a0a0;
        color: #ffffff;
    }

    .button-group {
        display: flex;
        gap: 15px;
        margin-top: 20px;
    }

    .button-group .glow-button,
    .button-group .back-button {
        margin-top: 0;
    }

/* Tablet and Small Desktop (768px to 1200px) */
@media (min-width: 768px) {
    .container {
        max-width: 960px; /* Increased for tablets and small desktops */
    }

    .glass-card {
        padding: 60px 50px;
    }

    /* Face Verification Screen - Side-by-side layout */
    #faceScreen .main-content {
        display: flex; /* Enable flexbox for main content */
        flex-direction: row;
        justify-content: space-around;
        align-items: flex-start;
        gap: 40px;
    }

    #faceScreen .upload-container,
    #faceScreen .video-container {
        flex: 1;
        width: 100%; /* Ensure they take full width in flex context */
    }

    #video-wrapper {
        width: 100%;
        height: auto;
        aspect-ratio: 4/3;
    }

    #referenceImageContainer {
        width: 150px;
        height: 150px;
    }

    /* Loan Details Screen - Two-column grid */
    #loanDetailsScreen .glass-card {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0 40px; /* Row gap 0, column gap 40px */
        align-items: center;
    }

    #loanDetailsScreen .input-group:nth-child(even) { /* Align even inputs to the right */
        grid-column: 2 / 3;
    }

    #loanDetailsScreen .input-group:nth-child(odd) { /* Align odd inputs to the left */
        grid-column: 1 / 2;
    }
    

    #loanDetailsScreen .screen-title,
    #loanDetailsScreen .status-badge { /* Title and badge span both columns */
        grid-column: 1 / -1;
    }

    #loanDetailsScreen .input-group {
        margin-bottom: 25px;
    }

    #loanDetailsScreen .button-group { /* Group buttons to span both columns */
        grid-column: 1 / -1;
        display: flex;
        justify-content: center;
        gap: 15px;
        margin-top: 20px;
    }

    #loanDetailsScreen .button-group .glow-button,
    #loanDetailsScreen .button-group .back-button {
        width: auto; /* Allow buttons to size naturally within the group */
        flex-grow: 1;
        max-width: 200px; /* Limit individual button width */
        margin-top: 0;
    }
    
    #loanDetailsScreen .back-button {
        margin-top: 20px;
    }
    
    /* Loan Options - Wider layout */
    #loanOptionsContainer {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 25px;
    }
}

/* Large Desktops (1201px and above) */
@media (min-width: 1201px) {
    .container {
        max-width: 1100px; /* Increased for large screens */
    }
    
    /* Landscape orientation for mobile devices */
    @media (max-width: 767px) and (orientation: landscape) {
        .container {
            max-width: 90%;
            width: 100%;
        }
    
        .glass-card {
            padding: 30px 20px;
        }
    
        .greeting-text {
            font-size: 32px;
        }
    
        .screen-title {
            font-size: 28px;
        }
    
        #faceScreen .main-content {
            flex-direction: row; /* Side-by-side in landscape */
            gap: 15px;
            align-items: center;
        }
    
        #faceScreen .upload-container {
            flex: 0.4;
        }
    
        #faceScreen .video-container {
            flex: 0.6;
        }
    
        #referenceImageContainer {
            width: 60px;
            height: 60px;
        }
    }
    
    /* Large Desktops (1201px and above) */
    @media (min-width: 1201px) {
        .container {
            max-width: 960px; /* A bit wider for large screens */
        }
    
        .glass-card {
            padding: 70px 60px;
        }
    
        #loanDetailsScreen .glass-card {
            gap: 0 50px; /* More spacing between columns */
        }
    }

    .glass-card {
        padding: 70px 60px;
    }

    #loanDetailsScreen .glass-card {
        gap: 0 50px; /* More spacing between columns */
    }
}

/* New styles for Loan Confirmation Screen elements */
.probability-meter {
    width: 100%;
    height: 30px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    margin: 20px 0 30px 0;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.3);
}

.meter-fill {
    height: 100%;
    background: linear-gradient(90deg, #4ade80 0%, #22c55e 100%);
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 10px;
    transition: width 1s ease-out;
}

.meter-text {
    position: absolute;
    width: 100%;
    text-align: center;
    color: #ffffff;
    font-weight: 700;
    font-size: 16px;
    line-height: 30px; /* Vertically center text */
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

#talkToCounselorButton {
    margin-bottom: 15px; /* Space between the two main buttons */
}

#downloadSanctionLetterButton {
    background: linear-gradient(135deg, #a0a0a0 0%, #71717a 100%); /* Grey out button */
    cursor: not-allowed;
    box-shadow: none;
    pointer-events: none; /* Prevent clicks when disabled */
}

#downloadSanctionLetterButton.active {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    cursor: pointer;
    box-shadow:
        0 8px 24px rgba(59, 130, 246, 0.5),
        0 0 40px rgba(59, 130, 246, 0.3),
        inset 0 1px 1px rgba(255, 255, 255, 0.2);
    pointer-events: all;
}

.voice-assistant-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #3b82f6;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    z-index: 1000;
}

.voice-assistant-button img {
    width: 30px;
    height: 30px;
    filter: invert(100%); /* Make the microphone icon white */
}

.voice-assistant-button:hover {
    background-color: #2563eb;
    transform: scale(1.05);
}

.voice-assistant-button.recording {
    background-color: #ef4444; /* Red when recording */
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(239, 68, 68, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}