/* DE-FA Dictionary Pro - Frontend Stylesheet */
.defa-app-container {
    font-family: 'Vazirmatn', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    max-width: 1140px;
    margin: 24px auto;
    color: #1e293b;
    direction: rtl;
    text-align: right;
    box-sizing: border-box;
}

.defa-app-container * {
    box-sizing: border-box;
}

/* Header & Navigation Tabs */
.defa-top-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: #ffffff;
    padding: 22px 26px;
    border-radius: 16px;
    margin-bottom: 20px;
    box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.18);
}

.defa-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.defa-flag-icon {
    font-size: 32px;
    line-height: 1;
}

.defa-main-title {
    margin: 0 0 4px 0 !important;
    font-size: 21px !important;
    font-weight: 800 !important;
    color: #ffffff !important;
}

.defa-subtitle {
    margin: 0 !important;
    font-size: 13px;
    color: #cbd5e1;
}

.defa-nav-tabs {
    display: flex;
    gap: 10px;
}

.defa-tab-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
    border: 1px solid rgba(255, 255, 255, 0.18);
    padding: 10px 18px;
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.defa-tab-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.defa-tab-btn.active {
    background: #f59e0b;
    color: #0f172a;
    border-color: #f59e0b;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
}

.defa-tab-panel {
    display: none;
}

.defa-tab-panel.active {
    display: block;
}

/* Search Card & Filters */
.defa-search-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
    margin-bottom: 18px;
}

.defa-search-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 14px;
}

.defa-search-icon {
    position: absolute;
    right: 16px;
    font-size: 18px;
    pointer-events: none;
}

#defa-search-input {
    width: 100%;
    padding: 14px 46px 14px 42px;
    font-family: inherit;
    font-size: 15px;
    border: 2px solid #cbd5e1;
    border-radius: 12px;
    background: #f8fafc;
    color: #0f172a;
    transition: all 0.2s ease;
}

#defa-search-input:focus {
    outline: none;
    border-color: #2563eb;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.defa-clear-btn {
    position: absolute;
    left: 12px;
    background: #e2e8f0;
    border: none;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 13px;
    color: #475569;
}

/* Virtual German Keyboard & Article Color Legend */
.defa-umlaut-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding-bottom: 14px;
    border-bottom: 1px dashed #e2e8f0;
    margin-bottom: 14px;
}

.defa-umlaut-label {
    font-size: 13px;
    color: #64748b;
    margin-left: 4px;
}

.defa-char-btn {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 5px 12px;
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
    cursor: pointer;
    transition: all 0.15s ease;
    direction: ltr;
}

.defa-char-btn:hover {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
}

.defa-article-legend {
    margin-right: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12.5px;
    font-weight: 600;
    color: #475569;
}

.legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-left: 4px;
}

.der-dot { background: #2563eb; }
.die-dot { background: #dc2626; }
.das-dot { background: #16a34a; }

/* Filters Row */
.defa-filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.defa-filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.defa-filter-group label {
    font-size: 13px;
    font-weight: 700;
    color: #334155;
}

.defa-level-pills {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.defa-pill {
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #334155;
    padding: 5px 11px;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s ease;
}

.defa-pill.active {
    background: #0f172a;
    color: #ffffff;
    border-color: #0f172a;
}

.defa-select {
    font-family: inherit;
    font-size: 13px;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #0f172a;
}

/* Alphabet Bar */
.defa-alphabet-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding-top: 12px;
    border-top: 1px solid #f1f5f9;
    justify-content: center;
}

.defa-alpha-btn {
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #334155;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}

.defa-alpha-btn:hover {
    background: #e2e8f0;
}

.defa-alpha-btn.active {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
}

/* Results Bar */
.defa-results-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    font-size: 13.5px;
    color: #475569;
    font-weight: 600;
}

.defa-reset-link {
    background: none;
    border: none;
    color: #dc2626;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

/* Words Grid & Dictionary Cards */
.defa-words-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 18px;
}

.defa-word-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 18px 20px;
    box-shadow: 0 3px 10px rgba(15, 23, 42, 0.04);
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    position: relative;
    border-top: 4px solid #94a3b8;
}

.defa-word-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.1);
}

