/**
 * MHENT STUDY - AISA SMART DICTIONARY STYLES
 * Glassmorphism Dark Mode & Vibrant Neon Accents
 */

.aisa-dict-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(10, 15, 29, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    transition: opacity 0.25s ease;
}

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

.aisa-dict-container {
    width: 100%;
    max-width: 680px;
    max-height: 90vh;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.98), rgba(11, 17, 33, 0.99));
    border: 1px solid rgba(56, 189, 248, 0.25);
    box-shadow: 0 30px 80px -15px rgba(0, 0, 0, 0.8), 0 0 35px rgba(14, 165, 233, 0.2);
    border-radius: 22px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.95) translateY(10px);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.aisa-dict-overlay.active .aisa-dict-container {
    transform: scale(1) translateY(0);
}

/* Header & Search Bar */
.aisa-dict-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: rgba(255, 255, 255, 0.02);
}

.aisa-dict-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.aisa-dict-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.aisa-dict-brand-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, #0ea5e9, #6366f1);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.35);
}

.aisa-dict-brand-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.aisa-dict-brand-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.05rem;
    font-weight: 800;
    color: #f8fafc;
    letter-spacing: -0.01em;
}

.aisa-dict-brand-badge {
    background: linear-gradient(135deg, #0ea5e9, #6366f1);
    color: white;
    font-size: 0.68rem;
    padding: 2px 7px;
    border-radius: 6px;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.aisa-dict-brand-tagline {
    font-size: 0.8rem;
    color: #94a3b8;
}

.aisa-dict-close-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    font-size: 1.1rem;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.aisa-dict-close-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    color: #ef4444;
    transform: rotate(90deg);
}

.aisa-dict-search-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.aisa-dict-search-box {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.aisa-dict-input-icon {
    position: absolute;
    left: 14px;
    color: #38bdf8;
    font-size: 0.95rem;
    pointer-events: none;
}

.aisa-dict-input {
    width: 100%;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 11px 90px 11px 40px;
    color: #f8fafc;
    font-size: 0.98rem;
    outline: none;
    transition: all 0.2s ease;
}

.aisa-dict-input:focus {
    background: rgba(15, 23, 42, 0.95);
    border-color: #0ea5e9;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.25);
}

.aisa-dict-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.9rem;
}

.aisa-dict-search-btn {
    position: absolute;
    right: 6px;
    background: linear-gradient(135deg, #0ea5e9, #6366f1);
    border: none;
    color: white;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    padding: 7px 14px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.3);
}

.aisa-dict-search-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.45);
}

.aisa-dict-lang-select {
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #f8fafc;
    border-radius: 12px;
    padding: 11px 14px;
    font-size: 0.88rem;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    transition: all 0.2s;
}

.aisa-dict-lang-select:focus,
.aisa-dict-lang-select:hover {
    border-color: #38bdf8;
    background: #1e293b;
}

/* FIX: Ngăn chặn triệt để lỗi chữ trắng trên nền trắng của thẻ option trong Windows */
.aisa-dict-lang-select option {
    background-color: #0f172a !important;
    color: #f8fafc !important;
    padding: 10px 14px;
    font-size: 0.9rem;
}

/* Body Content */
.aisa-dict-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

/* Loading Skeleton */
.aisa-dict-loading {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    gap: 16px;
    color: var(--text-secondary, #94a3b8);
}

.aisa-dict-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(14, 165, 233, 0.2);
    border-top-color: #0ea5e9;
    border-radius: 50%;
    animation: aisaDictSpin 0.7s linear infinite;
}

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

