/**
 * Khronicles Search Overlay — full-screen dark overlay.
 *
 * Tokens match geolocation.css: #2a2a2a cards, #555 borders, #c0392b accent.
 */

/* ── Full-screen overlay ─────────────────────────────── */

.khr-search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.98);
    z-index: 999999;
    opacity: 0;
    transition: opacity 0.3s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.khr-search-overlay.khr-search-visible {
    opacity: 1;
}

/* ── Close button ────────────────────────────────────── */

.khr-search-close {
    position: fixed;
    top: 20px;
    right: 28px;
    z-index: 1000000;
    background: none;
    border: none;
    color: #aaa;
    font-size: 36px;
    line-height: 1;
    cursor: pointer;
    padding: 8px;
    transition: color 0.2s;
}

.khr-search-close:hover {
    color: #fff;
}

/* ── Inner container ─────────────────────────────────── */

.khr-search-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 80px 24px 40px;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ── Search input row ────────────────────────────────── */

.khr-search-input-row {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.khr-search-overlay .khr-search-input,
.khr-search-overlay input[type="text"].khr-search-input {
    flex: 1;
    padding: 14px 18px;
    border: 1px solid #555;
    border-radius: 8px;
    background: #2a2a2a;
    color: #fff;
    font-size: 18px;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s;
}

.khr-search-overlay .khr-search-input::placeholder,
.khr-search-overlay input[type="text"].khr-search-input::placeholder {
    color: #999;
}

.khr-search-overlay .khr-search-input:focus,
.khr-search-overlay input[type="text"].khr-search-input:focus {
    border-color: #c0392b;
}

/* ── Near Me button ──────────────────────────────────── */

.khr-search-nearme {
    padding: 14px 20px;
    border: none;
    border-radius: 8px;
    background: #444;
    color: #e0e0e0;
    font-size: 15px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}

.khr-search-nearme:hover {
    background: #555;
}

.khr-search-nearme:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ── Geo status bar ──────────────────────────────────── */

.khr-search-geo-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    padding: 8px 14px;
    background: #1e6e3e;
    border-radius: 6px;
    color: #d4fce4;
    font-size: 14px;
}

.khr-search-geo-clear {
    background: none;
    border: none;
    color: #d4fce4;
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.khr-search-geo-clear:hover {
    opacity: 1;
}

/* ── Spinner ─────────────────────────────────────────── */

.khr-search-spinner {
    text-align: center;
    padding: 40px 0;
    color: #aaa;
    font-size: 14px;
}

/* Reuses .khr-spinner-dot from geolocation.css (same keyframes). */

/* ── Two-column results layout ───────────────────────── */

.khr-search-results {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    margin-top: 8px;
}

.khr-search-col-title {
    margin: 0 0 14px;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #aaa;
    border-bottom: 1px solid #444;
    padding-bottom: 8px;
}

.khr-search-col-title span {
    font-weight: 400;
    color: #888;
    font-size: 13px;
}

/* ── Story cards — 2x2 sub-grid ──────────────────────── */

.khr-search-stories-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

/* ── Cards (shared) ──────────────────────────────────── */

.khr-so-card {
    display: block;
    background: #2a2a2a;
    border: 1px solid #555;
    border-radius: 8px;
    overflow: hidden;
    text-decoration: none;
    color: #e0e0e0;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.khr-so-card:hover {
    border-color: #c0392b;
    box-shadow: 0 2px 12px rgba(192, 57, 43, 0.15);
}

.khr-so-card-body {
    padding: 10px 12px;
}

.khr-so-card-title {
    margin: 0 0 4px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    line-height: 1.3;
}

.khr-so-card-meta {
    margin: 0 0 4px;
    font-size: 12px;
    color: #aaa;
}

/* ── Story card thumbnail ────────────────────────────── */

.khr-so-thumb {
    width: 100%;
    height: 100px;
    overflow: hidden;
    background: #1a1a1a;
}

.khr-so-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ── Writer card (stacked list) ──────────────────────── */

.khr-search-writers-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.khr-so-writer-card {
    display: flex;
    align-items: center;
}

.khr-so-writer-avatar {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    margin: 10px 0 10px 10px;
    border-radius: 50%;
    overflow: hidden;
    background: #1a1a1a;
}

.khr-so-writer-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ── Badges (reuse geolocation tokens) ───────────────── */

.khr-search-overlay .khr-distance-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    background: #1e6e3e;
    color: #d4fce4;
    font-size: 11px;
    font-weight: 600;
    margin-right: 4px;
}

.khr-search-overlay .khr-city-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    background: #444;
    color: #ccc;
    font-size: 11px;
}

/* ── Empty state ─────────────────────────────────────── */

.khr-search-empty {
    text-align: center;
    padding: 60px 20px;
    color: #888;
    font-size: 16px;
}

/* ── Keyboard hints ──────────────────────────────────── */

.khr-search-hint {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 40px;
    color: #666;
    font-size: 13px;
}

.khr-search-hint kbd {
    display: inline-block;
    padding: 2px 7px;
    border: 1px solid #555;
    border-radius: 4px;
    background: #333;
    color: #aaa;
    font-family: inherit;
    font-size: 12px;
    margin-right: 4px;
}

/* ── Responsive: single column on mobile ─────────────── */

@media (max-width: 768px) {
    .khr-search-inner {
        padding: 60px 16px 32px;
    }

    .khr-search-input-row {
        flex-direction: column;
    }

    .khr-search-input {
        font-size: 16px;
    }

    .khr-search-nearme {
        width: 100%;
    }

    .khr-search-results {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .khr-search-stories-grid {
        grid-template-columns: 1fr;
    }

    .khr-search-close {
        top: 12px;
        right: 16px;
        font-size: 30px;
    }

    .khr-search-hint {
        display: none;
    }
}
