/* Dictionary View Specific Styles */

.dictionary-view {
    position: relative;
    /* Compensation for main-content padding to allow full-width headers */
    --content-offset: calc(var(--spacing-md) * -1);
}

/* 
 * Sticky Header with Glassmorphism
 * Using negative margins to stretch full width over the parent #main-content padding
 */
.dict-header {
    position: sticky;
    top: var(--header-height);
    margin-left: var(--content-offset);
    margin-right: var(--content-offset);
    padding: 1rem var(--spacing-md);
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    z-index: 50;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

/* Dark mode support for header */
@media (prefers-color-scheme: dark) {
    .dict-header {
        background-color: rgba(30, 41, 59, 0.95);
    }
}

.dark .dict-header {
    background-color: rgba(30, 41, 59, 0.95) !important;
    border-bottom: 1px solid var(--border-color);
}


/* .dict-title replaced by .view-title in main.css */

/* Modern Search Container */
.dict-search-container {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
}

.dict-search-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 3rem;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    background-color: var(--background-color);
    color: var(--text-primary);
    transition: all 0.2s ease;
    box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.05);
}

.dict-search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: var(--surface-color);
    box-shadow: 0 0 0 3px var(--primary-light), inset 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.dict-search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
    width: 1.25rem;
    height: 1.25rem;
    transition: color 0.2s;
}

.dict-search-input:focus~.dict-search-icon {
    color: var(--primary-color);
}

/* Clear button inside search */
/* Clear button inside search */
#dict-search-clear {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    cursor: pointer;
    background-color: transparent;
    border: none;
    padding: 0;
    display: none;
    /* JS will toggle this */
    width: 1.25rem;
    height: 1.25rem;
}

#dict-search-clear:hover {
    color: var(--primary-color);
    background-color: transparent;
}

/* Content Area */
.dict-content {
    padding-top: 1.5rem;
    min-height: 60vh;
    max-width: 800px;
    margin: 0 auto;
}

/* Alphabetical Grouping */
.dict-group {
    margin-bottom: 2rem;
    animation: fadeIn 0.4s ease-out forwards;
}

.dict-group-header {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
    position: sticky;
    top: calc(var(--header-height) + 100px);
    /* Sticks below the main header */
    z-index: 40;
    pointer-events: none;
    /* Let clicks pass through */
}

.dict-group-letter {
    font-size: 0.875rem;
    font-weight: 800;
    color: var(--primary-color);
    background-color: var(--primary-light);
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    margin-right: 0.75rem;
    box-shadow: var(--shadow-sm);
}

.dict-group-line {
    flex: 1;
    height: 1px;
    background-color: var(--border-color);
}

/* Term Cards */
.dict-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 768px) {
    .dict-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
}

.dict-card {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.dict-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

.dict-term {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.dict-def {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Empty State */
.dict-empty {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--text-secondary);
}

.dict-empty svg {
    width: 3rem;
    height: 3rem;
    margin-bottom: 1rem;
    color: var(--border-color);
}

/* Loading State */
.dict-loading {
    display: flex;
    justify-content: center;
    padding: 3rem 0;
}

/* Note: fadeIn keyframes are in animations.css */

/* Scrollbar refinement for the list */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

/* Dark mode refinements */
@media (prefers-color-scheme: dark) {
    .dict-group-letter {
        background-color: rgba(13, 148, 136, 0.2);
    }

    .dict-search-input {
        background-color: rgba(30, 41, 59, 0.5);
    }

    .dict-search-input:focus {
        background-color: rgba(30, 41, 59, 1);
    }
}

.dark .dict-group-letter {
    background-color: rgba(13, 148, 136, 0.2);
}

.dark .dict-search-input {
    background-color: rgba(30, 41, 59, 0.5);
}

.dark .dict-search-input:focus {
    background-color: rgba(30, 41, 59, 1);
}