/**
 * KoçPro - Modern Öğrenci Koçluk Sistemi
 * Ana Stil Dosyası
 */

/* ================================
   CSS VARIABLES & RESET
================================ */
:root {
    /* Ana renkler */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --primary-bg: rgba(99, 102, 241, 0.1);
    
    /* Accent renkler */
    --accent: #06b6d4;
    --accent-dark: #0891b2;
    
    /* Başarı / Hata / Uyarı */
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    --info: #3b82f6;
    --info-bg: rgba(59, 130, 246, 0.1);
    
    /* Nötr renkler */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    /* Arka plan & metin */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-card: rgba(30, 41, 59, 0.8);
    --bg-glass: rgba(255, 255, 255, 0.05);
    
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    /* Efektler */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.3);
    
    --border-radius: 12px;
    --border-radius-lg: 16px;
    --border-radius-xl: 24px;
    
    /* Geçişler */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    
    /* Gradient */
    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #06b6d4 100%);
    --gradient-dark: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    --gradient-card: linear-gradient(145deg, rgba(30, 41, 59, 0.9) 0%, rgba(15, 23, 42, 0.9) 100%);
}

/* Light mode (isteğe bağlı)
[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #475569;
}
*/

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Animated background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 80%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(6, 182, 212, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(139, 92, 246, 0.1) 0%, transparent 40%);
    pointer-events: none;
    z-index: -1;
}

/* ================================
   TYPOGRAPHY
================================ */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-primary);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.1rem; }
h6 { font-size: 1rem; }

p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

a {
    color: var(--primary-light);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary);
}

/* ================================
   LAYOUT COMPONENTS
================================ */
.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.page-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    min-height: 100vh;
    background: var(--gradient-card);
    backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1.5rem;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: transform var(--transition-normal);
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 1.5rem;
}

.sidebar-logo {
    width: 48px;
    height: 48px;
    background: var(--gradient-primary);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: var(--shadow-glow);
}

.sidebar-brand {
    font-size: 1.5rem;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-section {
    margin-bottom: 1.5rem;
}

.nav-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    padding: 0 0.75rem;
    margin-bottom: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    font-weight: 500;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.nav-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--gradient-primary);
    transform: scaleY(0);
    transition: transform var(--transition-fast);
}

.nav-link:hover {
    background: var(--bg-glass);
    color: var(--text-primary);
}

.nav-link.active {
    background: var(--primary-bg);
    color: var(--primary-light);
}

.nav-link.active::before {
    transform: scaleY(1);
}

.nav-link i {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-badge {
    margin-left: auto;
    background: var(--danger);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    min-width: 20px;
    text-align: center;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 2rem;
    min-height: 100vh;
}

/* Top Bar */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.topbar-left h1 {
    font-size: 1.75rem;
    margin-bottom: 0.25rem;
}

.topbar-left p {
    color: var(--text-muted);
    margin: 0;
    font-size: 0.9rem;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* ================================
   CARDS
================================ */
.card {
    background: var(--gradient-card);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    transition: all var(--transition-normal);
}

.card:hover {
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.card-icon.primary { background: var(--primary-bg); color: var(--primary); }
.card-icon.success { background: var(--success-bg); color: var(--success); }
.card-icon.warning { background: var(--warning-bg); color: var(--warning); }
.card-icon.danger { background: var(--danger-bg); color: var(--danger); }
.card-icon.info { background: var(--info-bg); color: var(--info); }

/* Stat Cards */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--gradient-card);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0.25rem;
}

.stat-change {
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.stat-change.positive { color: var(--success); }
.stat-change.negative { color: var(--danger); }

/* ================================
   STUDY TIMER (Ana Özellik)
================================ */
.timer-container {
    background: var(--gradient-card);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-xl);
    padding: 2.5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.timer-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(
        from 0deg,
        transparent 0deg 90deg,
        rgba(99, 102, 241, 0.1) 90deg 180deg,
        transparent 180deg 270deg,
        rgba(6, 182, 212, 0.1) 270deg 360deg
    );
    animation: timerRotate 20s linear infinite;
    pointer-events: none;
}

@keyframes timerRotate {
    100% { transform: rotate(360deg); }
}

.timer-display {
    position: relative;
    z-index: 1;
}

.timer-ring {
    width: 280px;
    height: 280px;
    margin: 0 auto 2rem;
    position: relative;
}

.timer-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.timer-ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 8;
}

