/* ==========================================================================
   DRILL CSS - v10.4.1 Solaris Ether
   Filters, Grid, Search Controls + Adaptive Search Panel (1366px Fix)
   ========================================================================== */

/* ==========================================================================
   1. PAGE & CONTAINER LAYOUT
   ========================================================================== */
.timeline-container {
    padding: 7px 10px;
    overflow-y: auto;
    height: 100vh;
    box-sizing: border-box;
    background: var(--bg-main);
}
#page-drill .timeline-container {
    padding-top: 0;
}

/* ==========================================================================
   2. HEADER & STICKY CONTROLS (Desktop)
   ========================================================================== */
.timeline-header-section {
    margin: 0 auto 10px auto;
    background: transparent;
    border: none;
    box-shadow: none;
}
.timeline-header-section h1 {
    margin: 0 0 15px 0;
    font-size: 32px;
    color: var(--accent);
}
.drill-sticky-header {
    position: sticky;
    top: 0;
    background: transparent;
    z-index: 110;
}
.drill-meta-container {
    width: 100%;
    margin: 0;
    background: transparent;
    border: none;
    box-shadow: none;
}
.drill-controls-row {
    display: flex;
    align-items: center;
    gap: 15px;
}
.drill-search-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-right: 12px;
}

/* ==========================================================================
   3. FILTER CONTROLS
   ========================================================================== */
#drill-search-input,
#drill-meta-slicer,
#drill-location-slicer,
#drill-author-slicer,
.drill-controls-row select {
    height: 44px;
    padding: 0 15px;
    box-sizing: border-box;
    font-size: 16px;
    color: #334155;
    background-color: var(--card-bg);
    border: 1px solid var(--accent);
    border-radius: 8px;
    appearance: auto;
    -webkit-appearance: menulist;
}
#drill-search-input::placeholder {
    color: #334155;
    opacity: 0.7;
}
#drill-search-input:focus,
#drill-meta-slicer:focus,
#drill-location-slicer:focus,
#drill-author-slicer:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.1);
    outline: none;
}
#drill-meta-slicer:hover,
#drill-location-slicer:hover,
#drill-author-slicer:hover {
    border-color: #cbd5e1;
}
.drill-controls-row button {
    height: 44px;
    padding: 0 25px;
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
    background-color: var(--card-bg);
    border: 1px solid var(--accent);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

/* ==========================================================================
   4. CARD GRID
   ========================================================================== */
.timeline-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    width: 100%;
    margin: 0;
    contain: layout style;
    content-visibility: auto;
    contain-intrinsic-size: 1px 500px;
}

/* Dynamic Scroll HUD */
#drill-scroll-hud {
    position: fixed;
    top: 18px;
    left: 50%;
    transform: translateX(-50%) translateY(-12px) scale(0.95);
    background: rgba(253, 251, 247, 0.78);
    backdrop-filter: blur(22px) saturate(180%);
    -webkit-backdrop-filter: blur(22px) saturate(180%);
    border: 1px solid rgba(184, 134, 11, 0.22);
    border-radius: 9999px;
    padding: 10px 24px;
    display: flex;
    align-items: center;
    gap: 14px;
    z-index: 99999;
    box-shadow: 0 10px 28px -8px rgba(184, 134, 11, 0.22), 0 3px 10px -3px rgba(0, 0, 0, 0.08);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

#drill-scroll-hud.active {
    transform: translateX(-50%) translateY(0) scale(1);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.hud-time {
    font-family: "Georgia", serif;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: #B8860B;
    text-transform: uppercase;
    white-space: nowrap;
}

.hud-divider { width: 1px; height: 16px; background: rgba(184, 134, 11, 0.3); }

.hud-icons {
    font-size: 19px;
    display: flex;
    gap: 8px;
    animation: emojiBreath 2s ease-in-out 1;
}

/* ==========================================================================
DRILL FLASH MESSAGE (Transient Counter)
========================================================================== */
.flash-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: rgba(253, 251, 247, 0.95);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid rgba(184, 134, 11, 0.3);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    color: #B8860B;
    font-family: "Georgia", serif;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 16px 40px;
    border-radius: 50px;
    z-index: 9999999;
    
    /* Default hidden state */
    opacity: 0;
    pointer-events: none; /* Ensures it never blocks user clicks */
    transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* The active state that triggers the animation */
.flash-message.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* ==========================================================================
   5. ADAPTIVE OVERRIDES (max-width: 1366px)
   ========================================================================== */
