/* =========================================
   FLASHCARDS - Grid Layout (Dark Theme)
   ========================================= */

/* Setup Geral */
body.page-template-page-flashcards {
    background-color: #020617 !important; /* Deep Space */
    color: #f8fafc;
    font-family: 'Inter', system-ui, sans-serif;
    min-height: 100vh;
}

/* Fundo Estrelado */
#app-flashcards::before {
    content: ""; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1; pointer-events: none;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 40px 40px; 
    mask-image: radial-gradient(circle at center, black 40%, transparent 100%);
}

#app-flashcards {
    width: 100%;
    min-height: calc(100vh - 80px); /* Desconta header approx */
    position: relative;
    padding: 40px;
}

/* Gerenciamento de Telas (Views) */
.fc-view {
    display: none;
    animation: fadeIn 0.4s ease-out forwards;
}
.fc-view.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fc-container {
    max-width: 1200px; margin: 0 auto; width: 100%;
}

/* === TELA 1: MENU GRID === */
.menu-header { text-align: center; margin-bottom: 50px; }
.menu-header h1 { 
    font-size: 3rem; margin: 0 0 15px 0; 
    background: linear-gradient(to right, #fff, #818cf8); 
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; 
}
.menu-header p { color: #94a3b8; font-size: 1.1rem; }

.decks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    padding-bottom: 60px;
}

/* Card do Menu (Estilo Bento) */
.deck-card {
    background: #1e293b; /* Cor Sólida */
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 24px;
    padding: 30px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    display: flex; flex-direction: column; align-items: flex-start;
}

.deck-card:hover {
    transform: translateY(-8px);
    border-color: #6366f1;
    background: #253346;
    box-shadow: 0 20px 40px -10px rgba(0,0,0,0.5);
}

.deck-icon {
    font-size: 2rem; color: #818cf8; margin-bottom: 20px;
    width: 60px; height: 60px; background: rgba(99, 102, 241, 0.1);
    border-radius: 16px; display: flex; align-items: center; justify-content: center;
}

.deck-title { font-size: 1.25rem; font-weight: 700; color: #fff; margin-bottom: 5px; }
.deck-count { font-size: 0.9rem; color: #94a3b8; font-weight: 500; }

/* === TELA 2: GAME UI === */
.game-container {
    max-width: 900px;
    display: flex; flex-direction: column; min-height: 80vh;
}

.game-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 0; margin-bottom: 40px;
}

.btn-back {
    background: transparent; border: 1px solid #334155;
    color: #cbd5e1; padding: 10px 20px; border-radius: 50px;
    cursor: pointer; font-weight: 600; display: flex; align-items: center; gap: 8px;
    transition: 0.2s;
}
.btn-back:hover { border-color: #fff; color: #fff; background: rgba(255,255,255,0.05); }

.deck-tag {
    background: rgba(99, 102, 241, 0.1); color: #818cf8;
    padding: 6px 12px; border-radius: 8px; font-size: 0.9rem; font-weight: 600;
    display: flex; align-items: center; gap: 8px;
}

/* Barra de Progresso Central */
.progress-wrapper {
    flex: 1; max-width: 300px; margin: 0 40px; text-align: center;
}
#fc-counter { font-size: 0.8rem; color: #94a3b8; font-weight: 700; margin-bottom: 5px; display: block; }
.progress-track {
    height: 6px; background: #1e293b; border-radius: 10px; overflow: hidden;
}
#fc-progress-fill {
    height: 100%; background: #6366f1; transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

/* O Palco 3D */
.fc-stage {
    flex: 1; display: flex; align-items: center; justify-content: center;
    perspective: 1000px; margin-bottom: 40px;
}

.fc-scene {
    width: 100%; aspect-ratio: 16/9; position: relative;
}

.fc-card {
    width: 100%; height: 100%; position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0.2, 0.2, 1);
    cursor: pointer;
}
.fc-card.is-flipped { transform: rotateY(180deg); }

.fc-face {
    position: absolute; inset: 0;
    -webkit-backface-visibility: hidden; backface-visibility: hidden;
    border-radius: 24px; padding: 40px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center;
    background: #1e293b; /* Sólido */
    border: 1px solid rgba(255,255,255,0.05);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.fc-back { 
    transform: rotateY(180deg); 
    background: #0f172a; /* Verso Sólido */
    border: 2px solid #6366f1;
}

.fc-label {
    position: absolute; top: 25px; font-size: 0.75rem; letter-spacing: 2px;
    color: #64748b; font-weight: 800; text-transform: uppercase;
}

.fc-content { font-size: 2rem; font-weight: 500; color: #fff; line-height: 1.4; }
.fc-content mjx-container { font-size: 115% !important; color: #a5b4fc !important; }

.fc-hint { position: absolute; bottom: 25px; font-size: 0.85rem; color: #64748b; opacity: 0.6; }

/* Footer de Controles */
.fc-controls {
    display: flex; justify-content: center; align-items: center;
    height: 80px;
}

.btn-main-flip {
    background: #f8fafc; color: #0f172a; padding: 18px 50px;
    border-radius: 50px; border: none; font-weight: 700; font-size: 1.1rem;
    cursor: pointer; box-shadow: 0 0 20px rgba(255,255,255,0.1); transition: 0.2s;
}
.btn-main-flip:hover { transform: scale(1.05); background: white; }

.fc-feedback-buttons { display: none; gap: 15px; width: 100%; justify-content: center; }
.fc-card.is-flipped ~ .fc-controls .fc-feedback-buttons { display: flex; }
.fc-card.is-flipped ~ .fc-controls .btn-main-flip { display: none; }

.btn-srs {
    flex: 1; max-width: 150px; padding: 16px; border-radius: 12px;
    background: #1e293b; color: white; border: 1px solid rgba(255,255,255,0.1);
    font-weight: 600; cursor: pointer; transition: 0.2s;
    display: flex; flex-direction: column; align-items: center; gap: 5px;
}
.btn-srs:hover { transform: translateY(-5px); }
.btn-srs.hard:hover { background: #ef4444; border-color: #ef4444; }
.btn-srs.good:hover { background: #3b82f6; border-color: #3b82f6; }
.btn-srs.easy:hover { background: #10b981; border-color: #10b981; }

/* Overlay */
.fc-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.9); z-index: 100;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none; transition: 0.3s;
}
.fc-overlay.active { opacity: 1; pointer-events: all; }

.summary-card {
    background: #1e293b; padding: 50px; border-radius: 24px; text-align: center;
    border: 1px solid #334155; box-shadow: 0 25px 50px rgba(0,0,0,0.5);
}
.summary-card i { font-size: 4rem; color: #fbbf24; margin-bottom: 20px; }
.summary-actions { margin-top: 30px; display: flex; flex-direction: column; gap: 12px; }
.btn-restart { background: #6366f1; color: white; border: none; padding: 14px; border-radius: 10px; font-weight: 700; cursor: pointer; }
.btn-outline { background: transparent; border: 1px solid #475569; color: #cbd5e1; padding: 14px; border-radius: 10px; cursor: pointer; }

/* Mobile */
@media (max-width: 768px) {
    #app-flashcards { padding: 20px; }
    .fc-scene { width: 100%; aspect-ratio: 3/4; }
    .game-header { flex-wrap: wrap; gap: 15px; }
    .progress-wrapper { order: 3; max-width: 100%; margin: 0; width: 100%; }
}