/* 
 * TrioScan AI - Modern, Glassmorphism CSS 
 * Premium Aesthetic, Micro-animations, Dark Mode UI 
 */

 :root {
    --bg-color: transparent;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --accent-color: #3b82f6;
    --accent-hover: #2563eb;
    --glass-bg: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    --danger-color: #ef4444;
    --success-color: #10b981;
}

[data-theme="dark"] {
    --bg-color: #0f172a;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-hint: #cbd5e1;
    --accent-color: #60a5fa;
    --accent-hover: #3b82f6;
    --glass-bg: rgba(30, 41, 59, 0.75);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
    position: relative;
}

/* Animated Glowing Orbs Background */
.bg-animated {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    background: #f0f9ff;
    transition: background 0.3s ease;
}

[data-theme="dark"] .bg-animated {
    background: #020617;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.6;
    animation: float 10s infinite alternate ease-in-out;
}

[data-theme="dark"] .orb {
    opacity: 0.3;
}

.orb-1 {
    width: 400px;
    height: 400px;
    background: #3b82f6; /* Blue */
    top: -100px;
    left: -100px;
}

.orb-2 {
    width: 350px;
    height: 350px;
    background: #a855f7; /* Purple */
    bottom: -50px;
    right: -50px;
    animation-delay: -3s;
}

.orb-3 {
    width: 300px;
    height: 300px;
    background: #06b6d4; /* Cyan */
    bottom: 20%;
    left: 20%;
    animation-duration: 12s;
    animation-delay: -6s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(100px, -100px) scale(1.2); }
    66% { transform: translate(-50px, 100px) scale(0.8); }
    100% { transform: translate(0, 0) scale(1); }
}

/* Language Toggle */
.lang-toggle {
    position: absolute;
    top: 1.5rem;
    right: 2rem;
    display: flex;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.25rem;
    border-radius: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    z-index: 100;
}

.lang-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.4rem 0.8rem;
    border-radius: 1.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.lang-btn.active {
    background: var(--accent-color);
    color: white;
    box-shadow: 0 2px 10px rgba(59, 130, 246, 0.4);
}

/* Glassmorphism Container */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: 1.5rem;
    padding: 2.5rem;
    width: 100%;
    max-width: 600px;
    margin: 4rem auto;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.glass-panel:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.5);
}

/* Typography */
h1 {
    font-size: 2.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.05em;
}

p.subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 1rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 600;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    gap: 0.5rem;
    width: 100%;
}

.btn-primary {
    background: var(--accent-color);
    color: white;
    box-shadow: 0 4px 14px 0 rgba(59, 130, 246, 0.39);
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: scale(1.02);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-google {
    background: white;
    color: #1f2937;
    margin-top: 1rem;
}

.btn-google:hover {
    background: #f3f4f6;
    transform: scale(1.02);
}

.btn-google img {
    width: 20px;
    height: 20px;
}

/* Form Elements */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

input, select {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.5);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.2s;
    outline: none;
    min-height: 44px; /* Minimum touch target size */
}

input:focus, select:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
    background: rgba(255, 255, 255, 0.9);
}

/* Choices.js Custom Overrides */
.choices {
    margin-bottom: 0;
}
.choices__inner {
    border-radius: 0.75rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.5);
    min-height: 44px; /* 44px touch target */
    padding: 0.4rem 1rem;
    display: flex;
    align-items: center;
}
[data-theme="dark"] .choices__inner {
    background: rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.1);
}
.choices__list--dropdown {
    border-radius: 0.75rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    z-index: 1000;
}
[data-theme="dark"] .choices__list--dropdown {
    background: #1e293b;
    border-color: rgba(255, 255, 255, 0.1);
}
.choices__item {
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
}
[data-theme="dark"] .choices__item--choice {
    color: #e2e8f0;
}

/* Email Toggle Switch */
/* Uses a hidden checkbox and styled slider for a classic toggle effect */
.toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.switch {
    position: relative;
    display: inline-block;
    width: 44px; /* Minimum 44px width for touch targets */
    height: 24px;
    margin-bottom: 0; /* Overrides global label margin */
}
.switch input { 
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #9ca3af;
    transition: .4s;
    border-radius: 24px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}
input:checked + .slider {
    background-color: #10b981; /* Green color when active */
}
input:checked + .slider:before {
    transform: translateX(20px);
}

@media (max-width: 480px) {
    .mode-header {
        flex-direction: column;
        align-items: flex-start !important;
    }
    
    .hide-on-mobile {
        display: none !important;
    }
    
    .modal-actions {
        flex-direction: row;
        width: 100%;
        gap: 0.5rem;
    }
    
    .modal-actions .btn {
        width: auto;
        flex: 1;
        justify-content: center;
        padding: 0.8rem 0.2rem !important;
        font-size: 0.8rem;
    }
    
    .modal-content {
        padding: 1.5rem;
    }
    
    .capsule-btn {
        padding: 0.6rem !important;
        justify-content: center !important;
        gap: 0 !important;
    }
    .capsule-btn img {
        margin: 0 !important;
    }
}



/* File Upload Zone */
.upload-zone {
    border: 2px dashed rgba(0, 0, 0, 0.15);
    border-radius: 1rem;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.5);
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
}

.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--accent-color);
    background: rgba(59, 130, 246, 0.05);
}

.upload-zone input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

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

/* Progress Bar */
.progress-container {
    display: none;
    margin-top: 1.5rem;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: var(--accent-color);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 4px;
    position: relative;
}

/* Micro-animation for active progress */
.progress-fill.active::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0) 100%);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-align: center;
}

/* Validation Popup / Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
}

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

.modal-content {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 1.5rem;
    padding: 2rem;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    transform: translateY(20px);
    transition: transform 0.3s ease;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-title {
    color: var(--danger-color);
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.modal-body {
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    line-height: 1.5;
    overflow-y: auto;
    padding-right: 5px;
}

.modal-actions {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
    flex-shrink: 0;
}

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

.hover-bg-light {
    transition: background 0.2s ease;
}
.hover-bg-light:hover {
    background: rgba(0,0,0,0.05) !important;
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Toasts */
#toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    padding: 1rem 1.5rem;
    border-radius: 0.75rem;
    background: var(--glass-bg);
    border-left: 4px solid var(--accent-color);
    backdrop-filter: blur(10px);
    color: var(--text-primary);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateX(120%);
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.toast.show {
    transform: translateX(0);
}

.toast.error {
    border-left-color: var(--danger-color);
}

.toast.success {
    border-left-color: var(--success-color);
}

/* Sections */
.auth-section, .app-section {
    display: none;
}

.auth-section.active, .app-section.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

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

/* Utilities */
.hidden { display: none !important; }
.hint-text { color: var(--text-secondary); }
[data-theme="dark"] .hint-text { color: var(--text-hint); }