@media (max-width: 1366px) {
    #page-drill {
        left: 0 !important;
        width: 100%;
        bottom: 65px !important;
    }

    .drill-search-icon {
        display: none;
    }

    /* Logic transferred from XXX Drill.css: Pop-over search panel */
    .drill-sticky-header {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        z-index: 99999;
        padding: 10px 0;
        padding-top: calc(10px + var(--safe-top));
        background: transparent;
        border: none;
        box-shadow: none;
        opacity: 0;
        transform: translateY(-20px);
        pointer-events: none;
        transition: opacity 0.3s ease, transform 0.3s ease;
        visibility: hidden;
    }

    .drill-sticky-header.active {
        opacity: 1;
        transform: translateY(0);
        pointer-events: auto;
        visibility: visible;
        background: rgba(253, 251, 247, 0.98);
        padding-top: calc(10px + var(--safe-top));
    }

    .drill-meta-container {
        width: 100%;
        background: transparent;
        box-shadow: none;
        border: none;
    }

    .drill-controls-row {
        display: flex !important;
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        width: 92%;
        margin: 0 auto 25px auto;
        padding: 12px;
        border-radius: 12px;
        background: transparent;
        backdrop-filter: blur(10px) saturate(180%);
        -webkit-backdrop-filter: blur(10px) saturate(180%);
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    }

    #drill-search-input,
    #drill-meta-slicer,
    #drill-location-slicer,
    #drill-author-slicer,
    .drill-controls-row select,
    .drill-controls-row button {
        width: 100%;
        height: 42px;
        font-size: 16px;
        color: #334155;
        background-color: var(--card-bg);
        border: 1px solid var(--accent);
        border-radius: 8px;
        padding: 0 12px;
        margin: 0;
        box-sizing: border-box;
    }

    .timeline-grid {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        gap: 15px !important;
    }

    .timeline-card {
        content-visibility: visible !important;
        contain: layout style !important;
    }

    #page-drill .prediction-body-text,
    #page-drill .timeline-body,
    #page-drill .prediction-text {
        color: var(--text-main);
    }

    #page-drill .prediction-date-label {
        color: var(--text-muted);
    }

    .drill-card,
    .prediction-entry {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        box-sizing: border-box !important;
    }

    @keyframes emojiBreath {
        0%, 100% { transform: scale(1); }
        50% { transform: scale(1.15); }
    }

    .flash-message {
        font-size: 16px;          /* Smaller text to prevent wrapping */
        padding: 10px 25px;       /* Tighter padding */
        width: auto;              /* Allow it to shrink to fit content */
        max-width: 90vw;          /* Prevent it from hitting screen edges */
        white-space: nowrap;      /* Force text to stay on one line */
        letter-spacing: 0.02em;   /* Slightly tighter tracking */
    }

    /* ==========================================================================
    CLEAR ALL PILL — Mobile-First Harmony
    ========================================================================== */

    .clear-all-pill {
        position: fixed;
        top: 18px;
        right: 16px;
        z-index: 99999;
        background: #B8860B;
        color: #fffdf0;
        padding: 8px 18px;
        border-radius: 9999px;
        font-family: "Georgia", serif;
        font-size: 14px;
        font-weight: 600;
        letter-spacing: -0.02em;
        box-shadow: 0 6px 16px -4px rgba(184, 134, 11, 0.45);
        white-space: nowrap;
        width: fit-content;
        align-items: center;
        cursor: pointer;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        display: none; /* hidden by default, shown only on mobile */
    }

    .clear-all-pill:active {
        transform: scale(0.95);
    }

    /* Golden Hour harmony */
    [data-theme="golden"] .clear-all-pill {
        background: #d97706;
        color: #3f2a1e;
    }

    #drill-scroll-hud {
        z-index: 100000;   /* higher than the pill */
    }
}

/* Make it smaller & more elegant on smartphones */
@media (max-width: 768px) {
    .clear-all-pill {
        font-size: 13px;
        padding: 6px 16px;
        top: 18px;
        right: 16px;
        box-shadow: 0 4px 12px -3px rgba(184, 134, 11, 0.4);
        transform: scale(0.92); /* gentle breathing room */
    }

    .clear-all-pill:active {
        transform: scale(0.88);
    }

    /* Golden Hour harmony */
    [data-theme="golden"] .clear-all-pill {
        background: #d97706;
        color: #3f2a1e;
    }

    #drill-scroll-hud {
        z-index: 100000;   /* higher than the pill */
    }
}

/* ==================== LARGER SCREENS ==================== */
@media (min-width: 769px) {
    .clear-all-pill {
        display: none !important;     /* Never show on tablet/desktop/27" */
    }
}