/* ===========================
   SpeakDaily - Main Styles
   딥 블루 테마 + 모바일 최적화
   =========================== */

:root {
    --primary-deep-blue: #1e3a8a;
    --primary-blue: #3b82f6;
    --light-blue: #60a5fa;
    --pale-blue: #dbeafe;
    --white: #ffffff;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-600: #4b5563;
    --gray-800: #1f2937;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --fire: #ff6b35;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--pale-blue) 100%);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ===========================
   Layout
   =========================== */

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
    min-height: 100vh;
}

.header {
    background: linear-gradient(135deg, var(--primary-deep-blue) 0%, var(--primary-blue) 100%);
    color: var(--white);
    padding: 1.5rem 1rem;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
}

.logo-icon {
    font-size: 2rem;
}

.streak-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    backdrop-filter: blur(10px);
}

.fire-icon {
    font-size: 1.5rem;
    animation: flicker 1.5s infinite;
}

@keyframes flicker {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ===========================
   Navigation
   =========================== */

.nav-tabs {
    display: flex;
    background: var(--white);
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.nav-tab {
    flex: 1;
    min-width: 100px;
    padding: 1rem;
    border: none;
    background: transparent;
    color: var(--gray-600);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.nav-tab:hover {
    background: var(--gray-50);
    color: var(--primary-blue);
}

.nav-tab.active {
    color: var(--primary-blue);
    border-bottom-color: var(--primary-blue);
    background: var(--pale-blue);
}

.nav-tab i {
    font-size: 1.25rem;
}

/* ===========================
   Main Content
   =========================== */

.content {
    padding: 1.5rem 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

.section-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-deep-blue);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.section-subtitle {
    font-size: 1rem;
    color: var(--gray-600);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

/* ===========================
   Cards
   =========================== */

.card {
    background: var(--white);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    margin-bottom: 1.5rem;
    transition: transform 0.3s, box-shadow 0.3s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--gray-100);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-deep-blue);
}

.card-badge {
    background: var(--primary-blue);
    color: var(--white);
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.875rem;
    font-weight: 600;
}

/* ===========================
   Sentence Card
   =========================== */

.sentence-card {
    background: var(--white);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-md);
    border-left: 4px solid var(--primary-blue);
}

.sentence-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.sentence-number {
    background: var(--primary-deep-blue);
    color: var(--white);
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.875rem;
}

.sentence-actions {
    display: flex;
    gap: 0.5rem;
}

.sentence-text {
    font-size: 1.125rem;
    line-height: 1.8;
    margin-bottom: 0.75rem;
    color: var(--gray-800);
    font-weight: 500;
    min-height: 60px;
}

.sentence-text.hidden {
    filter: blur(10px);
    user-select: none;
}

.sentence-translation {
    font-size: 1rem;
    color: var(--gray-600);
    margin-bottom: 1rem;
    line-height: 1.6;
}

.sentence-tip {
    background: var(--pale-blue);
    border-left: 3px solid var(--primary-blue);
    padding: 0.75rem;
    border-radius: 6px;
    font-size: 0.875rem;
    color: var(--gray-700);
    margin-top: 1rem;
}

.sentence-tip-title {
    font-weight: 600;
    color: var(--primary-deep-blue);
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ===========================
   Buttons
   =========================== */

button {
    font-family: 'Noto Sans KR', sans-serif;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-width: 44px;
    min-height: 44px;
}

.btn-primary {
    background: var(--primary-blue);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-deep-blue);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-800);
}

.btn-secondary:hover {
    background: var(--gray-300);
}

.btn-success {
    background: var(--success);
    color: var(--white);
}

.btn-success:hover {
    background: #059669;
}

.btn-warning {
    background: var(--warning);
    color: var(--white);
}