/* Empty State / Suggestions */
.aisa-dict-welcome {
    text-align: center;
    padding: 30px 15px;
    color: var(--text-secondary, #94a3b8);
}

.aisa-dict-welcome-icon {
    font-size: 2.8rem;
    margin-bottom: 12px;
}

.aisa-dict-welcome h4 {
    color: #f8fafc;
    font-size: 1.15rem;
    margin-bottom: 8px;
}

.aisa-dict-welcome p {
    font-size: 0.9rem;
    line-height: 1.5;
    max-width: 440px;
    margin: 0 auto 16px;
}

.aisa-dict-hot-words {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.aisa-hot-pill {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #38bdf8;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.2s;
}

.aisa-hot-pill:hover {
    background: rgba(14, 165, 233, 0.2);
    border-color: #0ea5e9;
    transform: translateY(-1px);
}

/* Result Card */
.aisa-dict-result {
    display: none;
    flex-direction: column;
    gap: 20px;
    animation: aisaFadeIn 0.3s ease;
}

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

.dict-result-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 16px;
}

.dict-word-header {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dict-word-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.dict-word-title {
    font-size: 1.85rem;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.5px;
}

.dict-speak-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(14, 165, 233, 0.15);
    border: 1px solid rgba(14, 165, 233, 0.3);
    color: #38bdf8;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.dict-speak-btn:hover {
    background: #0ea5e9;
    color: white;
    transform: scale(1.08);
}

.dict-phonetic-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.dict-phonetic {
    font-family: 'Consolas', 'Courier New', monospace;
    color: #38bdf8;
    font-size: 0.95rem;
    background: rgba(14, 165, 233, 0.1);
    padding: 2px 8px;
    border-radius: 6px;
}

.dict-pos-tag {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dict-pos-tag.noun { background: rgba(59, 130, 246, 0.2); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.4); }
.dict-pos-tag.verb { background: rgba(16, 185, 129, 0.2); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.4); }
.dict-pos-tag.adj { background: rgba(245, 158, 11, 0.2); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.4); }
.dict-pos-tag.adv { background: rgba(168, 85, 247, 0.2); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.4); }
.dict-pos-tag.other { background: rgba(100, 116, 139, 0.2); color: #94a3b8; border: 1px solid rgba(100, 116, 139, 0.4); }

/* Meaning Box */
.dict-meaning-box {
    background: rgba(14, 165, 233, 0.05);
    border: 1px solid rgba(14, 165, 233, 0.2);
    border-left: 4px solid #0ea5e9;
    padding: 16px 20px;
    border-radius: 14px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.dict-meaning-label {
    font-size: 0.76rem;
    font-weight: 800;
    color: #38bdf8;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.dict-meaning-text {
    font-size: 1.18rem;
    font-weight: 600;
    color: #f8fafc;
    line-height: 1.55;
}

/* Word Family Grid */
.dict-wf-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dict-section-title {
    font-size: 0.84rem;
    font-weight: 700;
    color: #cbd5e1;
    display: flex;
    align-items: center;
    gap: 6px;
}

.dict-wf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
}

.dict-wf-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: all 0.2s ease;
}

.dict-wf-item:hover {
    background: rgba(56, 189, 248, 0.08);
    border-color: rgba(56, 189, 248, 0.35);
    transform: translateY(-2px);
}

.dict-wf-type {
    font-size: 0.72rem;
    color: #94a3b8;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dict-wf-val {
    font-size: 1rem;
    color: #f8fafc;
    font-weight: 700;
    cursor: pointer;
    transition: color 0.15s;
}

.dict-wf-val:hover {
    color: #38bdf8;
    text-decoration: underline;
}

