/* صفحهٔ عمومی دیکشنری — تم از app/kids/velvet می‌آید */

.dict-page {
    min-height: 100dvh;
}

.dict-shell {
    position: relative;
    z-index: 1;
    width: min(720px, calc(100% - 28px));
    max-width: 100%;
    margin: 0 auto;
    padding: 28px 0 calc(40px + var(--safe-bottom));
    overflow-x: clip;
}

.dict-top {
    margin-bottom: 22px;
}

.dict-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px 16px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.dict-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.dict-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    height: 38px;
    padding: 0 14px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: transparent;
    color: var(--text);
    font: inherit;
    font-weight: 700;
    font-size: 0.82rem;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.dict-back:hover {
    border-color: rgba(232, 165, 75, 0.55);
    background: rgba(232, 165, 75, 0.1);
    color: var(--heading-strong, var(--text));
}

.dict-logo {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    object-fit: cover;
    border: 1px solid var(--line);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
}

.dict-brand-name {
    margin: 0 0 2px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--saffron);
}

.dict-title {
    margin: 0;
    font-size: clamp(1.35rem, 3.4vw, 1.75rem);
    font-weight: 800;
    line-height: 1.35;
    color: var(--heading-strong);
    background: var(--brand-grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.dict-lead {
    margin: 0;
    max-width: 38rem;
    font-size: 0.92rem;
    line-height: 1.75;
    color: var(--muted);
}

.dict-toolbar {
    display: grid;
    gap: 14px;
    margin-bottom: 16px;
    padding: 16px 16px 14px;
    border-radius: calc(var(--radius) - 2px);
    border: 1px solid var(--line);
    background: var(--card-face);
    box-shadow: var(--shadow);
}

.dict-search {
    display: grid;
    gap: 7px;
}

.dict-search-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--muted);
}

.dict-search-input {
    width: 100%;
    height: 46px;
    padding: 0 14px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--surface-inset);
    color: var(--text);
    font: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.dict-search-input::placeholder {
    color: rgba(185, 168, 148, 0.55);
}

.dict-search-input:focus {
    border-color: rgba(232, 165, 75, 0.55);
    box-shadow: 0 0 0 3px rgba(232, 165, 75, 0.14);
}

.dict-toolbar-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
}

.dict-meta {
    min-height: 1.2em;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--muted);
    flex: 1 1 auto;
    align-self: center;
}

.dict-sort {
    display: grid;
    gap: 7px;
    min-width: min(100%, 220px);
}

.dict-sort-select {
    height: 42px;
    padding: 0 12px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--surface-inset);
    color: var(--text);
    font: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.dict-sort-select:focus {
    border-color: rgba(232, 165, 75, 0.55);
    box-shadow: 0 0 0 3px rgba(232, 165, 75, 0.14);
}

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

.dict-letter {
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--surface-faint);
    color: var(--text);
    font: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
}

.dict-letter:hover {
    border-color: rgba(232, 165, 75, 0.45);
    transform: translateY(-1px);
}

.dict-letter.is-active {
    border-color: rgba(232, 165, 75, 0.7);
    background: linear-gradient(180deg, rgba(232, 165, 75, 0.28), rgba(232, 165, 75, 0.1));
    color: #fff3df;
}

.dict-letter.is-all {
    min-width: auto;
    padding: 0 12px;
}

.dict-panel {
    position: relative;
    border-radius: calc(var(--radius) - 2px);
    border: 1px solid var(--line);
    background: var(--card-face);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.dict-table-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 7.5rem 4.2rem;
    gap: 10px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--line);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--muted);
    background: var(--surface-faint);
}

.dict-sort-col {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin: 0;
    padding: 6px 6px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: inherit;
    font-weight: inherit;
    letter-spacing: inherit;
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease;
}

.dict-sort-col:first-child {
    justify-content: flex-start;
}

.dict-sort-col:hover {
    color: var(--text);
    background: rgba(232, 165, 75, 0.08);
}

.dict-sort-col.is-active {
    color: var(--saffron);
}

.dict-sort-mark {
    display: inline-block;
    min-width: 0.7em;
    font-size: 0.85em;
    line-height: 1;
    opacity: 0.9;
}