.btn-warning:hover {
    background: #d97706;
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-icon {
    padding: 0.5rem;
    border-radius: 50%;
    width: 44px;
    height: 44px;
}

.btn-group {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

/* ===========================
   Recording Controls
   =========================== */

.recording-section {
    background: var(--gray-50);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
}

.recording-controls {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.recording-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--danger);
    font-weight: 600;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.audio-player {
    width: 100%;
    margin-top: 0.75rem;
    border-radius: 8px;
}

/* ===========================
   Difficulty Selector
   =========================== */

.difficulty-selector {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.difficulty-btn {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid var(--gray-300);
    background: var(--white);
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.difficulty-btn.easy {
    border-color: var(--success);
    color: var(--success);
}

.difficulty-btn.easy:hover,
.difficulty-btn.easy.selected {
    background: var(--success);
    color: var(--white);
}

.difficulty-btn.medium {
    border-color: var(--warning);
    color: var(--warning);
}

.difficulty-btn.medium:hover,
.difficulty-btn.medium.selected {
    background: var(--warning);
    color: var(--white);
}

.difficulty-btn.hard {
    border-color: var(--danger);
    color: var(--danger);
}

.difficulty-btn.hard:hover,
.difficulty-btn.hard.selected {
    background: var(--danger);
    color: var(--white);
}

/* ===========================
   Dashboard Stats
   =========================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    text-align: center;
}

.stat-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-blue);
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--gray-600);
    font-weight: 500;
}

/* ===========================
   Calendar Heatmap
   =========================== */

.calendar-container {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    overflow-x: auto;
}

.calendar-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-deep-blue);
    margin-bottom: 1rem;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 1rem;
}

.calendar-day-label {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-600);
    padding: 0.25rem;
}

.calendar-cell {
    aspect-ratio: 1;
    border-radius: 4px;
    background: var(--gray-100);
    transition: all 0.3s;
    cursor: pointer;
    position: relative;
    min-width: 32px;
}

.calendar-cell:hover {
    transform: scale(1.1);
}

.calendar-cell.level-0 {
    background: var(--gray-100);
}

.calendar-cell.level-1 {
    background: #c7e0ff;
}

.calendar-cell.level-2 {
    background: #83b4ff;
}

.calendar-cell.level-3 {
    background: #3b82f6;
}

.calendar-cell.level-4 {
    background: var(--primary-deep-blue);
}

.calendar-legend {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--gray-600);
    margin-top: 1rem;
}

.legend-box {
    width: 16px;
    height: 16px;
    border-radius: 3px;
}

/* ===========================
   Toggle Switch
   =========================== */

.toggle-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1rem 0;
}

.toggle-switch {
    position: relative;
    width: 56px;
    height: 28px;
    background: var(--gray-300);
    border-radius: 50px;
    cursor: pointer;
    transition: background 0.3s;
}

.toggle-switch.active {
    background: var(--primary-blue);
}

.toggle-slider {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    background: var(--white);
    border-radius: 50%;
    transition: transform 0.3s;
}

.toggle-switch.active .toggle-slider {
    transform: translateX(28px);
}

.toggle-label {
    font-weight: 500;
    color: var(--gray-700);
}

/* ===========================
   Progress Bar
   =========================== */

.progress-container {
    margin: 1.5rem 0;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
}

.progress-bar-bg {
    height: 12px;
    background: var(--gray-200);
    border-radius: 50px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-blue), var(--light-blue));
    border-radius: 50px;
    transition: width 0.5s ease;
}

/* ===========================
   Empty State
   =========================== */

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--gray-600);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.empty-state-text {
    font-size: 1rem;
}

/* ===========================
   Loading State
   =========================== */

.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 3rem;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--primary-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ===========================
   Responsive Design
   =========================== */

@media (max-width: 768px) {
    .header-content {
        flex-direction: row;
    }
    
    .logo {
        font-size: 1.25rem;
    }
    
    .logo-icon {
        font-size: 1.75rem;
    }
    
    .streak-display {
        font-size: 1rem;
        padding: 0.5rem 0.75rem;
    }
    
    .nav-tab {
        min-width: 80px;
        padding: 0.875rem 0.5rem;
        font-size: 0.875rem;
    }
    
    .content {
        padding: 1rem 0.75rem;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    .card {
        padding: 1.25rem;
    }
    
    .sentence-text {
        font-size: 1rem;
    }
    
    .btn-group {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .calendar-grid {
        gap: 3px;
    }
    
    .calendar-cell {
        min-width: 28px;
    }
}

@media (max-width: 480px) {
    .logo-text {
        display: none;
    }
    
    .section-title {
        font-size: 1.25rem;
    }
    
    .sentence-card {
        padding: 1rem;
    }
    
    .difficulty-selector {
        flex-direction: column;
    }
}

/* ===========================
   Accessibility
   =========================== */

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

button:focus,
.btn:focus {
    outline: 3px solid var(--light-blue);
    outline-offset: 2px;
}

/* ===========================
   Animations
   =========================== */

.fade-in {
    animation: fadeIn 0.5s ease-in;
}

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

.slide-in {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

/* ===========================
   Utility Classes
   =========================== */

.text-center {
    text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.flex {
    display: flex;
}

.flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

.hidden {
    display: none;
}
