/* ===============================================
   DICTIONARY MODULE - iGeouz StudyHub
   A searchable geography encyclopedia
   =============================================== */

/* ─── Hero Search Section ─── */
.dict-hero {
    position: relative;
    padding: 48px 40px 40px;
    border-radius: 24px;
    background: linear-gradient(135deg, #059669 0%, #10B981 40%, #34D399 100%);
    margin-bottom: 32px;
    box-shadow: 0 8px 40px rgba(5, 150, 105, 0.25);
}

.dict-hero__bg {
    position: absolute;
    inset: 0;
    border-radius: 24px;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.dict-hero__bg::before {
    content: '';
    position: absolute;
    top: -60%;
    right: -8%;
    width: 380px;
    height: 380px;
    background: rgba(255, 255, 255, 0.07);
    border-radius: 50%;
}

.dict-hero__bg::after {
    content: '';
    position: absolute;
    bottom: -50%;
    left: 8%;
    width: 260px;
    height: 260px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
}

.dict-hero__title {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 6px;
    position: relative;
    z-index: 1;
}

.dict-hero__subtitle {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.85);
    margin: 0 0 28px;
    position: relative;
    z-index: 1;
}

.dict-hero__stats {
    display: flex;
    gap: 24px;
    margin-bottom: 28px;
    position: relative;
    z-index: 1;
}

.dict-hero__stat {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
}

.dict-hero__stat i {
    font-size: 1.1rem;
    opacity: 0.9;
}

.dict-hero__stat-num {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.05rem;
}

/* ─── Search Bar ─── */
.dict-search {
    position: relative;
    z-index: 10;
}

.dict-search__wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.dict-search__icon {
    position: absolute;
    left: 20px;
    font-size: 1.3rem;
    color: rgba(255, 255, 255, 0.5);
    z-index: 2;
    pointer-events: none;
    transition: color 0.2s;
}

.dict-search__input {
    width: 100%;
    padding: 18px 60px 18px 54px;
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    font-family: var(--font-body);
    font-size: 1.05rem;
    font-weight: 500;
    color: #fff;
    outline: none;
    transition: all 0.3s ease;
}

.dict-search__input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.dict-search__input:focus {
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.18);
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.1);
}

.dict-search__input:focus ~ .dict-search__icon {
    color: #fff;
}

.dict-search__clear {
    position: absolute;
    right: 16px;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    font-size: 1rem;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 2;
}

.dict-search__clear:hover {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

.dict-search__clear.visible {
    display: flex;
}

/* ─── Suggestions Dropdown ─── */
.dict-suggestions {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    max-height: 320px;
    overflow-y: auto;
    display: none;
    z-index: 100;
    padding: 6px;
}

.dict-suggestions.active {
    display: block;
    animation: dictSlideDown 0.2s ease;
}

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

.dict-suggestion {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s;
}

.dict-suggestion:hover,
.dict-suggestion.active {
    background: rgba(16, 185, 129, 0.08);
}

.dict-suggestion__icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(16, 185, 129, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--accent-purple);
    font-family: var(--font-heading);
    flex-shrink: 0;
}

.dict-suggestion__info {
    flex: 1;
    min-width: 0;
}

