/* 
   Cookie Nonsense - Premium Design System & Stylesheet
   Theme: Deep Immersive Dark Space & Purple/Blue Aurora Accent
*/

:root {
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    /* Theme HSL Colors */
    --hue: 255;
    --bg-primary: hsl(var(--hue), 35%, 5%);
    --bg-secondary: hsl(var(--hue), 25%, 8%);
    --bg-card: rgba(22, 18, 38, 0.45);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.18);
    
    --accent-purple: hsl(285, 80%, 65%);
    --accent-blue: hsl(195, 85%, 60%);
    --accent-gradient: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
    
    --text-main: #f5f5f7;
    --text-muted: #8e8e93;
    --text-error: #ff453a;
    --text-success: #30d158;
    
    --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    --transition-bounce: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Base resets & layout */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-main);
    font-family: var(--font-body);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Ambient Radial Glow Overlays */
.ambient-glow {
    position: fixed;
    width: 60vw;
    height: 60vw;
    border-radius: 50%;
    filter: blur(140px);
    opacity: 0.15;
    pointer-events: none;
    z-index: 0;
}

.bg-glow-1 {
    background: radial-gradient(circle, var(--accent-purple) 0%, transparent 70%);
    top: -20vh;
    left: -20vw;
}

.bg-glow-2 {
    background: radial-gradient(circle, var(--accent-blue) 0%, transparent 70%);
    bottom: -20vh;
    right: -20vw;
}

/* Glassmorphism Card Container Base */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
    transition: var(--transition-smooth);
}

/* Typography */
h1, h2, h3 {
    font-family: var(--font-heading);
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* Buttons */
.btn {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1.05rem;
    padding: 14px 28px;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: var(--transition-bounce);
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--accent-gradient);
    color: #ffffff;
    box-shadow: 0 4px 20px rgba(171, 71, 188, 0.4);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(171, 71, 188, 0.6);
}

.btn-primary:active {
    transform: translateY(-1px);
}

.btn-glow::after {
    content: '';
    position: absolute;
    top: 0;
    left: -50%;
    width: 200%;
    height: 100%;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.15), transparent);
    transform: skewX(-25deg);
    transition: 0.75s;
    opacity: 0;
}

.btn-glow:hover::after {
    left: 125%;
    opacity: 1;
}

.icon-btn-text {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 8px 16px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    transition: var(--transition-smooth);
}

.icon-btn-text:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--border-hover);
}

/* Core Screens Switcher */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    min-height: 100vh;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
    z-index: 10;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.screen.active {
    opacity: 1;
    visibility: visible;
    position: relative;
}

/* ==========================================
   🔑 AUTHENTICATION LOCK SCREEN (PIN GATE)
   ========================================== */
#auth-screen {
    display: flex;
    justify-content: center;
    align-items: center;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    padding: 40px 30px;
    text-align: center;
    position: relative;
    z-index: 10;
}

.auth-header .lock-icon {
    font-size: 3.5rem;
    margin-bottom: 15px;
    display: inline-block;
    filter: drop-shadow(0 0 15px rgba(171, 71, 188, 0.6));
    animation: lockPulse 2s infinite alternate;
}

.auth-header h1 {
    font-size: 2.2rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}

.auth-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 30px;
}

/* PIN Dots Display Indicator */
.pin-display {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 35px;
}

.pin-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--text-muted);
    transition: var(--transition-bounce);
}

.pin-dot.filled {
    background-color: var(--accent-purple);
    border-color: var(--accent-purple);
    box-shadow: 0 0 12px var(--accent-purple);
    transform: scale(1.2);
}

.pin-dot.shake {
    animation: dotShake 0.4s ease;
}

/* Tactile Visual Keypad */
.keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    max-width: 300px;
    margin: 0 auto;
}

.key-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    aspect-ratio: 1;
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 500;
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-bounce);
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.key-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--border-hover);
    transform: scale(1.08);
}

.key-btn:active {
    background: var(--accent-gradient);
    border-color: transparent;
    transform: scale(0.92);
    box-shadow: 0 0 15px rgba(171, 71, 188, 0.4);
}

.key-btn.action-btn {
    font-size: 1.1rem;
    background: rgba(255, 255, 255, 0.01);
    color: var(--text-muted);
}

.error-msg {
    color: var(--text-error);
    font-size: 0.9rem;
    margin-top: 25px;
    opacity: 0;
    transition: var(--transition-smooth);
    height: 15px;
}

.error-msg.visible {
    opacity: 1;
    animation: textShake 0.4s ease;
}


/* ==========================================
   🖼️ MAIN APPLICATION SCREEN
   ========================================== */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 40px;
    background: rgba(11, 10, 19, 0.7);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-emoji {
    font-size: 1.8rem;
    filter: drop-shadow(0 0 8px rgba(171, 71, 188, 0.5));
}

