/**
 * Search Modal Styles
 *
 * Design follows venue_details and artist_details modal patterns:
 * - Full screen on mobile, centered modal on desktop
 * - Dark theme with design token variables
 *
 * Modal z-index: All modals start at 10000 base.
 * The modalStackManager.js dynamically assigns higher z-index values
 * to modals opened later, ensuring proper stacking regardless of order.
 * CSS prefix: smm- (Search Modal)
 */

/* ============================================
   MODAL OVERLAY & CONTAINER
   ============================================ */

.smm-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000; /* Base value - modalStackManager overrides dynamically */
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10vh;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.smm-overlay[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
}

.smm-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.smm-container {
    position: relative;
    width: 100%;
    max-width: 600px;
    max-height: 80vh;
    background: var(--bg-primary, #121212);
    border-radius: var(--radius-xl, 16px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: translateY(-20px);
    transition: transform 0.2s ease;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.smm-overlay[aria-hidden="false"] .smm-container {
    transform: translateY(0);
}

/* Mobile: full screen */
@media (max-width: 767px) {
    .smm-overlay {
        padding-top: 0;
        align-items: stretch;
    }

    .smm-container {
        max-width: 100%;
        max-height: 100%;
        height: 100%;
        border-radius: 0;
    }
}

/* ============================================
   HEADER WITH SEARCH INPUT
   ============================================ */

.smm-header {
    display: flex;
    align-items: center;
    gap: var(--space-2, 8px);
    padding: var(--space-3, 12px) var(--space-4, 16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: var(--bg-primary, #121212);
}

.smm-input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.smm-input-icon {
    position: absolute;
    left: 12px;
    width: 20px;
    height: 20px;
    color: var(--text-tertiary, #666);
    pointer-events: none;
}

.smm-input {
    width: 100%;
    padding: 12px 40px;
    font-size: 16px;
    color: var(--text-primary, #fff);
    background: var(--bg-secondary, #1a1a1a);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg, 12px);
    outline: none;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.smm-input::placeholder {
    color: var(--text-tertiary, #666);
}

.smm-input:focus {
    border-color: rgba(255, 255, 255, 0.25);
    background: var(--bg-tertiary, #222);
}

.smm-clear-btn {
    position: absolute;
    right: 8px;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-tertiary, #888);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, color 0.15s ease;
}

.smm-clear-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-primary, #fff);
}

.smm-clear-btn svg {
    width: 16px;
    height: 16px;
}

.smm-close-btn {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary, #aaa);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, color 0.15s ease;
}

.smm-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-primary, #fff);
}

.smm-close-btn svg {
    width: 20px;
    height: 20px;
}

/* ============================================
   CONTENT AREA
   ============================================ */

.smm-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: var(--space-4, 16px);
    -webkit-overflow-scrolling: touch;
}

/* ============================================
   INITIAL STATE (HINTS & RECENT)
   ============================================ */

.smm-initial-state {
    /* Shown when no search query */
}

.smm-recent-section {
    margin-bottom: var(--space-5, 20px);
}

.smm-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-3, 12px);
}

.smm-section-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-tertiary, #888);
}

.smm-clear-recent {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary, #aaa);
    background: none;
    border: none;
    padding: 4px 8px;
    border-radius: var(--radius-sm, 4px);
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease;
}

.smm-clear-recent:hover {
    color: var(--text-primary, #fff);
    background: rgba(255, 255, 255, 0.1);
}

.smm-recent-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-1, 4px);
}

.smm-recent-item {
    display: flex;
    align-items: center;
    gap: var(--space-3, 12px);
    padding: var(--space-2, 8px) var(--space-3, 12px);
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-radius: var(--radius-md, 8px);
    cursor: pointer;
    text-align: left;
    color: var(--text-primary, #fff);
    font-size: 14px;
    transition: background 0.15s ease;
    width: 100%;
}

.smm-recent-item:hover,
.smm-recent-item.smm-highlighted {
    background: rgba(255, 255, 255, 0.1);
}

.smm-recent-item svg {
    width: 16px;
    height: 16px;
    color: var(--text-tertiary, #888);
    flex-shrink: 0;
}

.smm-hints {
    padding: var(--space-4, 16px);
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-lg, 12px);
}

.smm-hints-title {
    font-size: 13px;
    color: var(--text-tertiary, #888);
    margin: 0 0 var(--space-3, 12px);
}

.smm-hints-list {
    margin: 0;
    padding-left: var(--space-5, 20px);
    color: var(--text-secondary, #aaa);
    font-size: 14px;
    line-height: 1.8;
}

.smm-hints-list li {
    margin-bottom: 4px;
}

/* ============================================
   LOADING STATE
   ============================================ */

.smm-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 150px;
    color: var(--text-tertiary, #888);
}

.smm-loading::after {
    content: '';
    width: 28px;
    height: 28px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: smm-spin 0.8s linear infinite;
}

@keyframes smm-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   RESULTS CONTAINER
   ============================================ */

.smm-results {
    display: flex;
    flex-direction: column;
    gap: var(--space-5, 20px);
}

/* Result section (Artists, Venues, Shows) */
.smm-result-section {
    /* Container for each result type */
}

.smm-result-section-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-tertiary, #888);
    margin: 0 0 var(--space-3, 12px);
}

.smm-result-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-1, 4px);
}

/* ============================================
   RESULT ITEMS
   ============================================ */

.smm-result-item {
    display: flex;
    align-items: center;
    gap: var(--space-3, 12px);
    padding: var(--space-2, 8px) var(--space-3, 12px);
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-lg, 12px);
    cursor: pointer;
    transition: background 0.15s ease;
}

.smm-result-item:hover,
.smm-result-item.smm-highlighted {
    background: rgba(255, 255, 255, 0.12);
}

/* Highlighted state for keyboard navigation */
.smm-result-item.smm-highlighted {
    outline: 2px solid rgba(255, 255, 255, 0.25);
    outline-offset: -2px;
}

/* Result image/thumbnail */
.smm-result-image {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md, 8px);
    overflow: hidden;
    background: var(--bg-tertiary, #222);
}

.smm-result-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.smm-result-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary, #222);
    color: var(--text-tertiary, #666);
}

.smm-result-image-placeholder svg {
    width: 22px;
    height: 22px;
}

/* Result info */
.smm-result-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.smm-result-primary {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary, #fff);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.smm-result-secondary {
    font-size: 12px;
    color: var(--text-tertiary, #888);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Matched artist name highlight */
.smm-artist-match {
    color: var(--accent-primary, #1DB954);
    font-weight: 600;
}

/* Type badge (for result type indication) */
.smm-result-type {
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-tertiary, #666);
    padding: 3px 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm, 4px);
}

/* ============================================
   NO RESULTS STATE
   ============================================ */

.smm-no-results {
    text-align: center;
    padding: var(--space-6, 24px) var(--space-4, 16px);
}

.smm-no-results-text {
    font-size: 15px;
    color: var(--text-secondary, #aaa);
    margin: 0 0 var(--space-4, 16px);
}

.smm-no-results-hints {
    text-align: left;
    padding: var(--space-4, 16px);
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-lg, 12px);
    display: inline-block;
}

.smm-no-results-hints p {
    font-size: 13px;
    color: var(--text-tertiary, #888);
    margin: 0 0 var(--space-2, 8px);
}

.smm-no-results-hints ul {
    margin: 0;
    padding-left: var(--space-5, 20px);
    color: var(--text-secondary, #aaa);
    font-size: 13px;
    line-height: 1.6;
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */

/* Firefox */
.smm-content {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

/* Chrome, Safari, Edge */
.smm-content::-webkit-scrollbar {
    width: 6px;
}

.smm-content::-webkit-scrollbar-track {
    background: transparent;
}

.smm-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

.smm-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* ============================================
   BODY SCROLL LOCK
   ============================================ */

body.smm-open {
    overflow: hidden;
}

/* ============================================
   DATE FILTER INDICATOR
   ============================================ */

.smm-date-indicator {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2, 8px);
    padding: var(--space-2, 8px) var(--space-3, 12px);
    margin-bottom: var(--space-3, 12px);
    background: rgba(29, 185, 84, 0.15);
    border-radius: var(--radius-md, 8px);
    font-size: 13px;
    color: var(--accent-primary, #1DB954);
}

.smm-date-indicator svg {
    width: 14px;
    height: 14px;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (max-width: 767px) {
    .smm-header {
        padding: var(--space-3, 12px);
    }

    .smm-input {
        font-size: 16px; /* Prevent iOS zoom */
        padding: 10px 36px;
    }

    .smm-input-icon {
        left: 10px;
        width: 18px;
        height: 18px;
    }

    .smm-content {
        padding: var(--space-3, 12px);
    }

    .smm-result-image {
        width: 40px;
        height: 40px;
    }

    .smm-result-primary {
        font-size: 14px;
    }

    .smm-result-secondary {
        font-size: 11px;
    }
}
