/* Phrase List */
.phrase-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Phrase Card */
.phrase-card {
    background: var(--surface);
    border-radius: var(--radius-card);
    padding: 24px;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    border: 2px solid transparent;
}

.phrase-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.06);
    border-color: var(--primary-pale);
}

.card-top {
    display: flex;
    align-items: flex-start;
    gap: 20px;
}

.card-text {
    flex: 1;
    min-width: 0;
}

.phrase-jap {
    font-family: var(--font-jp);
    font-size: clamp(20px, 2.5vw, 24px);
    font-weight: 700;
    color: var(--text);
    line-height: 1.5;
    margin-bottom: 8px;
    word-break: break-word;
}

.phrase-pt {
    font-size: 15px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Audio Controls */
.audio-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.audio-btn {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-pill);
    border: none;
    background: var(--secondary-pale);
    color: var(--secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    flex-shrink: 0;
    box-shadow: 0 4px 0 rgba(56, 189, 248, 0.2);
}

.audio-btn.btn-play {
    background: var(--primary-pale);
    color: var(--primary);
    box-shadow: 0 4px 0 rgba(255, 126, 179, 0.2);
}

.audio-btn:hover {
    transform: translateY(-2px);
}

.audio-btn.btn-play:hover {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 6px 0 rgba(255, 126, 179, 0.3);
}

.audio-btn.btn-dl:hover {
    background: var(--secondary);
    color: #fff;
    box-shadow: 0 6px 0 rgba(56, 189, 248, 0.3);
}

.audio-btn:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 transparent !important;
}

.audio-btn svg {
    display: block;
    pointer-events: none;
    width: 18px;
    height: 18px;
}

.audio-btn.btn-play.state-loading {
    pointer-events: none;
    opacity: 0.7;
}

.audio-btn.btn-play.state-playing {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 0 rgba(255, 126, 179, 0.4);
    transform: translateY(2px);
}

.audio-btn.no-audio {
    opacity: 0.3;
    pointer-events: none;
    box-shadow: none;
    background: var(--bg2);
    color: var(--text-muted);
}

/* Card Bottom */
.card-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 2px dashed var(--bg);
}

.phrase-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tag {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    color: var(--text-dim);
    background: var(--bg);
    border-radius: 8px;
    padding: 4px 10px;
    text-transform: uppercase;
}

.tag.tag-level {
    color: var(--secondary);
    background: var(--secondary-pale);
}

/* Waveform */
.waveform {
    display: none;
    align-items: flex-end;
    gap: 4px;
    height: 20px;
}

.phrase-card.is-playing .waveform {
    display: flex;
}

.waveform-bar {
    width: 4px;
    background: var(--primary);
    border-radius: 2px;
}

/* Highlight */
mark {
    background: #FFE8A1;
    color: var(--text);
    border-radius: 4px;
    padding: 2px 4px;
    font-weight: bold;
}

/* Empty & Loading States */
.empty-state {
    text-align: center;
    padding: 80px 24px;
    color: var(--text-muted);
    background: var(--surface);
    border-radius: var(--radius-card);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.empty-state .kanji-big {
    font-family: var(--font-jp);
    font-size: 80px;
    font-weight: 800;
    display: block;
    margin-bottom: 16px;
    color: var(--primary-pale);
}

.empty-state p {
    font-size: 16px;
    font-weight: 600;
}

.loading {
    text-align: center;
    padding: 60px;
    color: var(--text-dim);
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

/* Responsive Components */
@media (max-width: 600px) {
    .phrase-card {
        padding: 20px 16px;
    }

    .audio-btn {
        width: 38px;
        height: 38px;
    }

    .card-top {
        gap: 12px;
    }
}

/* ═══════════════════════════════════════════════════
   DECK BUILDER COMPONENTS
   ═══════════════════════════════════════════════════ */

/* Deck Counter Button */
.deck-counter {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-pill);
    padding: 6px 14px;
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s ease;
}

.deck-counter:hover {
    border-color: var(--primary);
    background: var(--primary-pale);
}

.deck-count {
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
}

.deck-label {
    color: var(--text-muted);
}

/* Add to Deck Button (inside phrase card) */
.add-to-deck-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-pill);
    border: 2px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 18px;
    line-height: 1;
}

.add-to-deck-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-pale);
}

.add-to-deck-btn.in-deck {
    background: var(--primary-pale);
    border-color: var(--primary);
    color: var(--primary);
    cursor: default;
}

.add-to-deck-btn.in-deck:hover {
    transform: none;
}

/* Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(51, 65, 85, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.modal-overlay[hidden] {
    display: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    background: var(--surface);
    border-radius: var(--radius-card);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
}

.modal-content.modal-small {
    max-width: 480px;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-family: var(--font-jp);
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-dim);
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--text);
}

/* Modal Actions */
.modal-actions {
    display: flex;
    gap: 12px;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--bg2);
}

/* Buttons */
.btn-primary {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-pill);
    padding: 10px 20px;
    font-family: var(--font-lat);
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 2px solid var(--border);
    border-radius: var(--radius-pill);
    padding: 10px 20px;
    font-family: var(--font-lat);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    border-color: var(--text-dim);
}

.btn-text {
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-lat);
    font-size: 13px;
    cursor: pointer;
    padding: 4px 8px;
}

.btn-text:hover {
    color: var(--primary);
}

/* Deck List */
.deck-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.deck-item {
    display: flex;
    gap: 12px;
    padding: 12px 24px;
    border-bottom: 1px solid var(--border);
    align-items: flex-start;
}