.logo-text {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.4rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.app-content {
    margin-top: 80px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 1300px;
    margin-left: auto;
    margin-right: auto;
    padding-bottom: 60px;
    position: relative;
    z-index: 10;
}

/* Discovery Hub Control Panel */
.discovery-hub {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 25px;
    margin-bottom: 40px;
    width: 100%;
}

.hub-action-section {
    text-align: center;
}

.hub-search-section {
    width: 100%;
    max-width: 650px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.search-bar-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 18px;
    font-size: 1.1rem;
    color: var(--text-muted);
}

.search-bar-wrapper input {
    width: 100%;
    padding: 16px 50px 16px 48px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 1.05rem;
    transition: var(--transition-smooth);
    outline: none;
}

.search-bar-wrapper input:focus {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--accent-purple);
    box-shadow: 0 0 15px rgba(171, 71, 188, 0.2);
}

.clear-btn {
    position: absolute;
    right: 18px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.clear-btn:hover {
    color: var(--text-main);
}

/* Tabs Toggle for Search Method */
.search-toggle-container {
    display: flex;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 4px;
    border-radius: 12px;
    margin: 0 auto;
    width: fit-content;
}

.search-tab {
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 8px 18px;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    gap: 6px;
}

.search-tab.active {
    background: rgba(255, 255, 255, 0.08);
    color: var(--accent-blue);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* Embedding engine loader status indicator */
.embeddings-loader {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 30px;
    margin: 0 auto 30px auto;
    text-align: center;
    width: fit-content;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(171, 71, 188, 0.2);
    border-top-color: var(--accent-purple);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.embeddings-loader p {
    color: var(--text-muted);
    font-size: 0.9rem;
}


/* ==========================================
   🖼️ PHOTO SHOWCASE (RANDOM & GRID GALLERY)
   ========================================== */
.display-area {
    margin-top: 10px;
    width: 100%;
}

.section-title {
    font-size: 1.5rem;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-left: 4px solid var(--accent-purple);
    padding-left: 12px;
}

/* Surprise Me Random Showcase Card */
.random-showcase {
    margin-bottom: 50px;
    background: linear-gradient(135deg, rgba(171, 71, 188, 0.1), rgba(41, 182, 246, 0.1));
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 28px;
    padding: 30px;
    position: relative;
    animation: expandCard 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.1);
}

.showcase-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.showcase-header h2 {
    font-size: 1.4rem;
}

.close-badge {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    padding: 6px 14px;
    border-radius: 12px;
    cursor: pointer;
    color: var(--text-muted);
    font-weight: 500;
    transition: var(--transition-smooth);
}

.close-badge:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.10);
}

.random-card {
    max-width: 650px;
    margin: 0 auto;
    overflow: hidden;
}

.image-wrapper {
    width: 100%;
    aspect-ratio: 16/10;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.5s ease;
}

.random-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: rgba(0, 0, 0, 0.2);
}

.image-title {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1.15rem;
    text-transform: capitalize;
    color: var(--text-main);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 15px;
}

.download-link {
    color: var(--accent-blue);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    transition: var(--transition-smooth);
}

.download-link:hover {
    text-decoration: underline;
    color: var(--text-main);
}

/* Loader Shimmer placeholder */
.card-loading .image-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.01), rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.01));
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

/* Beautiful Interactive Gallery Grid */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
}

.photo-card {
    overflow: hidden;
    cursor: pointer;
}

.photo-card:hover {
    transform: translateY(-5px) scale(1.02);
    border-color: var(--border-hover);
    box-shadow: 0 12px 30px rgba(0,0,0,0.5), 0 0 15px rgba(171, 71, 188, 0.15);
}

.photo-card .image-wrapper {
    aspect-ratio: 4/3;
}

.photo-card:hover img {
    transform: scale(1.05);
}

.photo-card-footer {
    padding: 16px 20px;
    background: rgba(0, 0, 0, 0.15);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.03);
}

.photo-card-footer .image-title {
    font-size: 0.95rem;
}

/* Match Score Indicator for Semantic Search */
.match-score {
    background: rgba(48, 209, 88, 0.12);
    border: 1px solid rgba(48, 209, 88, 0.25);
    color: var(--text-success);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.8rem;
    padding: 4px 10px;
    border-radius: 8px;
    white-space: nowrap;
    box-shadow: 0 0 8px rgba(48, 209, 88, 0.1);
}

.match-score.partial {
    background: rgba(41, 182, 246, 0.12);
    border: 1px solid rgba(41, 182, 246, 0.25);
    color: var(--accent-blue);
}

/* No Results card */
.no-results {
    text-align: center;
    padding: 80px 40px;
    background: rgba(255,255,255,0.01);
    border: 1px dashed var(--border-color);
    border-radius: 24px;
    margin: 20px 0;
}

