/* ============================================
   HID-GO.AUTH - Glassmorphism Design System
   ============================================ */

/* CSS Custom Properties for Theming */
:root {
    /* Light Mode Colors */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-gradient-start: #0c1929;
    --bg-gradient-mid: #1e3a8a;
    --bg-gradient-end: #581c87;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --glass-shadow: rgba(0, 0, 0, 0.1);
    --accent-primary: #3b82f6;
    --accent-secondary: #8b5cf6;
    --accent-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --error-bg: rgba(239, 68, 68, 0.1);
    --error-border: rgba(239, 68, 68, 0.3);
    --error-text: #fca5a5;
    --success-bg: rgba(34, 197, 94, 0.1);
    --success-border: rgba(34, 197, 94, 0.3);
    --success-text: #86efac;
    --input-bg: rgba(255, 255, 255, 0.05);
    --input-border: rgba(255, 255, 255, 0.1);
    --input-focus: rgba(59, 130, 246, 0.5);
}

/* Dark Mode (default for glassmorphism) */
[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-gradient-start: #0c1929;
    --bg-gradient-mid: #1e3a8a;
    --bg-gradient-end: #581c87;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --glass-shadow: rgba(0, 0, 0, 0.1);
    --input-bg: rgba(255, 255, 255, 0.05);
    --input-border: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .auth-logo h1 {
	-webkit-text-fill-color: white !important;
    color: #ffffff !important;
}

/* Light Mode */
[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-gradient-start: #1e3a8a;
    --bg-gradient-mid: #3b82f6;
    --bg-gradient-end: #8b5cf6;
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.8);
    --glass-shadow: rgba(0, 0, 0, 0.1);
    --accent-primary: #2563eb;
    --accent-secondary: #7c3aed;
    --input-bg: rgba(255, 255, 255, 0.9);
    --input-border: rgba(203, 213, 225, 0.8);
    --input-focus: rgba(37, 99, 235, 0.3);
    --error-bg: rgba(239, 68, 68, 0.1);
    --error-border: rgba(239, 68, 68, 0.3);
    --error-text: #dc2626;
    --success-bg: rgba(34, 197, 94, 0.1);
    --success-border: rgba(34, 197, 94, 0.3);
    --success-text: #16a34a;
}

/* ============================================
   Base Styles & Reset
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    min-height: 100vh;
    overflow-x: hidden;
    transition: background 0.3s ease, color 0.3s ease;
}

/* ============================================
   Animated Gradient Background
   ============================================ */
.auth-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: linear-gradient(
        135deg,
        var(--bg-gradient-start) 0%,
        var(--bg-gradient-mid) 50%,
        var(--bg-gradient-end) 100%
    );
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

.auth-background::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(120, 219, 255, 0.2) 0%, transparent 50%);
    animation: float 20s ease-in-out infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(30px, -30px) rotate(120deg); }
    66% { transform: translate(-20px, 20px) rotate(240deg); }
}

/* ============================================
   Glass Card Component
   ============================================ */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: 
        0 8px 32px var(--glass-shadow),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    overflow: hidden;
}

.glass-card:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 12px 40px var(--glass-shadow),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* ============================================
   Auth Container
   ============================================ */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
}

.auth-wrapper {
    width: 100%;
    max-width: 420px;
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   Logo Section
   ============================================ */
.auth-logo {
    text-align: center;
    padding: 32px 24px 24px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    border-bottom: 1px solid var(--glass-border);
}

.auth-logo img {
    max-width: 180px;
    height: auto;
    margin-bottom: 12px;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.2));
    transition: transform 0.3s ease;
    border-radius: 0.75rem;
}

.auth-logo img:hover {
    transform: scale(1.05);
}

.auth-logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.5px;
    margin: 0;
}

.auth-logo p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 8px;
}

/* ============================================
   Form Styles
   ============================================ */
.auth-form {
    padding: 32px 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--input-focus);
    background: var(--input-bg);
}

.form-input::placeholder {
    color: var(--text-muted);
}

/* ============================================
   Button Styles
   ============================================ */
.btn-primary {
    width: 100%;
    padding: 14px 24px;
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.btn-primary::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;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ============================================
   Alert/Error Messages
   ============================================ */
.alert {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-error {
    background: var(--error-bg);
    border: 1px solid var(--error-border);
    color: var(--error-text);
}

.alert-success {
    background: var(--success-bg);
    border: 1px solid var(--success-border);
    color: var(--success-text);
}

.alert-info {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #93c5fd;
}

/* ============================================
   Theme Toggle
   ============================================ */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 0 4px 15px var(--glass-shadow);
}

.theme-toggle:hover {
    transform: scale(1.1) rotate(15deg);
    background: var(--glass-bg);
}

.theme-toggle:active {
    transform: scale(0.95);
}

/* ============================================
   Footer Links
   ============================================ */
.auth-footer {
    text-align: center;
    padding: 16px 24px 24px;
    font-size: 0.875rem;
}

.auth-footer a {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
}

.auth-footer a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent-gradient);
    transition: width 0.3s ease;
}