.deck-item:last-child {
    border-bottom: none;
}

.deck-item-text {
    flex: 1;
    min-width: 0;
}

.deck-item-jp {
    font-family: var(--font-jp);
    font-weight: 600;
    font-size: 15px;
    color: var(--text);
    margin-bottom: 4px;
}

.deck-item-pt {
    font-size: 13px;
    color: var(--text-muted);
}

.deck-item-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-end;
}

.deck-item-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s;
}

.deck-item-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.deck-item-btn.remove {
    color: #ef4444;
}

.deck-item-btn.remove:hover {
    border-color: #ef4444;
    background: #fef2f2;
}

/* Deck Empty State */
.deck-empty {
    text-align: center;
    padding: 60px 24px;
    color: var(--text-dim);
}

.deck-empty .kanji-big {
    font-family: var(--font-jp);
    font-size: 64px;
    font-weight: 700;
    display: block;
    margin-bottom: 12px;
    color: var(--primary-pale);
}

.deck-empty p {
    font-size: 14px;
    line-height: 1.6;
}

/* Form Styles */
.form-group {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
}

.form-group:last-child {
    border-bottom: none;
}

.form-group label {
    display: block;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-family: var(--font-lat);
    font-size: 14px;
    color: var(--text);
    background: var(--surface);
    transition: border-color 0.2s;
    resize: vertical;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
}

.form-hint {
    display: block;
    margin-top: 6px;
    font-size: 11px;
    color: var(--text-dim);
}

.audio-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg);
    border-radius: 8px;
}

.audio-name {
    flex: 1;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.audio-btn-small {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.2s;
}

.audio-btn-small:hover {
    border-color: var(--secondary);
    background: var(--secondary-pale);
}

.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--bg2);
}

.form-buttons {
    display: flex;
    gap: 8px;
}

/* Export Options */
.export-options {
    padding: 16px 24px 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text);
    cursor: pointer;
}

.checkbox-label.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.checkbox-label input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.checkbox-label .coming-soon {
    color: var(--text-dim);
    font-size: 11px;
}

/* Export Progress */
.export-progress {
    padding: 24px;
    text-align: center;
}

.progress-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

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

#exportStatus {
    font-size: 15px;
    color: var(--text);
    margin-bottom: 12px;
}

.progress-bar {
    height: 6px;
    background: var(--bg);
    border-radius: 3px;
    overflow: hidden;
    margin: 12px 0;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    transition: width 0.2s ease;
}

.progress-details {
    font-size: 12px;
    color: var(--text-dim);
    font-family: var(--font-mono);
}

.success-message {
    font-size: 16px;
    color: #22c55e;
    font-weight: 600;
    margin-bottom: 16px;
}

.export-instructions {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.6;
    text-align: left;
    background: var(--bg);
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.export-instructions code {
    background: var(--surface);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 12px;
}

/* Responsive */
@media (max-width: 600px) {
    .deck-counter {
        padding: 4px 10px;
    }

    .deck-count {
        width: 18px;
        height: 18px;
        font-size: 10px;
    }

    .modal-content {
        max-height: 100vh;
        border-radius: 16px 16px 0 0;
    }

    .modal-actions {
        flex-wrap: wrap;
    }

    .form-actions {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }

    .form-buttons {
        justify-content: flex-end;
    }
}


/* ═══════════════════════════════════════════════════
   EXPORT MODAL — DOIS MÉTODOS + DECK SELECTOR
   ═══════════════════════════════════════════════════ */

/* Container dos dois botões de método */
.export-methods {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 24px;
}

.export-method-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 14px 18px;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-card);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.export-method-btn:hover {
    border-color: var(--primary);
    background: var(--primary-pale);
    transform: translateY(-2px);
}

.export-method-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.export-method-btn:disabled:hover {
    border-color: var(--border);
    background: var(--surface);
}

.export-method-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.export-method-info strong {
    display: block;
    font-size: 14px;
    color: var(--text);
    margin-bottom: 2px;
}

.export-method-info small {
    color: var(--text-muted);
    font-size: 12px;
}

/* Seção de seleção de deck (Anki) */
.anki-deck-section {
    padding: 0 24px 16px;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    background: var(--bg2);
    margin: 0 24px 16px;
    border-radius: var(--radius-card);
}

.anki-deck-section .form-group {
    padding: 12px 0;
    border: none;
}

/* Status do AnkiConnect */
.anki-connect-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--surface);
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 8px;
}

.anki-connect-status .status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #fbbf24;
    /* amarelo = verificando */
    flex-shrink: 0;
}

/* Hint/link */
.export-hint {
    font-size: 12px;
    color: var(--text-dim);
    padding: 10px 14px;
    background: var(--primary-pale);
    border-radius: 8px;
    margin-top: 8px;
}

.export-hint .hint-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.export-hint .hint-link:hover {
    text-decoration: underline;
}

/* Botões de ação na exportação */
.export-actions {
    padding: 16px 24px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Responsivo para export modal */
@media (max-width: 600px) {
    .export-method-btn {
        padding: 12px 14px;
        gap: 10px;
    }

    .export-method-icon {
        font-size: 20px;
    }

    .anki-deck-section {
        margin: 0 16px 12px;
        padding: 0 16px 12px;
    }

    .export-actions {
        padding: 12px 16px 20px;
        flex-direction: column-reverse;
    }

    .export-actions .btn-primary,
    .export-actions .btn-secondary {
        width: 100%;
    }
}