.timer-ring-progress {
    fill: none;
    stroke: url(#timerGradient);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 880;
    stroke-dashoffset: 880;
    transition: stroke-dashoffset 1s ease;
}

.timer-time {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.timer-digits {
    font-size: 3.5rem;
    font-weight: 800;
    font-family: 'JetBrains Mono', monospace;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -2px;
}

.timer-status {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.timer-status.active {
    color: var(--success);
}

.timer-subject {
    margin-bottom: 1.5rem;
}

.timer-subject-select {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.subject-chip {
    padding: 0.5rem 1rem;
    border-radius: 999px;
    background: var(--bg-glass);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.875rem;
}

.subject-chip:hover {
    border-color: var(--primary);
    color: var(--primary-light);
}

.subject-chip.active {
    background: var(--primary-bg);
    border-color: var(--primary);
    color: var(--primary-light);
}

.timer-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    position: relative;
    z-index: 1;
}

/* ================================
   BUTTONS
================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.btn-secondary {
    background: var(--bg-glass);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

.btn-success {
    background: var(--success);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

.btn-success:hover:not(:disabled) {
    background: #0d9668;
    transform: translateY(-2px);
}

.btn-danger {
    background: var(--danger);
    color: white;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
    transform: translateY(-2px);
}

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

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--bg-glass);
    color: var(--text-primary);
}

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

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1rem;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
}

.btn-play {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    font-size: 1.5rem;
}

/* ================================
   FORMS
================================ */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.form-input {
    width: 100%;
    padding: 0.875rem 1rem;
    background: var(--bg-glass);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all var(--transition-fast);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6,9 12,15 18,9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 16px;
    padding-right: 2.5rem;
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
}

.form-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.form-error {
    font-size: 0.8rem;
    color: var(--danger);
    margin-top: 0.5rem;
}

/* ================================
   TABLES
================================ */
.table-container {
    overflow-x: auto;
    border-radius: var(--border-radius);
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.table th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--bg-glass);
}

.table tbody tr {
    transition: background var(--transition-fast);
}

.table tbody tr:hover {
    background: var(--bg-glass);
}

/* ================================
   BADGES & TAGS
================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 999px;
}

.badge-primary { background: var(--primary-bg); color: var(--primary-light); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }

/* ================================
   PROGRESS BARS
================================ */
.progress {
    height: 8px;
    background: var(--bg-glass);
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 999px;
    transition: width var(--transition-normal);
}

.progress-bar.success { background: var(--success); }
.progress-bar.warning { background: var(--warning); }
.progress-bar.danger { background: var(--danger); }

/* ================================
   CHARTS PLACEHOLDER
================================ */
.chart-container {
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-glass);
    border-radius: var(--border-radius);
}

/* ================================
   LEADERBOARD
================================ */
.leaderboard {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-glass);
    border-radius: var(--border-radius);
    transition: all var(--transition-fast);
}

.leaderboard-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.leaderboard-item.current-user {
    border: 1px solid var(--primary);
    background: var(--primary-bg);
}

.leaderboard-rank {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    background: var(--bg-tertiary);
}

.leaderboard-rank.gold { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #78350f; }
.leaderboard-rank.silver { background: linear-gradient(135deg, #e5e7eb, #9ca3af); color: #374151; }
.leaderboard-rank.bronze { background: linear-gradient(135deg, #f59e0b, #d97706); color: #78350f; }

.leaderboard-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.leaderboard-info {
    flex: 1;
}

.leaderboard-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.leaderboard-stats {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.leaderboard-time {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary-light);
}

/* ================================
   ALERTS & NOTIFICATIONS
================================ */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
}

.alert-icon {
    flex-shrink: 0;
    font-size: 1.25rem;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.alert-message {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.alert-success { background: var(--success-bg); border-left: 4px solid var(--success); }
.alert-warning { background: var(--warning-bg); border-left: 4px solid var(--warning); }
.alert-danger { background: var(--danger-bg); border-left: 4px solid var(--danger); }
.alert-info { background: var(--info-bg); border-left: 4px solid var(--info); }

/* Toast notifications */
.toast-container {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-xl);
    animation: slideIn 0.3s ease;
    min-width: 300px;
}

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

/* ================================
   MODALS
================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: auto;
    transform: scale(0.9);
    transition: transform var(--transition-normal);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--bg-glass);
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    padding: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* ================================
   AVATAR
================================ */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-primary);
    color: white;
    font-weight: 600;
    font-size: 1rem;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-sm { width: 32px; height: 32px; font-size: 0.8rem; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.25rem; }
.avatar-xl { width: 80px; height: 80px; font-size: 1.75rem; }

/* ================================
   STREAK & GAMIFICATION
================================ */
.streak-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.2), rgba(245, 158, 11, 0.2));
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-radius: 999px;
    color: #fbbf24;
    font-weight: 600;
}

.streak-display i {
    animation: flame 1s ease-in-out infinite;
}

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

.badge-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 1rem;
}

