/**
 * Thai Pronunciation Trainer - Base Styles
 * Layout, Modal, Header, Progress Section
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ============================================
   Modal Overlay
   ============================================ */

.tpt-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    z-index: 999999;
}

.tpt-modal-overlay.active {
    display: flex;
    justify-content: center;
    align-items: center;
    animation: tptFadeIn 0.2s ease;
}

@keyframes tptFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ============================================
   Practice Modal
   ============================================ */

.tpt-practice-modal {
    background: linear-gradient(145deg, #2d3748 0%, #1a202c 50%, #2d2055 100%);
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    animation: tptSlideUp 0.3s ease;
}

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

/* ============================================
   Modal Header
   ============================================ */

.tpt-modal-header {
    background: linear-gradient(180deg, #1E293B 0%, #0F172A 100%);
    padding: 28px 35px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tpt-modal-title {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: white;
    display: flex;
    align-items: center;
    gap: 12px;
}

.tpt-flag-icon {
    font-size: 28px;
}

/* Bouton close modal TPT principale */
.tpt-close-btn,
#tptCloseModal {
    position: absolute;
    top: 16px;
    right: 16px;
    background: transparent;
    border: none;
    font-size: 40px;
    font-weight: 300;
    line-height: 28px;
    cursor: pointer;
    color: white;
    transition: all 0.2s ease;
    width: 32px;
    height: 32px;
    display: flex;
    justify-content: center;
    border-radius: 50%;
    padding: 0;
    z-index: 10;
}

.tpt-close-btn:hover,
#tptCloseModal:hover {
    background: rgba(255, 255, 255, 0.9);
    color: #1a1a2e;
}

/* ============================================
   Modal Content
   ============================================ */

.tpt-modal-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px 0;
    background: #0F172A;
}

.tpt-modal-content::-webkit-scrollbar {
    width: 8px;
}

.tpt-modal-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.tpt-modal-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

/* ============================================
   Progress Section (Top Bar with Stats)
   ============================================ */

.tpt-progress-section {
    padding: 0 35px 15px;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 20px;
}

/* Stats Group */
.tpt-stats-group {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 0 0 auto;
}

/* Stats Cards - Style identique au TPR */
.tpt-stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    transition: all 0.3s;
}

.tpt-stat-card:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.12);
}

.tpt-stat-number {
    font-weight: 700;
    font-size: 24px;
    line-height: 1;
    color: white;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.tpt-stat-label {
    font-size: 10px;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1;
    font-weight: 600;
}

/* Colors for stats */
.tpt-stat-card.total .tpt-stat-number,
.tpt-stat-card.total .tpt-stat-label {
    color: #60A5FA;
}

.tpt-stat-card.valid .tpt-stat-number,
.tpt-stat-card.valid .tpt-stat-label {
    color: #22c55e;
}

/* Old progress styles - hidden */
.tpt-progress-stats-left,
.tpt-progress-stats-right,
.tpt-trainer-stat-card,
.tpt-progress-info,
.tpt-progress-title,
.tpt-progress-bar-container,
.tpt-progress-bar,
.tpt-progress-stats,
.tpt-stat-item,
.tpt-encouragement {
    display: none !important;
}

/* ============================================
   Pronunciation Content
   ============================================ */

.tpt-pronunciation-content {
    padding: 35px;
    max-width: 1200px;
    margin: 0 auto;
}

.tpt-pronunciation-grid {
    display: block;
}

/* Loading State */
.tpt-loading {
    text-align: center;
    padding: 60px 20px;
}

.tpt-spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
    border: 4px solid rgba(59, 130, 246, 0.2);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: tptSpin 0.8s linear infinite;
}

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

.tpt-loading p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
}

/* Utility */
.tpt-hidden {
    display: none !important;
}