/* ===== Dictionary Page Styles ===== */
:root {
    --dict-card-bg: #1a2235;
    --dict-input-bg: #0f1629;
    --dict-border: #2d3a50;
    --dict-accent-glow: rgba(0,212,255,0.15);
}

.dict-wrapper {
    max-width: 900px;
    margin: 0 auto;
    padding: 3rem 1rem 5rem;
}

.dict-hero {
    text-align: center;
    margin-bottom: 2.5rem;
}

.dict-hero h1 {
    font-size: 2.4rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-mid));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.dict-hero p {
    color: var(--text-secondary);
    font-size: 1.05rem;
}

/* Search Card */
.dict-card {
    background: var(--dict-card-bg);
    border: 1px solid var(--dict-border);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 8px 40px rgba(0,0,0,0.3);
    position: relative;
    overflow: hidden;
}

.dict-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--gradient-start), var(--gradient-mid));
}

/* Language Direction Toggle */
.direction-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 0.8rem;
    background: rgba(255,255,255,0.03);
    border-radius: 12px;
}

.direction-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 4px 12px;
    border-radius: 8px;
    transition: all 0.25s;
    cursor: default;
}

.direction-label.active {
    color: var(--accent);
    background: var(--dict-accent-glow);
}

.direction-arrow {
    color: var(--text-muted);
    font-size: 1.2rem;
    user-select: none;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--dict-input-bg);
    border: 1px solid var(--dict-border);
    border-radius: 28px;
    transition: all 0.3s;
}

.toggle-slider::before {
    content: '⇄';
    position: absolute;
    left: 3px;
    bottom: 2px;
    width: 22px;
    height: 22px;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-mid));
    border-radius: 50%;
    transition: transform 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: #fff;
    font-weight: bold;
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(24px);
}

/* Search Input Group */
.search-group {
    display: flex;
    gap: 0.8rem;
    margin-bottom: 1.2rem;
}

.search-input {
    flex: 1;
    padding: 14px 18px;
    background: var(--dict-input-bg);
    border: 1px solid var(--dict-border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1.1rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--dict-accent-glow);
}

.search-input::placeholder {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.search-btn {
    padding: 14px 28px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-mid));
    color: #fff;
    transition: all 0.2s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.search-btn:hover {
    box-shadow: 0 4px 15px rgba(0,212,255,0.3);
    transform: scale(1.02);
}

.search-btn:active {
    transform: scale(0.98);
}

/* Recent Searches */
.recent-searches {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
    align-items: center;
}

.recent-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
}

.recent-tag {
    padding: 3px 12px;
    border-radius: 20px;
    border: 1px solid var(--dict-border);
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    background: transparent;
}

.recent-tag:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--dict-accent-glow);
}

/* Status / Loading */
.dict-status {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.dict-status .spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--dict-border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.dict-status .status-icon {
    font-size: 2rem;
    margin-bottom: 0.3rem;
}

.dict-status .status-text {
    color: var(--text-secondary);
}

/* Error State */
.dict-error {
    display: none;
    padding: 1rem 1.2rem;
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.3);
    border-radius: 10px;
    color: #fca5a5;
    font-size: 0.9rem;
    margin-bottom: 1.2rem;
    line-height: 1.5;
}

.dict-error.show {
    display: block;
}

/* Results Area */
.dict-results {
    display: none;
    animation: fadeInUp 0.4s ease;
}

.dict-results.show {
    display: block;
}

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

/* Word Header */
.word-header {
    padding: 1.2rem 1.5rem;
    background: rgba(255,255,255,0.03);
    border-radius: 14px;
    margin-bottom: 1rem;
    border: 1px solid var(--dict-border);
    position: relative;
}

.word-word {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.3rem;
}

.word-phonetic {
    font-size: 1rem;
    color: var(--text-muted);
    font-family: 'Consolas', 'Courier New', monospace;
    margin-bottom: 0.5rem;
}