.badge-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1rem;
    background: var(--bg-glass);
    border-radius: var(--border-radius);
    transition: all var(--transition-fast);
}

.badge-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.badge-item.locked {
    opacity: 0.4;
    filter: grayscale(1);
}

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

.badge-name {
    font-size: 0.8rem;
    font-weight: 500;
}

/* ================================
   RESPONSIVE
================================ */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .stat-grid {
        grid-template-columns: 1fr;
    }
    
    .timer-digits {
        font-size: 2.5rem;
    }
    
    .timer-ring {
        width: 220px;
        height: 220px;
    }
    
    .topbar {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .topbar-right {
        width: 100%;
        justify-content: flex-end;
    }
}

/* ================================
   UTILITIES
================================ */
.text-primary { color: var(--primary-light) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }
.text-muted { color: var(--text-muted) !important; }

.bg-primary { background: var(--primary-bg) !important; }
.bg-success { background: var(--success-bg) !important; }
.bg-warning { background: var(--warning-bg) !important; }
.bg-danger { background: var(--danger-bg) !important; }

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

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

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.hidden { display: none !important; }
.opacity-50 { opacity: 0.5; }

/* Loading spinner */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Skeleton loader */
.skeleton {
    background: linear-gradient(90deg, var(--bg-glass) 25%, rgba(255, 255, 255, 0.08) 50%, var(--bg-glass) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--border-radius);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ================================
   DASHBOARD STYLES
================================ */

/* Page Header */
.page-header {
    margin-bottom: 2rem;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-title {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.greeting {
    font-size: 1.75rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.date-info {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 400;
}

.streak-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: linear-gradient(135deg, #f97316 0%, #fb923c 100%);
    border-radius: 50px;
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(249, 115, 22, 0.4);
}

.streak-badge i {
    width: 20px;
    height: 20px;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1.5rem;
}

.dashboard-grid .card-timer {
    grid-column: span 5;
}

.dashboard-grid .card-stats {
    grid-column: span 7;
}

.dashboard-grid .card-chart {
    grid-column: span 8;
}

.dashboard-grid .card-distribution {
    grid-column: span 4;
}

.dashboard-grid .card-goals {
    grid-column: span 6;
}

.dashboard-grid .card-achievements {
    grid-column: span 6;
}

.dashboard-grid .card-coach {
    grid-column: span 6;
}

.dashboard-grid .card-group {
    grid-column: span 6;
}

@media (max-width: 1200px) {
    .dashboard-grid .card-timer,
    .dashboard-grid .card-stats,
    .dashboard-grid .card-chart,
    .dashboard-grid .card-distribution,
    .dashboard-grid .card-goals,
    .dashboard-grid .card-achievements,
    .dashboard-grid .card-coach,
    .dashboard-grid .card-group {
        grid-column: span 6;
    }
}

@media (max-width: 768px) {
    .dashboard-grid .card-timer,
    .dashboard-grid .card-stats,
    .dashboard-grid .card-chart,
    .dashboard-grid .card-distribution,
    .dashboard-grid .card-goals,
    .dashboard-grid .card-achievements,
    .dashboard-grid .card-coach,
    .dashboard-grid .card-group {
        grid-column: span 12;
    }
}

/* Timer Card */
.card-timer {
    padding: 2rem;
    text-align: center;
}

.timer-display {
    margin-bottom: 2rem;
}

.timer-circle {
    position: relative;
    width: 220px;
    height: 220px;
    margin: 0 auto;
}

.timer-ring {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.timer-ring-bg {
    fill: none;
    stroke: var(--bg-tertiary);
    stroke-width: 8;
}

.timer-ring-progress {
    fill: none;
    stroke: url(#timerGradient);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 565.48;
    stroke-dashoffset: 565.48;
    transition: stroke-dashoffset 0.3s ease;
}

.timer-circle.active .timer-ring-progress {
    stroke: var(--success);
    animation: pulse-ring 2s ease-in-out infinite;
}

.timer-circle.paused .timer-ring-progress {
    stroke: var(--warning);
}

@keyframes pulse-ring {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.timer-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.timer-time {
    font-family: 'JetBrains Mono', monospace;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -1px;
}

.timer-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    max-width: 150px;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

/* Timer Controls */
.timer-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.timer-start-form .form-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.timer-start-form .form-select {
    flex: 1;
}

.timer-active-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.btn-glow {
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
    transition: all var(--transition-normal);
}

.btn-glow:hover {
    box-shadow: 0 6px 30px rgba(99, 102, 241, 0.6);
    transform: translateY(-2px);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

.stat-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-glass);
    border-radius: var(--border-radius);
    position: relative;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon i {
    width: 24px;
    height: 24px;
}

.stat-icon.blue {
    background: var(--info-bg);
    color: var(--info);
}

.stat-icon.green {
    background: var(--success-bg);
    color: var(--success);
}

.stat-icon.orange {
    background: var(--warning-bg);
    color: var(--warning);
}

.stat-icon.purple {
    background: var(--primary-bg);
    color: var(--primary);
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.stat-progress {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stat-progress .progress-bar {
    width: 60px;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
}

.stat-progress .progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 2px;
    transition: width var(--transition-normal);
}

.stat-progress .progress-text {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Chart Container */
.chart-container {
    height: 250px;
    padding: 1rem 0;
}

/* Distribution */
.distribution-content {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.distribution-chart {
    width: 150px;
    height: 150px;
    flex-shrink: 0;
}

.distribution-legend {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

.legend-label {
    flex: 1;
    color: var(--text-secondary);
}

.legend-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Goals List */
.goals-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.goal-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-glass);
    border-radius: var(--border-radius);
    position: relative;
    transition: all var(--transition-fast);
}

.goal-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.goal-item.completed {
    border-left: 3px solid var(--success);
}

.goal-info {
    flex: 1;
    min-width: 0;
}

.goal-name {
    display: block;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.goal-progress-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

.goal-progress-bar {
    width: 100px;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
}

.goal-progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    transition: width var(--transition-normal);
}

.goal-item.completed .goal-progress-fill {
    background: var(--success);
}

.goal-check {
    color: var(--success);
    width: 20px;
    height: 20px;
}

/* Achievements */
.achievements-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.streak-display {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.25rem;
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.1) 0%, rgba(251, 146, 60, 0.05) 100%);
    border-radius: var(--border-radius);
    border: 1px solid rgba(249, 115, 22, 0.2);
}

.streak-flame {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(249, 115, 22, 0.2);
    border-radius: 50%;
    color: var(--gray-500);
}

.streak-flame i {
    width: 28px;
    height: 28px;
}

.streak-flame.active {
    color: #f97316;
    animation: flame-pulse 1.5s ease-in-out infinite;
}

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

.streak-info {
    flex: 1;
}

.streak-current {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.streak-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.streak-best {
    text-align: center;
    padding: 0.5rem 1rem;
    background: var(--bg-glass);
    border-radius: var(--border-radius);
}

.streak-best-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
}

.streak-best-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badges-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.badge-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-glass);
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: default;
    transition: all var(--transition-fast);
}

.badge-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.badge-icon {
    font-size: 1.1rem;
}

.badge-name {
    color: var(--text-secondary);
}

/* Coach Card */
.coach-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.coach-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.1rem;
    color: white;
    flex-shrink: 0;
}

.coach-details {
    flex: 1;
    min-width: 0;
}

.coach-name {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
}

.coach-email {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Group Card */
.group-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.group-name {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.group-members {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
}

.empty-state i {
    width: 48px;
    height: 48px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state.small {
    padding: 1rem;
}

.empty-state.small i {
    width: 32px;
    height: 32px;
}

.empty-state p {
    margin-bottom: 1rem;
}

/* Glass Effect Enhancement */
.glass-effect {
    background: linear-gradient(
        145deg,
        rgba(255, 255, 255, 0.08) 0%,
        rgba(255, 255, 255, 0.02) 100%
    );
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Direct Modal Styles (for pages using .modal class directly) */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.modal.active {
    display: flex;
}

.modal .modal-content {
    background: var(--bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: auto;
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal .modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
}

.modal .modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal .modal-close:hover {
    color: var(--text-primary);
}

.modal form {
    padding: 1.5rem;
}

.modal .form-group {
    margin-bottom: 1rem;
}

.modal .form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.modal .form-group input,
.modal .form-group select,
.modal .form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: 1rem;
}

.modal .form-group input:focus,
.modal .form-group select:focus,
.modal .form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.modal .form-row {
    display: flex;
    gap: 1rem;
}

.modal .form-row .form-group {
    flex: 1;
}

.modal .modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 1rem;
}

@media (max-width: 576px) {
    .modal .form-row {
        flex-direction: column;
    }
    
    .modal .modal-actions {
        flex-direction: column;
    }
    
    .modal .modal-actions .btn {
        width: 100%;
    }
}
