/**
 * @file side-panel.css
 * @description Side panel overlay for word details, BCE pane, search results
 *
 * @requires base.css (CSS variables)
 * @usedBy index.php (#side-panel, #bce-pane, .search-overlay)
 * @usedBy js/components/side-panel.js (showWordDetails)
 *
 * @status COMPLETE
 */

/* ==================== SEARCH OVERLAY ==================== */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--bg-light-1), var(--bg-light-2));
    z-index: 1500;
    display: none;
    flex-direction: column;
    padding-top: 50px;
    overflow: hidden;
}

body.dark-mode .search-overlay {
    background: linear-gradient(135deg, var(--bg-dark-1), var(--bg-dark-2));
}

.search-overlay.active {
    display: flex;
}

.search-results-header {
    padding: 12px 15px;
    text-align: center;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    flex-shrink: 0;
}

.search-results-title {
    font-size: 1rem;
    font-weight: 400;
}

.search-results-count {
    font-size: 0.8rem;
    opacity: 0.5;
    margin-top: 3px;
}

.search-results-filters {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.search-filter-btn {
    padding: 6px 14px;
    border: 1px solid rgba(67, 97, 238, 0.3);
    border-radius: 16px;
    background: transparent;
    color: var(--primary);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-filter-btn:hover {
    background: rgba(67, 97, 238, 0.1);
}

.search-filter-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

body.dark-mode .search-filter-btn {
    border-color: rgba(76, 201, 240, 0.3);
    color: var(--primary-light);
}

body.dark-mode .search-filter-btn.active {
    background: var(--primary-light);
    border-color: var(--primary-light);
}

.search-results-grid {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 15px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    align-content: start;
    min-height: 0;
}

.search-back-btn {
    margin: 10px auto;
    padding: 8px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    flex-shrink: 0;
}

/* ==================== SIDE PANEL (Desktop) ==================== */
.side-panel {
    position: fixed;
    top: 0;
    right: -350px;
    width: 350px;
    height: 100%;
    background: var(--card-light);
    box-shadow: -4px 0 25px rgba(0,0,0,0.1);
    z-index: 2600;
    transition: right 0.3s var(--ease-smooth);
    overflow-y: auto;
    padding: 20px;
}

body.dark-mode .side-panel {
    background: var(--card-dark);
}

.side-panel.active {
    right: 0;
}

.panel-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(0,0,0,0.05);
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
    color: inherit;
}

.panel-word-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-top: 30px;
    margin-bottom: 6px;
}

.panel-word {
    font-size: 1.6rem;
    font-weight: 300;
    flex: 1;
}

.panel-surprise-box {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: rgba(67, 97, 238, 0.1);
    border-radius: 16px;
    font-size: 0.7rem;
    color: var(--primary);
}

.panel-surprise-refresh {
    width: 16px;
    height: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    background: rgba(67, 97, 238, 0.15);
}

.panel-surprise-refresh:hover {
    background: var(--primary);
    color: white;
    transform: rotate(180deg);
}

.panel-surprise-refresh svg {
    width: 12px;
    height: 12px;
}

.panel-phonetic {
    font-size: 0.9rem;
    opacity: 0.5;
    font-style: italic;
    margin-bottom: 20px;
}

.panel-section {
    margin-bottom: 18px;
}

.panel-section-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.5;
    margin-bottom: 6px;
}

.panel-section-content {
    font-size: 0.9rem;
    line-height: 1.5;
}

.panel-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.panel-tag {
    padding: 4px 10px;
    background: rgba(67, 97, 238, 0.1);
    border-radius: 12px;
    font-size: 0.75rem;
}

.panel-tag.clickable-tag {
    cursor: pointer;
    transition: all 0.2s ease;
}

.panel-tag.clickable-tag:hover {
    background: var(--primary);
    color: white;
}

/* ==================== BCE PANE ==================== */
.bce-pane {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100%;
    background: var(--card-light);
    box-shadow: -4px 0 25px rgba(0,0,0,0.1);
    z-index: 2400;
    transition: right 0.3s var(--ease-smooth);
    overflow-y: auto;
    padding: 20px;
}

body.dark-mode .bce-pane {
    background: var(--card-dark);
}

.bce-pane.active {
    right: 0;
}

.bce-pane-header {
    margin-bottom: 20px;
}

.bce-pane-title {
    font-size: 1.6rem;
    font-weight: 300;
    margin-bottom: 6px;
}

.bce-pane-byline {
    font-size: 0.9rem;
    opacity: 0.7;
    margin-bottom: 20px;
}

.bce-pane-section {
    margin-bottom: 16px;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 8px;
    overflow: hidden;
}

body.dark-mode .bce-pane-section {
    border-color: rgba(255,255,255,0.1);
}

.bce-pane-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(0,0,0,0.02);
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
}

body.dark-mode .bce-pane-section-header {
    background: rgba(255,255,255,0.02);
}