.auth-footer a:hover::after {
    width: 100%;
}

.auth-footer a:hover {
    color: var(--accent-secondary);
}

/* ============================================
   Spinner
   ============================================ */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   Camera & Verification Styles
   ============================================ */
.camera-container {
    position: relative;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    border-radius: 16px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid var(--glass-border);
}

.camera-container video {
    width: 100%;
    height: auto;
    display: block;
    transform: scaleX(-1);
}

.camera-overlay {
    position: absolute;
    inset: 0;
    border: 2px dashed rgba(255, 255, 255, 0.3);
    border-radius: 16px;
    pointer-events: none;
}

.face-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 75%;
    aspect-ratio: 1/1.25;
    border: 2px solid rgba(59, 130, 246, 0.5);
    border-radius: 12px;
    pointer-events: none;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.3);
}

/* ============================================
   Challenge Items (Liveness Detection)
   ============================================ */
.challenge-container {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin: 16px 0;
}

.challenge-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 20px;
    border-radius: 12px;
    background: var(--input-bg);
    border: 2px solid var(--input-border);
    transition: all 0.3s ease;
    min-width: 100px;
    flex: 1;
}

.challenge-item.active {
    border-color: var(--accent-primary);
    background: rgba(59, 130, 246, 0.1);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.challenge-item.passed {
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.1);
}

.challenge-item.failed {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.challenge-icon {
    font-size: 28px;
    line-height: 1;
}

.challenge-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.2;
}

.challenge-item.passed .challenge-label {
    color: #22c55e;
}

.challenge-item.failed .challenge-label {
    color: #ef4444;
}

.challenge-item.active .challenge-label {
    color: var(--accent-primary);
}

/* ============================================
   Timer Bar
   ============================================ */
.timer-bar-container {
    width: 100%;
    height: 4px;
    background: var(--input-bg);
    border-radius: 2px;
    overflow: hidden;
    margin: 12px 0;
}

.timer-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 2px;
    transition: width 0.1s linear;
    width: 100%;
}

.timer-bar.warning {
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.timer-bar.danger {
    background: linear-gradient(90deg, #ef4444, #f87171);
}

/* ============================================
   Status Box
   ============================================ */
.status-box {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 12px;
    padding: 12px 16px;
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 16px 0;
}

.status-box.error {
    background: var(--error-bg);
    border-color: var(--error-border);
    color: var(--error-text);
}

.status-box.success {
    background: var(--success-bg);
    border-color: var(--success-border);
    color: var(--success-text);
}

/* ============================================
   Error Detail Box
   ============================================ */
.error-detail {
    background: var(--error-bg);
    border: 1px solid var(--error-border);
    border-radius: 12px;
    padding: 16px;
    font-size: 0.875rem;
    color: var(--error-text);
    margin: 16px 0;
}

.error-detail button {
    margin-top: 12px;
    padding: 8px 16px;
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid var(--error-border);
    border-radius: 8px;
    color: var(--error-text);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.error-detail button:hover {
    background: rgba(239, 68, 68, 0.3);
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 480px) {
    .auth-wrapper {
        max-width: 100%;
    }
    
    .glass-card {
        border-radius: 20px;
    }
    
    .auth-logo {
        padding: 24px 20px 20px;
    }
    
    .auth-logo img {
        max-width: 150px;
    }
    
    .auth-logo h1 {
        font-size: 1.25rem;
    }
    
    .auth-form {
        padding: 24px 20px;
    }
    
    .form-input {
        padding: 12px 14px;
        font-size: 0.9375rem;
    }
    
    .btn-primary {
        padding: 12px 20px;
        font-size: 0.9375rem;
    }
    
    .camera-container {
        max-width: 100%;
    }
    
    .face-hint {
        width: 60%;
    }
    
    .challenge-item {
        min-width: 80px;
        padding: 10px 14px;
    }
    
    .theme-toggle {
        top: 12px;
        right: 12px;
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    .auth-wrapper {
        max-width: 400px;
    }
}

@media (min-width: 769px) {
    .auth-wrapper {
        max-width: 420px;
    }
}

/* ============================================
   Utility Classes
   ============================================ */
.text-center {
    text-align: center;
}

.mb-4 {
    margin-bottom: 16px;
}

.mt-4 {
    margin-top: 16px;
}

.hidden {
    display: none !important;
}

.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.gap-2 {
    gap: 8px;
}

.w-full {
    width: 100%;
}

/* ============================================
   Print Styles (hide background)
   ============================================ */
@media print {
    .auth-background,
    .theme-toggle {
        display: none;
    }
    
    body {
        background: white;
    }
    
    .glass-card {
        background: white;
        border: 1px solid #ccc;
    }
}