.no-results-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.no-results h3 {
    font-size: 1.4rem;
    margin-bottom: 10px;
}

.no-results p {
    color: var(--text-muted);
    font-size: 0.95rem;
    max-width: 500px;
    margin: 0 auto;
}


/* ==========================================
   🖼️ FULLSCREEN MODAL VIEWER
   ========================================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(6, 5, 11, 0.9);
    backdrop-filter: blur(15px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal.visible {
    opacity: 1;
    visibility: visible;
}

.modal-close {
    position: absolute;
    top: 25px;
    right: 35px;
    color: var(--text-main);
    font-size: 2.8rem;
    cursor: pointer;
    z-index: 1010;
    transition: var(--transition-smooth);
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: var(--accent-purple);
    transform: scale(1.1) rotate(90deg);
}

.modal-content-wrapper {
    width: 90%;
    max-width: 900px;
    animation: zoomIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.15);
}

.modal-card {
    background: #000;
    border: 1px solid var(--border-color);
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
}

.modal-card img {
    width: 100%;
    max-height: 70vh;
    object-fit: contain;
    display: block;
    margin: 0 auto;
    background: #000;
}

.modal-footer {
    padding: 25px 35px;
    background: var(--bg-secondary);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.4rem;
    text-transform: capitalize;
    color: var(--text-main);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 20px;
}

.modal-download-btn {
    background: var(--accent-gradient);
    color: #ffffff;
    font-family: var(--font-heading);
    font-weight: 600;
    text-decoration: none;
    font-size: 0.95rem;
    padding: 12px 24px;
    border-radius: 14px;
    white-space: nowrap;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 15px rgba(171, 71, 188, 0.3);
}

.modal-download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(171, 71, 188, 0.55);
}


/* ==========================================
   🎬 ANIMATIONS & KEYFRAMES
   ========================================== */
@keyframes spin {
    to { transform: rotate(360deg); }
}

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

@keyframes lockPulse {
    from { transform: scale(1); filter: drop-shadow(0 0 10px rgba(171, 71, 188, 0.5)); }
    to { transform: scale(1.05); filter: drop-shadow(0 0 20px rgba(171, 71, 188, 0.8)); }
}

@keyframes textShake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

@keyframes dotShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes zoomIn {
    from { transform: scale(0.92); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes expandCard {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}


/* ==========================================
   📱 RESPONSIVE BREAKPOINTS
   ========================================== */
@media (max-width: 768px) {
    .app-header {
        padding: 15px 20px;
    }
    
    .logo-text {
        font-size: 1.25rem;
    }
    
    .app-content {
        padding: 0 10px 40px 10px;
    }
    
    .discovery-hub {
        gap: 15px;
        margin-bottom: 25px;
    }
    
    .search-bar-wrapper input {
        padding: 14px 44px 14px 40px;
        font-size: 0.95rem;
    }
    
    .search-icon {
        left: 14px;
        font-size: 1rem;
    }
    
    .btn {
        padding: 12px 24px;
        font-size: 0.95rem;
    }
    
    .photo-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 15px;
    }
    
    .random-showcase {
        padding: 15px;
        border-radius: 20px;
    }
    
    .random-card-footer {
        padding: 15px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .random-card-footer .image-title {
        font-size: 1.05rem;
        padding-right: 0;
        width: 100%;
    }
    
    .modal-close {
        top: 15px;
        right: 15px;
        font-size: 2.2rem;
    }
    
    .modal-footer {
        padding: 15px 20px;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .modal-title {
        font-size: 1.15rem;
        padding-right: 0;
        width: 100%;
    }
    
    .modal-download-btn {
        width: 100%;
        text-align: center;
    }
}
/* ==========================================
   🖥️ WIDESCREEN DESKTOP ENHANCEMENTS
   ========================================== */
@media (min-width: 1024px) {
    .auth-card {
        max-width: 480px;
        padding: 60px 45px;
    }
    
    .auth-header .lock-icon {
        font-size: 4rem;
        margin-bottom: 20px;
    }
    
    .auth-header h1 {
        font-size: 2.5rem;
    }
    
    .pin-display {
        gap: 25px;
        margin-bottom: 45px;
    }
    
    .pin-dot {
        width: 20px;
        height: 20px;
    }
    
    .keypad {
        gap: 20px;
    }
    
    .key-btn {
        font-size: 1.8rem;
    }
    
    .app-content {
        max-width: 1600px;
        padding: 0 45px 80px 45px;
        margin-top: 100px;
    }
    
    .photo-grid {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
        gap: 30px;
    }
    
    .hub-search-section {
        max-width: 800px;
    }
    
    .random-card {
        max-width: 850px;
    }
    
    .image-title {
        font-size: 1.25rem;
    }
}

.hidden {
    display: none !important;
}