.bce-pane-section-header:hover {
    background: rgba(0,0,0,0.05);
}

body.dark-mode .bce-pane-section-header:hover {
    background: rgba(255,255,255,0.05);
}

.bce-pane-section-title {
    font-weight: 600;
    font-size: 0.9rem;
}

.bce-pane-section-toggle {
    font-size: 0.8rem;
    opacity: 0.6;
    transition: transform 0.2s ease;
}

.bce-pane-section.expanded .bce-pane-section-toggle {
    transform: rotate(180deg);
}

.bce-pane-section-content {
    display: none;
    padding: 16px;
}

.bce-pane-section.expanded .bce-pane-section-content {
    display: block;
}

.bce-pane-input-group {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    align-items: stretch;
}

.bce-pane-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid rgba(0,0,0,0.1);
    border-radius: 8px;
    font-size: 0.9rem;
    background: var(--card-light);
    color: inherit;
    transition: all 0.2s ease;
    min-width: 0;
}

body.dark-mode .bce-pane-input {
    background: var(--card-dark);
    border-color: rgba(255,255,255,0.1);
}

.bce-pane-input:focus {
    outline: none;
    border-color: var(--primary);
}

.bce-pane-button {
    padding: 12px 24px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.bce-pane-button:hover {
    background: var(--primary-light);
}

.bce-pane-results {
    max-height: 200px;
    overflow-y: auto;
    padding: 8px;
    background: rgba(0,0,0,0.02);
    border-radius: 8px;
}

body.dark-mode .bce-pane-results {
    background: rgba(255,255,255,0.02);
}

/* ==================== PANEL MEMORY AIDS (Inline Tabs) ==================== */
.panel-memory-section {
    border-top: 1px solid rgba(0,0,0,0.08);
    padding-top: 16px;
    margin-top: 8px;
}

body.dark-mode .panel-memory-section {
    border-top-color: rgba(255,255,255,0.08);
}

.panel-memory-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
}

.panel-memory-tab {
    flex: 1;
    padding: 8px 6px;
    border: none;
    background: rgba(0,0,0,0.04);
    color: inherit;
    font-size: 0.7rem;
    border-radius: 8px;
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.2s ease;
}

.panel-memory-tab:hover {
    opacity: 0.8;
    background: rgba(0,0,0,0.08);
}

.panel-memory-tab.active {
    opacity: 1;
    background: var(--primary);
    color: white;
}

body.dark-mode .panel-memory-tab {
    background: rgba(255,255,255,0.08);
}

body.dark-mode .panel-memory-tab:hover {
    background: rgba(255,255,255,0.12);
}

body.dark-mode .panel-memory-tab.active {
    background: var(--primary-light);
    color: #1a1a2e;
}

.panel-memory-content {
    min-height: 80px;
}

.panel-memory-panel {
    display: none;
}

.panel-memory-panel.active {
    display: block;
    animation: fadeInUp 0.25s ease;
}

/* Inline Hook styles */
.inline-hook-phrase {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 10px;
    line-height: 1.4;
}

body.dark-mode .inline-hook-phrase {
    color: var(--primary-light);
}

.inline-hook-breakdown {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.inline-hook-letter {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    padding: 4px 8px;
    background: rgba(67, 97, 238, 0.06);
    border-radius: 6px;
}

body.dark-mode .inline-hook-letter {
    background: rgba(76, 201, 240, 0.1);
}

.inline-hook-char {
    font-weight: 700;
    color: var(--primary);
    width: 16px;
}

body.dark-mode .inline-hook-char {
    color: var(--primary-light);
}

/* Inline Links styles */
.inline-links-section {
    margin-bottom: 10px;
}

.inline-links-title {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.5;
    margin-bottom: 6px;
}

.inline-links-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.inline-link-chip {
    padding: 3px 8px;
    background: rgba(67, 97, 238, 0.08);
    border-radius: 10px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.inline-link-chip:hover {
    background: var(--primary);
    color: white;
}

/* Inline Roots styles */
.inline-roots-card {
    padding: 10px;
    background: rgba(67, 97, 238, 0.05);
    border-radius: 8px;
    margin-bottom: 8px;
}

body.dark-mode .inline-roots-card {
    background: rgba(76, 201, 240, 0.08);
}

.inline-roots-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.inline-roots-type {
    font-size: 0.6rem;
    text-transform: uppercase;
    padding: 2px 6px;
    background: var(--primary);
    color: white;
    border-radius: 4px;
}

.inline-roots-affix {
    font-weight: 600;
    font-size: 0.9rem;
}

.inline-roots-meaning {
    font-size: 0.8rem;
    opacity: 0.8;
    font-style: italic;
    margin-bottom: 6px;
}

.inline-roots-examples {
    font-size: 0.7rem;
    opacity: 0.6;
}

.inline-roots-examples span {
    display: inline-block;
    margin-right: 6px;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
