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

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

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

.tpr-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;
}

.tpr-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
   ============================================ */

.tpr-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
   ============================================ */

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

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

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

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

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

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

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

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

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

.tpr-progress-section {
    background: linear-gradient(135deg, #1e3a8a 0%, #dc2626 100%);
    padding: 24px 35px;
    margin: 20px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
    transition: all 0.5s ease;
}

/* Completed state - green with confetti */
.tpr-progress-section.completed {
    background: linear-gradient(135deg, #22c55e 0%, #10b981 100%);
    box-shadow: 0 4px 16px rgba(34, 197, 94, 0.4);
}

/* Hide progress bar and title when completed */
.tpr-progress-info.completed .tpr-progress-title,
.tpr-progress-info.completed .tpr-progress-bar-container {
    display: none;
}

/* Center and enlarge the encouragement text when completed */
.tpr-progress-info.completed .tpr-encouragement {
    margin-top: 0;
    text-align: center;
}

.tpr-completion-title {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 6px;
}

.tpr-completion-subtitle {
    font-size: 15px;
    font-weight: 500;
    opacity: 0.9;
}

.tpr-progress-info {
    flex: 1;
    position: relative;
    z-index: 1;
}

.tpr-progress-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 8px;
    opacity: 0.9;
    color: white;
}

.tpr-progress-bar-container {
    width: 100%;
    max-width: 400px;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    overflow: hidden;
}

.tpr-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #22c55e, #10b981);
    border-radius: 6px;
    transition: width 0.5s ease;
    width: 0%;
}

.tpr-progress-stats {
    display: flex;
    gap: 24px;
    align-items: center;
    position: relative;
    z-index: 1;
}

.tpr-stat-item {
    text-align: center;
}

.tpr-stat-number {
    font-size: 22px;
    font-weight: 700;
    display: block;
    color: white;
}

.tpr-stat-label {
    font-size: 12px;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: white;
}

.tpr-encouragement {
    font-size: 13px;
    margin-top: 6px;
    opacity: 0.9;
    font-weight: 500;
    color: white;
}

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

.tpr-pronunciation-content {
    padding: 35px;
}

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

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

.tpr-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); }
}

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

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