/* ============================== */
/* FLASHCARDS - Responsive Design */
/* ============================== */

/* Page Container */
.fc-page {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 1rem;
}

/* ========== SELECTION VIEW ========== */
.fc-selection {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1rem;
}

.fc-selection-header {
    text-align: center;
    margin-bottom: 2rem;
}

.fc-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: white;
    margin: 0 0 0.5rem 0;
    font-family: var(--font-heading);
}

.fc-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0;
}

/* Subject Grid */
.fc-subject-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
    max-width: 500px;
}

.fc-subject-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fc-subject-card:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--accent);
    transform: translateX(4px);
}

.fc-subject-card:active {
    transform: scale(0.98);
}

.fc-subject-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 10px;
    flex-shrink: 0;
}

.fc-subject-icon i {
    width: 22px;
    height: 22px;
    color: white;
}

.fc-subject-info {
    flex: 1;
    min-width: 0;
}

.fc-subject-name {
    font-weight: 600;
    font-size: 1rem;
    color: white;
    margin-bottom: 2px;
}

.fc-subject-count {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.fc-subject-arrow {
    color: var(--text-muted);
}

.fc-subject-arrow i {
    width: 20px;
    height: 20px;
}

/* ========== STUDY VIEW ========== */
.fc-study {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.fc-study-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    margin-bottom: 0.75rem;
    flex-shrink: 0;
}

.fc-back-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.fc-back-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.fc-back-btn i {
    width: 18px;
    height: 18px;
}

.fc-study-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.fc-study-subject {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.fc-study-counter {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--accent);
    background: rgba(236, 179, 144, 0.15);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
}

/* Progress Bar */
.fc-progress-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 1rem;
    flex-shrink: 0;
}

.fc-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* Loading State */
.fc-loading {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    color: var(--text-muted);
}

.fc-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Empty State */
.fc-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.fc-empty i {
    width: 64px;
    height: 64px;
    opacity: 0.3;
    margin-bottom: 1rem;
}

.fc-empty h3 {
    color: white;
    margin: 0 0 0.5rem 0;
}

.fc-empty p {
    margin: 0;
    font-size: 0.9rem;
}

/* ========== FLASHCARD ========== */
.fc-card-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    align-items: center;
}

.fc-card {
    width: 100%;
    max-width: 420px;
    aspect-ratio: 3 / 4;
    max-height: 480px;
    perspective: 1000px;
    cursor: pointer;
    margin-bottom: 1rem;
}

.fc-card-face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    padding: 1.25rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: transform 0.5s ease;
}

.fc-card-front {
    background: linear-gradient(145deg, #3e4e3b 0%, #2b3a28 100%);
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.fc-card-back {
    background: linear-gradient(145deg, #4e342e 0%, #3e2723 100%);
    border: 2px solid rgba(236, 179, 144, 0.2);
    transform: rotateY(180deg);
}

.fc-card.flipped .fc-card-front {
    transform: rotateY(180deg);
}

.fc-card.flipped .fc-card-back {
    transform: rotateY(360deg);
}

.fc-card-badge {
    align-self: flex-start;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 0.35rem 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.7);
    flex-shrink: 0;
}

.fc-badge-answer {
    background: rgba(236, 179, 144, 0.15);
    color: var(--accent);
}

.fc-card-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    padding: 0.75rem 0;
    min-height: 0;
}

/* KEY CHANGE: Text formatting with line breaks preserved */
.fc-card-text {
    font-size: 0.85rem;
    line-height: 1.6;
    color: white;
    text-align: center;
    white-space: pre-line;
    word-break: break-word;
    width: 100%;
}

.fc-card-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-shrink: 0;
    padding-top: 0.5rem;
}

.fc-card-hint i {
    width: 16px;
    height: 16px;
}

.fc-card-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
    padding-top: 0.75rem;
}

.fc-action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: white;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.fc-action-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.fc-action-btn i {
    width: 16px;
    height: 16px;
}

/* Controls */
.fc-controls {
    display: flex;
    gap: 1rem;
    width: 100%;
    max-width: 420px;
    flex-shrink: 0;
}

.fc-ctrl-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.9rem;
    border-radius: 12px;
    border: 2px solid;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.fc-ctrl-btn i {
    width: 20px;
    height: 20px;
}

.fc-ctrl-retry {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.fc-ctrl-retry:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
}

.fc-ctrl-know {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
    color: #22c55e;
}

.fc-ctrl-know:hover {
    background: rgba(34, 197, 94, 0.2);
    border-color: #22c55e;
}

/* Swipe Hint (Mobile only) */
.fc-swipe-hint {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 1rem;
    opacity: 0.6;
}

.fc-swipe-hint i {
    width: 16px;
    height: 16px;
}

/* ========== RESPONSIVE ========== */

/* Tablet */
@media (min-width: 600px) {
    .fc-page {
        padding: 1.5rem;
    }

    .fc-title {
        font-size: 2rem;
    }

    .fc-subject-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        max-width: 600px;
    }

    .fc-subject-card {
        flex-direction: column;
        text-align: center;
        padding: 1.5rem;
    }

    .fc-subject-arrow {
        display: none;
    }

    .fc-card {
        max-height: 520px;
    }

    .fc-card-text {
        font-size: 0.9rem;
    }
}

/* Desktop */
@media (min-width: 900px) {
    .fc-subject-grid {
        grid-template-columns: repeat(3, 1fr);
        max-width: 800px;
    }

    .fc-card {
        max-width: 480px;
        max-height: 580px;
    }

    .fc-card-text {
        font-size: 0.95rem;
    }

    .fc-ctrl-btn {
        padding: 1rem;
        font-size: 0.9rem;
    }
}

/* Mobile - Small screens */
@media (max-width: 400px) {
    .fc-page {
        padding: 0.75rem;
    }

    .fc-title {
        font-size: 1.4rem;
    }

    .fc-back-text {
        display: none;
    }

    .fc-study-subject {
        display: none;
    }

    .fc-card {
        max-height: 380px;
    }

    .fc-card-text {
        font-size: 0.8rem;
    }

    .fc-ctrl-btn span {
        display: none;
    }

    .fc-ctrl-btn {
        padding: 1rem;
    }

    .fc-swipe-hint {
        display: flex;
    }
}