/* Custom CSS for HandWriting Analysis Web App */

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Prevent layout shift when scrollbar appears/disappears between pages */
html {
    scrollbar-gutter: stable;
}

body {
    overflow-y: scroll;
}

/* Custom animations */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

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

.slide-in {
    animation: slideIn 0.3s ease-out;
}

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

/* Custom gradient backgrounds */
.gradient-bg {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Custom card styles */
.glass-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* File upload area */
.upload-area {
    border: 2px dashed #d1d5db;
    transition: all 0.3s ease;
}

.upload-area:hover {
    border-color: #6366f1;
    background-color: #f8fafc;
}

.upload-area.dragover {
    border-color: #4f46e5;
    background-color: #eef2ff;
}

/* Analysis result cards */
.result-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.result-card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

/* Credit purchase cards */
.credit-package {
    border: 2px solid #e5e7eb;
    transition: all 0.3s ease;
}

.credit-package:hover {
    border-color: #6366f1;
    box-shadow: 0 8px 25px -8px rgba(99, 102, 241, 0.3);
}

.credit-package.popular {
    border-color: #f59e0b;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
}

/* Loading states */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Responsive text */
@media (max-width: 768px) {
    .text-5xl { font-size: 2.5rem; }
    .text-4xl { font-size: 2rem; }
    .text-3xl { font-size: 1.75rem; }
}

/* Custom scrollbar */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Progress bar */
.progress-bar {
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
    transition: width 0.3s ease;
}

/* Notification styles */
.notification {
    position: fixed;
    top: 80px;
    right: 20px;
    max-width: 400px;
    padding: 16px;
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.notification.success {
    background: #d1fae5;
    color: #065f46;
    border-left: 4px solid #10b981;
}

.notification.error {
    background: #fee2e2;
    color: #991b1b;
    border-left: 4px solid #ef4444;
}

.notification.warning {
    background: #fef3c7;
    color: #92400e;
    border-left: 4px solid #f59e0b;
}

.notification.info {
    background: #dbeafe;
    color: #1e40af;
    border-left: 4px solid #3b82f6;
}

/* Horoscope modal styling */
.gradient-card {
    box-shadow: 0 12px 24px -18px rgba(15, 23, 42, 0.4);
}

.horoscope-section-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
}

/* Reduce header CLS by reserving space for auth controls */
#navbar #login-btn.hidden,
#navbar #user-menu.hidden,
#navbar #credits-display.hidden {
    display: inline-flex !important;
    visibility: hidden;
    pointer-events: none;
}

#navbar #user-menu.hidden #user-dropdown {
    display: none !important;
}

/* Initial auth-state layout stabilization */
html[data-auth="logged-in"] #home {
    display: none;
}

html[data-auth="logged-in"] #app-container {
    display: block !important;
}

html[data-auth="guest"] #app-container {
    display: none !important;
}

html[data-auth="logged-in"] .guest-only {
    display: none !important;
}

html[data-auth="guest"] .auth-only {
    display: none !important;
}

/* Active navigation state */
#navbar a.is-active {
    color: #fcd34d;
    font-weight: 600;
}

#navbar a.is-active:hover {
    color: #fde68a;
}

@media (min-width: 768px) {
    #navbar .nav-layout {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
        align-items: center;
    }

    #navbar .nav-links {
        justify-self: center;
    }

    #navbar .nav-actions {
        justify-self: end;
        display: flex;
        align-items: center;
        gap: 1rem;
        min-width: 220px;
    }
}

#mobile-menu a.is-active {
    background-color: rgba(255, 255, 255, 0.12);
}

/* Analysis type selection */
.analysis-type-card {
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.analysis-type-card:hover {
    border-color: #6366f1;
    box-shadow: 0 8px 25px -8px rgba(99, 102, 241, 0.3);
}

.analysis-type-card.selected {
    border-color: #6366f1;
    background: #eef2ff;
}

/* Horoscope card */
.horoscope-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 20px;
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

.horoscope-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
}