/* Gender Border Accents */
.defa-word-card.gender-der { border-top-color: #2563eb; }
.defa-word-card.gender-die { border-top-color: #dc2626; }
.defa-word-card.gender-das { border-top-color: #16a34a; }
.defa-word-card.type-verb  { border-top-color: #7c3aed; }

/* Card Top Metadata & Save Star */
.defa-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.defa-badges-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.defa-lvl-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11.5px;
    font-weight: 800;
    direction: ltr;
}

.lvl-A1, .lvl-A2 { background: #dcfce7; color: #15803d; }
.lvl-B1, .lvl-B2 { background: #dbeafe; color: #1d4ed8; }
.lvl-C1, .lvl-C2 { background: #f3e8ff; color: #6d28d9; }

.defa-type-badge {
    background: #f1f5f9;
    color: #475569;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11.5px;
    font-weight: 600;
}

.defa-topic-badge {
    background: #fef3c7;
    color: #b45309;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11.5px;
    font-weight: 600;
}

.defa-save-btn {
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 4px 10px;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 700;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s ease;
}

.defa-save-btn.saved {
    background: #fef3c7;
    border-color: #f59e0b;
    color: #b45309;
}

/* Headword & Article Color Coding */
.defa-headword-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    direction: ltr;
    text-align: left;
    background: #f8fafc;
    padding: 10px 14px;
    border-radius: 12px;
}

.defa-de-title {
    font-size: 21px;
    font-weight: 800;
    color: #0f172a;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.defa-art-badge {
    padding: 2px 9px;
    border-radius: 7px;
    font-size: 14px;
    font-weight: 800;
}

.art-der { background: #dbeafe; color: #1d4ed8; border: 1px solid #93c5fd; }
.art-die { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }
.art-das { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }

.defa-plural-tag {
    font-size: 12.5px;
    color: #64748b;
    font-weight: 600;
}

/* Audio & Pronunciation Row */
.defa-pron-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.defa-pron-fa {
    background: #f1f5f9;
    color: #334155;
    padding: 4px 10px;
    border-radius: 8px;
    font-weight: 600;
}

.defa-ipa {
    font-family: monospace;
    color: #64748b;
    direction: ltr;
    margin-right: 6px;
}

.defa-audio-group {
    display: flex;
    gap: 6px;
}

.defa-audio-btn {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    padding: 4px 9px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}

.defa-audio-btn:hover {
    background: #2563eb;
    color: #ffffff;
}

.defa-audio-btn.slow {
    background: #f8fafc;
    color: #475569;
    border-color: #cbd5e1;
}

/* Persian Meaning */
.defa-meaning-fa {
    font-size: 16.5px;
    font-weight: 800;
    color: #0f172a;
    padding: 6px 2px;
    border-bottom: 1px solid #f1f5f9;
}

/* Verb Conjugation Box */
.defa-conj-box {
    background: #faf5ff;
    border: 1px solid #e9d5ff;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 12.5px;
}

.defa-conj-summary-line {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    direction: ltr;
    text-align: left;
    color: #581c87;
    font-weight: 700;
}

.defa-conj-toggle {
    background: none;
    border: none;
    color: #7c3aed;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    padding: 0;
    margin-top: 6px;
    display: inline-block;
}

.defa-conj-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
    direction: ltr;
    text-align: left;
    font-size: 12px;
    background: #ffffff;
    border-radius: 6px;
    overflow: hidden;
}

.defa-conj-table td {
    padding: 4px 8px;
    border: 1px solid #f3e8ff;
}

.defa-conj-table td.pronoun {
    color: #6b7280;
    font-weight: 600;
    width: 38%;
}

/* Example Sentences with German Audio + Persian Pronunciation + Persian Meaning */
.defa-examples-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.defa-example-item {
    background: #f8fafc;
    border-right: 3px solid #3b82f6;
    border-radius: 8px;
    padding: 9px 11px;
    font-size: 13px;
}

.defa-ex-de-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    direction: ltr;
    text-align: left;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 4px;
}

.defa-ex-speak-btn {
    background: #e0f2fe;
    border: none;
    color: #0369a1;
    border-radius: 6px;
    padding: 2px 7px;
    font-size: 11.5px;
    cursor: pointer;
    flex-shrink: 0;
}

.defa-ex-Speak-btn:hover {
    background: #0284c7;
    color: #fff;
}

.defa-ex-pron-fa {
    font-size: 12px;
    color: #0f766e;
    margin-bottom: 3px;
    font-weight: 600;
}

.defa-ex-fa {
    font-size: 12.5px;
    color: #475569;
}

.defa-notes-box {
    font-size: 12px;
    color: #64748b;
    background: #fffbeb;
    border: 1px solid #fde68a;
    padding: 7px 10px;
    border-radius: 8px;
}

/* Interactive 3D Flashcards Tab */
.defa-flashcard-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 16px 20px;
    margin-bottom: 18px;
}

.defa-flashcard-header h3 {
    margin: 0 0 4px 0 !important;
    font-size: 17px !important;
}

.defa-flashcard-header p {
    margin: 0 !important;
    font-size: 13px;
    color: #64748b;
}

.defa-fc-mode-switch {
    display: flex;
    gap: 8px;
}

.defa-mode-btn {
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    padding: 8px 14px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.defa-mode-btn.active {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
}

.defa-empty-box {
    background: #ffffff;
    border: 2px dashed #cbd5e1;
    border-radius: 16px;
    padding: 40px 20px;
    text-align: center;
    color: #64748b;
}

.defa-fc-progress-bar {
    display: flex;
    justify-content: space-between;
    max-width: 560px;
    margin: 0 auto 10px auto;
    font-size: 13.5px;
    font-weight: 700;
    color: #475569;
}

.defa-fc-stage {
    perspective: 1200px;
    max-width: 560px;
    margin: 0 auto 18px auto;
}

.defa-flashcard-3d {
    width: 100%;
    min-height: 320px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.55s cubic-bezier(0.4, 0.2, 0.2, 1);
    cursor: pointer;
}

.defa-flashcard-3d.is-flipped {
    transform: rotateY(180deg);
}

.defa-fc-face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    background: #ffffff;
    border: 2px solid #cbd5e1;
    border-radius: 20px;
    padding: 26px;
    box-shadow: 0 12px 30px -8px rgba(15, 23, 42, 0.12);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.defa-fc-back {
    transform: rotateY(180deg);
    background: #f8fafc;
    overflow-y: auto;
}

.defa-fc-top-badges {
    display: flex;
    gap: 8px;
}

.defa-fc-center-word {
    text-align: center;
    margin: 18px 0 8px 0;
}

.defa-fc-center-word h3 {
    display: inline;
    font-size: 34px !important;
    font-weight: 800 !important;
    color: #0f172a;
    margin: 0;
}

.defa-fc-pron {
    text-align: center;
    color: #0f766e;
    font-weight: 700;
    font-size: 15px;
    margin: 0 0 12px 0;
}

.defa-fc-audio-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.defa-fc-flip-hint {
    text-align: center;
    font-size: 12px;
    color: #94a3b8;
    display: block;
    margin-top: 10px;
}

.defa-fc-back-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 10px;
}

.defa-fc-back-header h4 {
    margin: 0 !important;
    font-size: 22px !important;
    color: #0f172a;
}

.defa-fc-controls {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    max-width: 560px;
    margin: 0 auto;
}

.defa-ctrl-btn {
    padding: 10px 16px;
    border-radius: 10px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
}

.defa-ctrl-btn.primary {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
}

.defa-ctrl-btn.success {
    background: #16a34a;
    color: #ffffff;
    border-color: #16a34a;
}

/* Pagination */
.defa-pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 24px;
}

.defa-page-btn {
    border: 1px solid #cbd5e1;
    background: #ffffff;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 700;
}

.defa-page-btn.active {
    background: #0f172a;
    color: #ffffff;
    border-color: #0f172a;
}

@media (max-width: 640px) {
    .defa-words-grid {
        grid-template-columns: 1fr;
    }
    .defa-top-bar {
        padding: 16px;
    }
}