.dict-suggestion__term {
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.dict-suggestion__term mark {
    background: rgba(16, 185, 129, 0.2);
    color: var(--accent-purple);
    padding: 0 2px;
    border-radius: 3px;
    font-weight: 800;
}

.dict-suggestion__preview {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dict-suggestion__cat {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 3px 10px;
    border-radius: 20px;
    flex-shrink: 0;
}

/* Category colors */
.dict-cat--physical { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.dict-cat--human { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }
.dict-cat--economic { background: rgba(139, 92, 246, 0.1); color: #8b5cf6; }
.dict-cat--environmental { background: rgba(16, 185, 129, 0.1); color: #10b981; }
.dict-cat--general { background: rgba(100, 116, 139, 0.1); color: #64748b; }

/* ─── Filter Bar ─── */
.dict-filters {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.dict-filter-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.dict-filter-label i {
    font-size: 1rem;
}

.dict-filter-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.dict-filter-pill {
    padding: 7px 16px;
    border-radius: 20px;
    border: 1px solid var(--border-glass);
    background: var(--bg-surface);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-body);
}

.dict-filter-pill:hover {
    border-color: var(--accent-purple);
    color: var(--accent-purple);
}

.dict-filter-pill.active {
    background: var(--accent-purple);
    border-color: var(--accent-purple);
    color: #fff;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.dict-filter-count {
    margin-left: auto;
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* ─── Alphabet Nav ─── */
.dict-alphabet {
    display: flex;
    gap: 4px;
    margin-bottom: 28px;
    flex-wrap: wrap;
    padding: 10px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
}

.dict-alpha-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    background: none;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dict-alpha-btn:hover {
    background: rgba(16, 185, 129, 0.08);
    color: var(--accent-purple);
}

.dict-alpha-btn.active {
    background: var(--accent-purple);
    color: #fff;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.dict-alpha-btn.disabled {
    opacity: 0.3;
    cursor: default;
    pointer-events: none;
}

/* ─── Results Grid ─── */
.dict-results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 18px;
    margin-bottom: 40px;
}

/* ─── Entry Card ─── */
.dict-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    border-radius: 18px;
    padding: 22px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.dict-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    opacity: 0;
    transition: opacity 0.25s;
}

.dict-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
    border-color: transparent;
}

[data-theme="dark"] .dict-card:hover {
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
}

.dict-card:hover::before {
    opacity: 1;
}

/* Card accent colors by category */
.dict-card[data-cat="physical"]::before { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.dict-card[data-cat="human"]::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.dict-card[data-cat="economic"]::before { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }
.dict-card[data-cat="environmental"]::before { background: linear-gradient(90deg, #10b981, #34d399); }
.dict-card[data-cat="general"]::before { background: linear-gradient(90deg, #64748b, #94a3b8); }

.dict-card__header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 12px;
}

.dict-card__letter {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.dict-card[data-cat="physical"] .dict-card__letter { background: rgba(59,130,246,0.1); color: #3b82f6; }
.dict-card[data-cat="human"] .dict-card__letter { background: rgba(245,158,11,0.1); color: #f59e0b; }
.dict-card[data-cat="economic"] .dict-card__letter { background: rgba(139,92,246,0.1); color: #8b5cf6; }
.dict-card[data-cat="environmental"] .dict-card__letter { background: rgba(16,185,129,0.1); color: #10b981; }
.dict-card[data-cat="general"] .dict-card__letter { background: rgba(100,116,139,0.1); color: #64748b; }

.dict-card__title-area {
    flex: 1;
    min-width: 0;
}

.dict-card__term {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.3;
}

.dict-card__category {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 8px;
    border-radius: 6px;
    display: inline-block;
}

.dict-card__definition {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.dict-card__thumb {
    margin-top: 12px;
    height: 100px;
    border-radius: 10px;
    overflow: hidden;
    background: var(--bg-dark);
}

.dict-card__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dict-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border-glass);
}

.dict-card__keywords {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    flex: 1;
}

.dict-card__keyword {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 6px;
    background: var(--bg-dark);
    color: var(--text-muted);
}

.dict-card__arrow {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: rgba(16, 185, 129, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-purple);
    font-size: 0.85rem;
    flex-shrink: 0;
    opacity: 0;
    transform: translateX(-6px);
    transition: all 0.25s;
}

.dict-card:hover .dict-card__arrow {
    opacity: 1;
    transform: translateX(0);
}

/* ─── Detail Modal ─── */
.dict-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    transition: opacity 0.3s;
}

.dict-modal-overlay.active {
    display: flex;
    opacity: 1;
}

.dict-modal {
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    border-radius: 24px;
    max-width: 720px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.2);
    animation: dictModalIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    scrollbar-width: thin;
    scrollbar-color: var(--border-glass) transparent;
}

@keyframes dictModalIn {
    from { opacity: 0; transform: translateY(24px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.dict-modal__header {
    position: sticky;
    top: 0;
    padding: 24px 28px 20px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    align-items: flex-start;
    gap: 16px;
    z-index: 5;
}

.dict-modal__letter {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.dict-modal__title-area {
    flex: 1;
}

.dict-modal__term {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 6px;
    line-height: 1.2;
}

.dict-modal__meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.dict-modal__badge {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 3px 10px;
    border-radius: 8px;
}

.dict-modal__source {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.dict-modal__close {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid var(--border-glass);
    background: var(--bg-dark);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.dict-modal__close:hover {
    border-color: #ef4444;
    color: #ef4444;
    background: rgba(239, 68, 68, 0.08);
}

.dict-modal__body {
    padding: 24px 28px;
}

.dict-modal__section {
    margin-bottom: 24px;
}

.dict-modal__section-title {
    font-family: var(--font-heading);
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dict-modal__section-title i {
    font-size: 1rem;
    color: var(--accent-purple);
}

.dict-modal__definition {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text-secondary);
}

/* Images in modal */
.dict-modal__images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.dict-modal__img-card {
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-dark);
    border: 1px solid var(--border-glass);
    aspect-ratio: 4 / 3;
    cursor: pointer;
    transition: all 0.2s;
}

.dict-modal__img-card:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.dict-modal__img-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Related terms */
.dict-modal__related {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.dict-modal__related-link {
    padding: 8px 16px;
    border-radius: 12px;
    border: 1px solid var(--border-glass);
    background: var(--bg-dark);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.dict-modal__related-link:hover {
    border-color: var(--accent-purple);
    color: var(--accent-purple);
    background: rgba(16, 185, 129, 0.06);
}

/* Keywords */
.dict-modal__keywords {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.dict-modal__kw {
    padding: 5px 12px;
    border-radius: 8px;
    background: var(--bg-dark);
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
}

/* ─── Empty State ─── */
.dict-empty {
    text-align: center;
    padding: 60px 24px;
}

.dict-empty__icon {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 2rem;
    color: var(--text-muted);
}

.dict-empty__title {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.dict-empty__text {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0;
}

/* ─── Letter Section Header ─── */
.dict-letter-section {
    margin-bottom: 8px;
}

.dict-letter-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    margin-top: 8px;
}

.dict-letter-badge {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.1rem;
    color: #fff;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.dict-letter-count {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* ─── Loading Skeleton ─── */
.dict-skeleton {
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    border-radius: 18px;
    padding: 22px;
    animation: dictPulse 1.5s ease-in-out infinite;
}

@keyframes dictPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.dict-skeleton__bar {
    background: var(--border-glass);
    border-radius: 8px;
    margin-bottom: 10px;
}

.dict-skeleton__bar--title {
    width: 60%;
    height: 16px;
}

.dict-skeleton__bar--text {
    width: 100%;
    height: 12px;
}

.dict-skeleton__bar--short {
    width: 40%;
    height: 12px;
}

/* ─── Responsive ─── */
@media (max-width: 900px) {
    .dict-results {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
    
    .dict-hero {
        padding: 36px 24px 32px;
    }
    
    .dict-hero__title {
        font-size: 1.5rem;
    }
    
    .dict-hero__stats {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .dict-alphabet {
        gap: 2px;
        padding: 8px 10px;
    }
    
    .dict-alpha-btn {
        width: 30px;
        height: 30px;
        font-size: 0.75rem;
    }
}

@media (max-width: 640px) {
    .dict-results {
        grid-template-columns: 1fr;
    }
    
    .dict-modal {
        border-radius: 20px 20px 0 0;
        max-height: 90vh;
    }
    
    .dict-modal-overlay {
        align-items: flex-end;
        padding: 0;
    }
    
    .dict-hero__stats {
        display: none;
    }
    
    .dict-filters {
        gap: 8px;
    }
    
    .dict-filter-pills {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 4px;
    }
}

/* ─── Image Lightbox ─── */
.dict-lightbox-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
    overflow: hidden;
}

.dict-lightbox-overlay.active {
    display: flex;
    opacity: 1;
}

.dict-lightbox__container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
}

.dict-lightbox__container:active {
    cursor: grabbing;
}

.dict-lightbox__img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    transition: transform 0.1s;
    user-select: none;
    -webkit-user-drag: none;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
    border-radius: 12px;
}

.dict-lightbox__close {
    position: absolute;
    top: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    cursor: pointer;
    z-index: 2001;
    transition: background 0.2s;
}

.dict-lightbox__close:hover {
    background: rgba(255, 255, 255, 0.25);
}

.dict-lightbox__controls {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    background: rgba(20, 20, 20, 0.7);
    padding: 8px;
    border-radius: 20px;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 2001;
}

.dict-lightbox__btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: transparent;
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: background 0.2s;
}

.dict-lightbox__btn:hover {
    background: rgba(255, 255, 255, 0.15);
}