/* Mobile optimizations */
@media (max-width: 640px) {
    .notification {
        left: 20px;
        right: 20px;
        max-width: none;
    }
    
    .upload-area {
        min-height: 200px;
    }
    
    .result-card {
        margin: 0 10px;
    }
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    .result-card {
        box-shadow: none;
        border: 1px solid #e5e7eb;
        page-break-inside: avoid;
    }
}
/* Inline styles migrated from index.html */
.emoji-flag {
            font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', 'Twemoji Mozilla', 'Android Emoji', 'EmojiSymbols', sans-serif !important;
            font-feature-settings: 'liga';
            font-variant-emoji: emoji;
            display: inline-block;
            width: 1em;
            height: 1em;
            line-height: 1;
            text-align: center;
        }
        
        /* Ensure all flag elements render properly */
        #current-language-flag, 
        #mobile-current-language-flag,
        .language-option .emoji-flag,
        .language-option span[class*="flag"] {
            font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', 'Twemoji Mozilla', 'Android Emoji', 'EmojiSymbols', sans-serif !important;
            font-feature-settings: 'liga';
            font-variant-emoji: emoji;
            display: inline-block;
            line-height: 1;
            text-align: center;
        }
        
        /* Force emoji rendering for language modal */
        .language-option .emoji-flag {
            font-size: 24px !important;
            width: 24px;
            height: 24px;
            line-height: 24px;
        }
        
        /* Desktop dropdown styling */
        #user-dropdown {
            z-index: 1000;
        }
        
        #user-dropdown.hidden {
            display: none;
        }
        
        #user-dropdown:not(.hidden) {
            display: block;
        }
        
        /* Mobile-specific improvements */
        @media (max-width: 768px) {
            /* Responsive text sizing for long Norwegian words */
            h1 {
                font-size: 2.5rem !important; /* Reduce from text-6xl to prevent overflow */
                line-height: 1.1 !important;
                word-wrap: break-word;
                hyphens: auto;
                overflow-wrap: break-word;
            }
            
            /* Specific targeting for hero section text */
            h1 .text-gray-800[data-translate="handwritingAnalysis"] {
                font-size: 2.25rem !important; /* Even smaller for the long Norwegian compound word */
                line-height: 1.1 !important;
                word-break: break-word;
                hyphens: auto;
            }
            
            /* Ensure Downloads page headings are also responsive */
            #downloads-hero h1 {
                font-size: 2.5rem !important;
                line-height: 1.1 !important;
                word-wrap: break-word;
                hyphens: auto;
            }
            
            /* Additional text responsiveness for long compound words */
            h2, h3 {
                word-wrap: break-word;
                hyphens: auto;
                overflow-wrap: break-word;
            }
            
            /* Prevent horizontal overflow on mobile */
            body {
                overflow-x: hidden;
            }
            
            /* Ensure containers don't exceed viewport width */
            .max-w-7xl, .max-w-4xl, .max-w-3xl {
                max-width: calc(100vw - 2rem) !important;
                margin-left: auto;
                margin-right: auto;
            }
        }
        
        /* Extra small mobile devices (phones) */
        @media (max-width: 480px) {
            /* Further reduce text size for very small screens */
            h1 {
                font-size: 2rem !important; /* Even smaller on phones */
                line-height: 1.1 !important;
            }
            
            /* Specifically handle the Norwegian compound word */
            h1 .text-gray-800[data-translate="handwritingAnalysis"] {
                font-size: 1.875rem !important; /* 30px equivalent, smaller for Norwegian */
                line-height: 1.1 !important;
            }
            
            /* Downloads page for phones */
            #downloads-hero h1 {
                font-size: 2rem !important;
                line-height: 1.1 !important;
            }
            
            /* Adjust paragraph text for better readability */
            .text-xl {
                font-size: 1.125rem !important; /* Reduce from text-xl */
                line-height: 1.4 !important;
            }
            
            /* Ensure padding doesn't cause overflow */
            .px-4 {
                padding-left: 1rem !important;
                padding-right: 1rem !important;
            }
            
            /* Ensure proper touch targets on mobile */
            .mobile-touch-target {
                min-height: 44px;
                display: flex;
                align-items: center;
            }
            
            /* Improve mobile modal display */
            .fixed.inset-0 {
                padding: 16px;
            }
            
            /* Mobile menu improvements */
            #mobile-menu {
                max-height: calc(100vh - 64px);
                overflow-y: auto;
            }
            
            /* Better spacing for mobile user section */
            #mobile-user-section {
                margin-top: 8px;
                padding-top: 8px;
            }
            
            /* Ensure mobile buttons are properly sized */
            #mobile-menu button {
                min-height: 44px;
                touch-action: manipulation;
            }
            
            /* Fix modal sizing on mobile */
            .modal-body {
                max-height: 70vh;
                overflow-y: auto;
            }
            
            /* Improve touch interaction */
            button, a {
                touch-action: manipulation;
            }
            
            /* Fix header z-index issues on mobile */
            nav {
                z-index: 100;
            }
            
            /* Hide desktop dropdown on mobile - use mobile menu instead */
            /* Note: This rule is now properly scoped to mobile only */
            
            /* Hide desktop dropdown and user menu button on mobile */
            #user-dropdown {
                display: none !important;
            }
            
            #user-menu {
                display: none !important;
            }
            
            /* Ensure mobile menu is accessible */
            #mobile-menu {
                touch-action: manipulation;
            }
            
            /* Make mobile menu items more touchable */
            #mobile-menu button,
            #mobile-menu a {
                min-height: 48px;
                padding: 12px 16px;
                display: flex;
                align-items: center;
                font-size: 16px;
                touch-action: manipulation;
                -webkit-tap-highlight-color: rgba(255, 255, 255, 0.2);
                border: none;
                background: transparent;
                color: white;
                width: 100%;
                text-align: left;
                justify-content: flex-start;
            }
            
            /* Mobile menu button hover states */
            #mobile-menu button:hover,
            #mobile-menu a:hover {
                background-color: rgba(255, 255, 255, 0.1);
            }
            
            /* Mobile hamburger button */
            #mobile-menu-btn {
                touch-action: manipulation;
                -webkit-tap-highlight-color: rgba(255, 255, 255, 0.2);
            }
        }
        
        .skip-link {
            position: absolute;
            left: -999px;
            top: auto;
            width: 1px;
            height: 1px;
            padding: 0.5rem 1rem;
            overflow: hidden;
            background: #ffffff;
            color: #1e3a8a;
            border-radius: 999px;
            box-shadow: 0 10px 20px rgba(30, 58, 138, 0.2);
            z-index: 2000;
            transition: all 0.3s ease;
        }
        
        .skip-link:focus {
            left: 1.5rem;
            width: auto;
            height: auto;
            outline: 2px solid #1e3a8a;
        }