.word-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.word-badge {
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(124,58,237,0.15);
    color: #c084fc;
}

.word-badge.source {
    background: rgba(0,212,255,0.1);
    color: var(--accent);
}

/* Definition Items */
.def-section {
    margin-top: 0.5rem;
}

.def-section-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.8rem;
    padding-left: 0.2rem;
}

.def-item {
    padding: 1rem 1.2rem;
    border: 1px solid var(--dict-border);
    border-radius: 12px;
    margin-bottom: 0.7rem;
    transition: border-color 0.2s;
}

.def-item:hover {
    border-color: var(--accent);
}

.def-type {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    background: rgba(0,212,255,0.1);
    color: var(--accent);
    margin-bottom: 0.4rem;
    text-transform: lowercase;
}

.def-meaning-en {
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
    line-height: 1.4;
}

.def-meaning-zh {
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 0.3rem;
    line-height: 1.4;
}

.def-pinyin {
    font-size: 0.85rem;
    color: var(--accent2);
    font-style: italic;
    margin-bottom: 0.4rem;
}

.def-example {
    padding: 0.6rem 0.8rem;
    margin-top: 0.4rem;
    background: rgba(255,255,255,0.03);
    border-left: 3px solid var(--accent2);
    border-radius: 0 8px 8px 0;
    font-size: 0.88rem;
    line-height: 1.5;
}

.def-example .ex-en {
    color: var(--text-secondary);
    margin-bottom: 0.15rem;
}

.def-example .ex-zh {
    color: var(--text-muted);
    font-size: 0.84rem;
}

/* No Results */
.no-results {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--text-muted);
}

.no-results .no-results-icon {
    font-size: 3rem;
    margin-bottom: 0.8rem;
}

.no-results p {
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Dict Source Badge */
.dict-source-badge {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.dict-source-badge span {
    padding: 2px 10px;
    border-radius: 20px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--dict-border);
}

/* SEO Section */
.dict-seo {
    margin-top: 4rem;
}

.dict-seo h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.dict-seo h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 1.5rem 0 0.6rem;
    color: var(--text-secondary);
}

.dict-seo p {
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: 0.8rem;
    font-size: 0.92rem;
}

.dict-seo ul {
    list-style: disc;
    padding-left: 1.5rem;
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.7;
}

.dict-seo ul li {
    margin-bottom: 0.3rem;
}

.dict-seo ul li strong {
    color: var(--text-secondary);
}

/* Suggestion dropdown */
.suggestions {
    position: relative;
    margin-top: -0.8rem;
    margin-bottom: 0.5rem;
}

.suggestions-list {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: var(--dict-card-bg);
    border: 1px solid var(--dict-border);
    border-radius: 0 0 12px 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.4);
    z-index: 10;
    max-height: 200px;
    overflow-y: auto;
    display: none;
}

.suggestions-list.show {
    display: block;
}

.suggestion-item {
    padding: 8px 16px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.15s;
}

.suggestion-item:hover {
    background: rgba(0,212,255,0.08);
    color: var(--accent);
}

.suggestion-item:first-child {
    padding-top: 10px;
}

/* Responsive */
@media (max-width: 700px) {
    .dict-wrapper {
        padding: 1.5rem 0.8rem 3rem;
    }

    .dict-card {
        padding: 1.5rem 1rem;
        border-radius: 14px;
    }

    .dict-hero h1 {
        font-size: 1.7rem;
    }

    .search-group {
        flex-direction: column;
    }

    .search-btn {
        justify-content: center;
        padding: 12px 20px;
    }

    .direction-toggle {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .word-word {
        font-size: 1.5rem;
    }

    .def-item {
        padding: 0.8rem 1rem;
    }

    .recent-searches {
        gap: 0.4rem;
    }
}

@media (max-width: 480px) {
    .dict-card {
        padding: 1.2rem 0.8rem;
    }

    .search-input {
        font-size: 1rem;
        padding: 12px 14px;
    }
}
