/* Vocabulary Search Sidebar - Grid Layout Integration */

/* Grid layout for standard mode only */
body:not(.focus-mode):not(.video-mode) .container {
    display: grid;
    grid-template-columns: 300px 1fr;
    grid-template-rows: auto auto auto 1fr auto auto auto;
    gap: 0 30px;
    max-width: 1400px;
    padding: 0 20px;
}

/* Position grid items */
body:not(.focus-mode):not(.video-mode) .top-bar {
    grid-column: 1 / -1; /* Full width */
    grid-row: 1;
    max-width: calc(100% - 60px); /* Trim from right to match card */
}

body:not(.focus-mode):not(.video-mode) .controls {
    grid-column: 1 / -1; /* Full width */
    grid-row: 2;
    max-width: calc(100% - 60px); /* Trim from right to match card */
}

body:not(.focus-mode):not(.video-mode) .progress-container {
    grid-column: 2; /* Align with card column */
    grid-row: 3;
}

body:not(.focus-mode):not(.video-mode) .vocab-sidebar {
    grid-column: 1;
    grid-row: 4;
}

body:not(.focus-mode):not(.video-mode) .flashcard-container {
    grid-column: 2;
    grid-row: 4;
    align-self: start; /* Keep card at top regardless of sidebar height */
}

body:not(.focus-mode):not(.video-mode) .navigation {
    grid-column: 2;
    grid-row: 5;
}

body:not(.focus-mode):not(.video-mode) .score-buttons {
    grid-column: 2;
    grid-row: 6;
}

body:not(.focus-mode):not(.video-mode) .motivation {
    grid-column: 2;
    grid-row: 7;
}

/* Sidebar styling - sticky within grid */
.vocab-sidebar {
    position: sticky;
    top: 20px;
    align-self: start;
    width: 100%;
    background: linear-gradient(180deg,
        rgba(255, 255, 255, 0.1) 0%,
        rgba(255, 255, 255, 0.15) 100%);
    backdrop-filter: blur(24px) saturate(120%);
    -webkit-backdrop-filter: blur(24px) saturate(120%);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 20px;
    padding: 24px 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.12),
        0 2px 8px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.sidebar-header {
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.25);
}

.sidebar-title {
    font-family: 'Inter', -apple-system, sans-serif;
    font-size: 0.9em;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.98);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Search in sidebar */
.vocab-sidebar .vocab-search-container {
    position: relative;
    margin-bottom: 16px;
}

.vocab-sidebar .vocab-search-input {
    width: 100%;
    box-sizing: border-box;
    font-size: 0.95em;
    padding: 12px 40px 12px 14px;
}

/* Results always visible in sidebar */
.vocab-sidebar .vocab-search-results {
    position: static;
    max-height: none;
    opacity: 1;
    transform: none;
    pointer-events: auto;
    background: transparent;
    backdrop-filter: none;
    border: none;
    box-shadow: none;
    padding: 0;
}

.vocab-sidebar .vocab-search-results::before,
.vocab-sidebar .vocab-search-results::after {
    display: none;
}

/* Spacious results for better readability */
.vocab-sidebar .vocab-search-result {
    padding: 12px 14px;
    margin-bottom: 8px;
    font-size: 0.9em;
    cursor: pointer;
}

.vocab-sidebar .result-japanese {
    font-size: 1.1em;
    margin-bottom: 5px;
    font-weight: 500;
}

.vocab-sidebar .result-details {
    font-size: 0.85em;
    line-height: 1.4;
}

.vocab-sidebar .result-badge,
.vocab-sidebar .result-category {
    font-size: 0.7em;
    padding: 3px 8px;
    margin-top: 4px;
}

/* Mobile - reset grid properties (flexbox is used via standard-mode.css) */
@media (max-width: 768px) {
    /* Reset container - standard-mode.css uses flexbox on mobile */
    body:not(.focus-mode):not(.video-mode) .container {
        display: flex !important;
        flex-direction: column !important;
        grid-template-columns: unset;
        grid-template-rows: unset;
        gap: 0;
        padding: 0 12px;
    }

    /* Reset all grid positioning - let flexbox handle layout */
    body:not(.focus-mode):not(.video-mode) .flashcard-container {
        grid-column: unset !important;
        grid-row: unset !important;
    }

    body:not(.focus-mode):not(.video-mode) .vocab-sidebar {
        display: none !important; /* Hidden - using vocab-panel drawer instead */
    }

    body:not(.focus-mode):not(.video-mode) .navigation,
    body:not(.focus-mode):not(.video-mode) .score-buttons,
    body:not(.focus-mode):not(.video-mode) .motivation,
    body:not(.focus-mode):not(.video-mode) .top-bar,
    body:not(.focus-mode):not(.video-mode) .controls,
    body:not(.focus-mode):not(.video-mode) .progress-container {
        grid-column: unset !important;
        grid-row: unset !important;
    }
}

/* Focus mode - hide sidebar completely */
body.focus-mode .vocab-sidebar {
    display: none !important;
    pointer-events: none !important;
}

/* Video mode - hide sidebar completely */
body.video-mode .vocab-sidebar {
    display: none !important;
    pointer-events: none !important;
}

/* Scrollbar */
.vocab-sidebar::-webkit-scrollbar {
    width: 6px;
}

.vocab-sidebar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.08);
    border-radius: 3px;
    margin: 8px 0;
}

.vocab-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.4);
    border-radius: 3px;
    transition: background 0.2s ease;
}

.vocab-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.6);
}