.dict-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.dict-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 7.5rem 4.2rem;
    gap: 10px;
    align-items: center;
    padding: 13px 16px;
    border-bottom: 1px solid rgba(255, 232, 200, 0.06);
    animation: dict-row-in 0.28s ease both;
}

.dict-row:nth-child(even) {
    background: rgba(255, 255, 255, 0.015);
}

.dict-row:last-child {
    border-bottom: 0;
}

.dict-word {
    font-size: 1.02rem;
    font-weight: 700;
    color: var(--heading-strong, var(--text));
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dict-usage {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--mint);
    text-align: center;
}

.dict-usage.is-zero {
    color: var(--muted);
    font-weight: 500;
}

.dict-letters-count {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--muted);
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.dict-empty,
.dict-loading {
    margin: 0;
    padding: 36px 18px;
    text-align: center;
    color: var(--muted);
    font-size: 0.92rem;
}

.dict-empty.is-hidden,
.dict-loading.is-hidden,
.dict-table-head.is-hidden,
.dict-list.is-hidden,
.dict-pager.is-hidden {
    display: none;
}

.dict-pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 16px;
    border-top: 1px solid var(--line);
    background: var(--surface-faint);
}

.dict-pager-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--muted);
}

.dict-pager-actions {
    display: flex;
    gap: 8px;
}

.dict-page-btn {
    height: 38px;
    padding: 0 14px;
    border-radius: 11px;
    border: 1px solid var(--line);
    background: var(--surface-inset-soft);
    color: var(--text);
    font: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: border-color 0.15s ease, transform 0.12s ease, opacity 0.15s ease;
}

.dict-page-btn:hover:not(:disabled) {
    border-color: rgba(232, 165, 75, 0.5);
    transform: translateY(-1px);
}

.dict-page-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

@keyframes dict-row-in {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 520px) {
    .dict-shell {
        width: min(100%, calc(100% - 18px));
        padding-top: 18px;
    }

    .dict-table-head,
    .dict-row {
        grid-template-columns: minmax(0, 1fr) 5.8rem 3.2rem;
        gap: 6px;
        padding-inline: 12px;
    }

    .dict-word {
        font-size: 0.95rem;
    }

    .dict-usage {
        font-size: 0.72rem;
    }
}

/* تم شاد */
html[data-theme="kids"] .dict-search-input:focus,
html[data-theme="kids"] .dict-sort-select:focus {
    border-color: rgba(255, 107, 157, 0.55);
    box-shadow: 0 0 0 3px rgba(255, 107, 157, 0.16);
}

html[data-theme="kids"] .dict-sort-col.is-active {
    color: #c0267a;
}

html[data-theme="kids"] .dict-letter.is-active {
    border-color: rgba(255, 107, 157, 0.7);
    background: linear-gradient(180deg, rgba(255, 107, 157, 0.32), rgba(255, 193, 7, 0.14));
}

html[data-theme="kids"] .dict-usage {
    color: #2bb673;
}

html[data-theme="kids"] .dict-back:hover {
    border-color: rgba(255, 107, 157, 0.55);
    background: rgba(255, 107, 157, 0.12);
}

/* تم وسوسه */
html[data-theme="velvet"] .dict-search-input:focus,
html[data-theme="velvet"] .dict-sort-select:focus {
    border-color: rgba(232, 120, 160, 0.55);
    box-shadow: 0 0 0 3px rgba(232, 120, 160, 0.16);
}

html[data-theme="velvet"] .dict-sort-col.is-active {
    color: #ff7ab0;
}

html[data-theme="velvet"] .dict-letter.is-active {
    border-color: rgba(232, 120, 160, 0.65);
    background: linear-gradient(180deg, rgba(232, 120, 160, 0.28), rgba(120, 40, 70, 0.2));
}

html[data-theme="velvet"] .dict-usage {
    color: #f0a0c0;
}

html[data-theme="velvet"] .dict-back:hover {
    border-color: rgba(232, 120, 160, 0.55);
    background: rgba(232, 120, 160, 0.12);
}
