/* ============================================================================
   eKYC Frontend - Styles
   ============================================================================ */

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #3b82f6;
    --primary-dark: #2563eb;
    --primary-light: #60a5fa;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============================================================================
   Layout Components
   ============================================================================ */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.main-container {
    flex: 1;
    padding: 20px 0;
}

/* Header */
.header {
    background: var(--card-bg);
    box-shadow: var(--shadow);
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.logo h1 {
    font-size: 24px;
    color: var(--primary-color);
    margin-bottom: 4px;
}

.tagline {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Footer */
.footer {
    background: var(--card-bg);
    padding: 30px 0;
    text-align: center;
    border-top: 1px solid var(--border-color);
    margin-top: 40px;
}

.footer p {
    color: var(--text-secondary);
    font-size: 14px;
}

.footer-subtitle {
    font-size: 12px;
    margin-top: 8px;
}

/* ============================================================================
   Screen Management
   ============================================================================ */

.screen {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.screen.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================================================
   Hero Section (Welcome Screen)
   ============================================================================ */

.hero {
    text-align: center;
    padding: 60px 20px;
}

.hero-title {
    font-size: 48px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.hero-subtitle {
    font-size: 20px;
    color: var(--text-secondary);
    margin-bottom: 60px;
}

.hero-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-bottom: 60px;
}

.feature {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

.feature:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.feature-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 16px;
}

.feature h3 {
    font-size: 20px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.feature p {
    color: var(--text-secondary);
    font-size: 14px;
}

.hero-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
}

/* ============================================================================
   Buttons
   ============================================================================ */

.btn {
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 500;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #475569;
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: white;
}

.btn-block {
    width: 100%;
}

.btn-large {
    padding: 16px 32px;
    font-size: 18px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================================================
   Auth Cards (Login/Register)
   ============================================================================ */

.auth-card {
    max-width: 450px;
    margin: 40px auto;
    background: var(--card-bg);
    padding: 40px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
}

.auth-card h2 {
    font-size: 28px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.auth-subtitle {
    color: var(--text-secondary);
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-group small {
    display: block;
    margin-top: 4px;
    color: var(--text-secondary);
    font-size: 12px;
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* ============================================================================
   Messages
   ============================================================================ */

.error-message {
    background: #fee2e2;
    color: var(--error-color);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 16px;
    display: none;
}

.error-message.show {
    display: block;
}

.success-message {
    background: #d1fae5;
    color: var(--success-color);
    padding: 12px;
    border-radius: 8px;
    margin-top: 16px;
    display: none;
}

.success-message.show {
    display: block;
}

/* ============================================================================
   Dashboard
   ============================================================================ */

.dashboard {
    max-width: 900px;
    margin: 40px auto;
}

.dashboard-header {
    text-align: center;
    margin-bottom: 50px;
}

.dashboard-header h2 {
    font-size: 32px;
    margin-bottom: 12px;
}

.dashboard-header p {
    color: var(--text-secondary);
    font-size: 18px;
}

.verification-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-bottom: 50px;
}

.step {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    text-align: center;
}

.step-number {
    width: 60px;
    height: 60px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    margin: 0 auto 20px;
}

.step h3 {
    margin-bottom: 12px;
    font-size: 20px;
}

.step p {
    color: var(--text-secondary);
    font-size: 14px;
}

.dashboard-actions {
    text-align: center;
}

/* ============================================================================
   Verification Container
   ============================================================================ */

.verification-container {
    max-width: 800px;
    margin: 0 auto;
}

.stage-header {
    text-align: center;
    margin-bottom: 40px;
}

.stage-header h2 {
    font-size: 32px;
    margin-bottom: 20px;
}

.stage-subtitle {
    color: var(--text-secondary);
    font-size: 16px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    margin: 20px 0;
    overflow: hidden;
}

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

/* ============================================================================
   Upload Area (Stage 1)
   ============================================================================ */

.upload-area {
    text-align: center;
}

.upload-preview {
    width: 100%;
    max-width: 500px;
    height: 350px;
    margin: 0 auto 24px;
    border: 3px dashed var(--border-color);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.2s;
    background: var(--card-bg);
    overflow: hidden;
}

.upload-preview:hover {
    border-color: var(--primary-color);
}

.upload-placeholder {
    text-align: center;
    color: var(--text-secondary);
}

.upload-icon {
    font-size: 64px;
    display: block;
    margin-bottom: 16px;
}

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

/* ============================================================================
   Camera Container (Stages 2 & 3)
   ============================================================================ */

.camera-container {
    position: relative;
    width: 100%;
    max-width: 640px;
    margin: 0 auto 24px;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
}

.camera-container video {
    width: 100%;
    height: auto;
    display: block;
}

.camera-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.face-guide {
    width: 280px;
    height: 360px;
    border: 3px solid var(--primary-color);
    border-radius: 50%;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
}

.camera-status {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    padding: 16px;
    border-radius: 8px;
    color: white;
}

.status-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.status-item:last-child {
    margin-bottom: 0;
}

.status-label {
    font-weight: 500;
}

.status-value {
    color: var(--primary-light);
}

.challenge-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 20px;
}

.challenge-box {
    background: rgba(0, 0, 0, 0.8);
    padding: 24px;
    border-radius: 12px;
    color: white;
    text-align: center;
}

.challenge-box h3 {
    font-size: 20px;
    margin-bottom: 12px;
    color: var(--primary-light);
}

.challenge-box p {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 16px;
}

.challenge-progress {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
}

.challenge-progress-fill {
    height: 100%;
    background: var(--success-color);
    transition: width 0.3s;
    width: 0;
}

.camera-controls {
    text-align: center;
    display: flex;
    gap: 16px;
    justify-content: center;
}

/* ============================================================================
   Completion Screen
   ============================================================================ */

.completion-card {
    max-width: 500px;
    margin: 60px auto;
    text-align: center;
    background: var(--card-bg);
    padding: 50px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
}

.completion-icon {
    font-size: 80px;
    margin-bottom: 24px;
}

.completion-card h2 {
    font-size: 32px;
    margin-bottom: 16px;
    color: var(--success-color);
}

.completion-card > p {
    color: var(--text-secondary);
    font-size: 16px;
    margin-bottom: 40px;
}

.completion-details {
    margin-bottom: 40px;
}

.detail-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px;
    background: var(--bg-color);
    border-radius: 8px;
    margin-bottom: 12px;
    font-weight: 500;
}

.detail-icon {
    font-size: 24px;
}

/* ============================================================================
   Loading Overlay
   ============================================================================ */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    flex-direction: column;
}

.loading-overlay.show {
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-overlay p {
    color: white;
    margin-top: 20px;
    font-size: 16px;
}

/* ============================================================================
   Responsive Design
   ============================================================================ */

@media (max-width: 768px) {
    .hero-title {
        font-size: 32px;
    }

    .hero-subtitle {
        font-size: 16px;
    }

    .hero-actions {
        flex-direction: column;
    }

    .hero-features {
        grid-template-columns: 1fr;
    }

    .verification-steps {
        grid-template-columns: 1fr;
    }

    .auth-card {
        padding: 24px;
    }

    .face-guide {
        width: 200px;
        height: 260px;
    }
}

/* KYC Result Card */
.kyc-result-card {
    margin-top: 20px;
    padding: 24px;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.kyc-result-card h3 {
    margin-bottom: 16px;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.kyc-details {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.kyc-details p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}