/* Example Box */
.dict-example-box {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-left: 3px solid #10b981;
    border-radius: 14px;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.dict-example-orig {
    font-size: 1rem;
    font-weight: 600;
    color: #f1f5f9;
    line-height: 1.5;
}

.dict-example-trans {
    font-size: 0.92rem;
    color: #94a3b8;
    font-style: italic;
    line-height: 1.45;
}

/* Footer & Actions */
.dict-result-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.dict-btn-save {
    background: linear-gradient(135deg, #0ea5e9, #6366f1);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 11px 22px;
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.25s ease;
    box-shadow: 0 4px 15px rgba(14, 165, 233, 0.35);
}

.dict-btn-save:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(14, 165, 233, 0.5);
}

.dict-btn-save.saved {
    background: #10b981;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

.dict-source-badge {
    font-size: 0.75rem;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Floating trigger button */
.btn-open-aisa-dict {
    background: rgba(14, 165, 233, 0.12);
    border: 1px solid rgba(14, 165, 233, 0.3);
    color: #38bdf8;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.btn-open-aisa-dict:hover {
    background: #0ea5e9;
    color: white;
    box-shadow: 0 0 15px rgba(14, 165, 233, 0.5);
    transform: translateY(-1px);
}

/* Responsive Compact Navbar Trigger */
@media screen and (max-width: 768px) {
    .btn-open-aisa-dict kbd {
        display: none !important;
    }
    .btn-open-aisa-dict {
        padding: 4px 10px;
        font-size: 0.78rem;
        height: 28px;
    }
}

@media screen and (max-width: 540px) {
    .btn-open-aisa-dict span {
        display: none !important;
    }
    .btn-open-aisa-dict {
        width: 32px !important;
        height: 32px !important;
        min-width: 32px !important;
        padding: 0 !important;
        justify-content: center !important;
        border-radius: 50% !important;
    }
    .btn-open-aisa-dict i {
        margin: 0 !important;
        font-size: 13px !important;
    }
}

/* ==========================================================================
   DECK SELECTOR MODAL STYLES (Chọn Sổ từ vựng / Bộ bài học để lưu)
   ========================================================================== */
.deck-selector-overlay {
    position: fixed;
    inset: 0;
    z-index: 12000;
    background: rgba(10, 15, 29, 0.85);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.deck-selector-overlay.active {
    display: flex;
    opacity: 1;
}

.deck-selector-card {
    width: 100%;
    max-width: 520px;
    max-height: 88vh;
    background: linear-gradient(135deg, rgba(19, 27, 46, 0.98), rgba(15, 23, 42, 0.99));
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 35px rgba(14, 165, 233, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.95) translateY(10px);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.deck-selector-overlay.active .deck-selector-card {
    transform: scale(1) translateY(0);
}

.deck-selector-header {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.deck-selector-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: #f8fafc;
    display: flex;
    align-items: center;
    gap: 8px;
}

.deck-selector-close-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 1.2rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.deck-selector-close-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #f8fafc;
}

.deck-word-preview {
    background: rgba(14, 165, 233, 0.08);
    border-bottom: 1px solid rgba(14, 165, 233, 0.15);
    padding: 14px 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.deck-word-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.deck-prev-word {
    font-size: 1.35rem;
    font-weight: 800;
    color: #ffffff;
}

.deck-prev-phonetic {
    font-family: monospace;
    color: #38bdf8;
    font-size: 0.9rem;
}

.deck-prev-pos {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    padding: 2px 6px;
    border-radius: 4px;
}

.deck-prev-meaning {
    font-size: 0.95rem;
    color: #e2e8f0;
    font-weight: 600;
}

.deck-selector-body {
    padding: 18px 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    flex: 1;
}

.deck-list-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 700;
    color: #94a3b8;
}

.deck-lang-tag {
    font-size: 0.75rem;
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 8px;
    border-radius: 6px;
    color: #f8fafc;
}

.deck-selector-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 250px;
    overflow-y: auto;
    padding-right: 4px;
}

.deck-loading-skeleton {
    padding: 20px;
    text-align: center;
    color: #94a3b8;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.deck-option-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    cursor: pointer;
    transition: all 0.2s;
}

.deck-option-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(14, 165, 233, 0.4);
}

.deck-option-card.is-current {
    border-color: #0ea5e9;
    background: rgba(14, 165, 233, 0.1);
}

.deck-option-card input[type="radio"] {
    accent-color: #0ea5e9;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.deck-card-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.deck-card-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.deck-card-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #f8fafc;
}

.deck-card-desc {
    font-size: 0.78rem;
    color: #94a3b8;
}

.deck-card-meta {
    font-size: 0.78rem;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 8px;
}

.deck-badge-active {
    font-size: 0.68rem;
    font-weight: 800;
    background: #0ea5e9;
    color: white;
    padding: 1px 6px;
    border-radius: 4px;
}

.deck-new-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
}

.new-deck-input-wrap {
    padding-left: 32px;
}

.new-deck-input {
    width: 100%;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(16, 185, 129, 0.4);
    border-radius: 10px;
    color: #f8fafc;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s;
}

.new-deck-input:focus {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.deck-selector-footer {
    padding: 14px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    background: rgba(255, 255, 255, 0.02);
}

.deck-btn-cancel {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #94a3b8;
    padding: 9px 18px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
}

.deck-btn-cancel:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #f8fafc;
}

.deck-btn-confirm {
    background: linear-gradient(135deg, #0ea5e9, #6366f1);
    border: none;
    color: white;
    padding: 9px 22px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 14px rgba(14, 165, 233, 0.3);
    transition: all 0.2s;
}

.deck-btn-confirm:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(14, 165, 233, 0.4);
}

