@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --bg-base: #0f172a;
  --bg-surface: #1e293b;
  --bg-surface-hover: #334155;
  --bg-glass: rgba(30, 41, 59, 0.7);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-primary: #3b82f6;
  --accent-hover: #2563eb;
  --accent-glow: rgba(59, 130, 246, 0.4);
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.4);
  --error: #ef4444;
  --warning: #f59e0b;
  --border-color: rgba(255, 255, 255, 0.1);
  --border-radius-sm: 8px;
  --border-radius-md: 16px;
  --border-radius-lg: 24px;
  --border-radius-full: 9999px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-glow: 0 0 15px var(--accent-glow);
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; padding: 0; margin: 0; }
html, body { max-width: 100vw; min-height: 100vh; overflow-x: hidden; background-color: var(--bg-base); color: var(--text-primary); font-family: 'Inter', sans-serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
a { color: inherit; text-decoration: none; }

.main-content { padding: 2rem; max-width: 1200px; margin: 0 auto; }
.glass-panel { background: var(--bg-glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid var(--border-color); border-radius: var(--border-radius-md); box-shadow: var(--shadow-md); }
.glass-panel:hover { box-shadow: var(--shadow-lg); border-color: rgba(255, 255, 255, 0.2); }

.btn { display: inline-flex; align-items: center; justify-content: center; padding: 0.75rem 1.5rem; font-size: 1rem; font-weight: 500; border-radius: var(--border-radius-sm); border: none; cursor: pointer; transition: all var(--transition-fast); }
.btn-primary { background-color: var(--accent-primary); color: white; box-shadow: var(--shadow-md); }
.btn-primary:hover { background-color: var(--accent-hover); box-shadow: var(--shadow-glow); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.text-gradient { background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
h1, h2, h3, h4, h5, h6 { font-weight: 700; line-height: 1.2; margin-bottom: 0.5em; }
h1 { font-size: 2.5rem; } h2 { font-size: 2rem; } h3 { font-size: 1.5rem; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--bg-surface-hover); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

.form-group { margin-bottom: 1.5rem; display: flex; flex-direction: column; }
label { margin-bottom: 0.5rem; font-size: 0.9rem; font-weight: 500; color: var(--text-secondary); }
input[type="text"], input[type="email"], input[type="password"], input[type="url"], input[type="number"], textarea { width: 100%; padding: 0.75rem 1rem; background-color: rgba(0, 0, 0, 0.2); border: 1px solid var(--border-color); border-radius: var(--border-radius-sm); color: var(--text-primary); font-family: inherit; font-size: 1rem; transition: border-color var(--transition-fast), box-shadow var(--transition-fast); }
input:focus, textarea:focus { outline: none; border-color: var(--accent-primary); box-shadow: 0 0 0 2px var(--accent-glow); }
input::placeholder, textarea::placeholder { color: var(--text-muted); }

.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.7); display: flex; align-items: center; justify-content: center; z-index: 1000; backdrop-filter: blur(4px); }
.modal-content { width: 90%; max-width: 600px; padding: 2rem; position: relative; max-height: 90vh; overflow-y: auto; }
.modal-header { display: flex; justify-content: space-between; align-items: center; }

.flex-row-mobile-col { display: flex; flex-direction: row; gap: 1rem; }
.exercise-list-item { display: flex; justify-content: space-between; align-items: center; padding: 1rem; background: rgba(255,255,255,0.05); border-radius: var(--border-radius-md); gap: 1rem; }
.exercise-list-info { display: flex; gap: 1.5rem; align-items: center; flex: 1; }
.exercise-list-actions { display: flex; gap: 0.5rem; }

@media (max-width: 768px) {
  .flex-row-mobile-col { flex-direction: column; gap: 0.5rem; }
  .exercise-list-item { flex-direction: column; align-items: stretch; }
  .exercise-list-info { flex-direction: column; text-align: center; gap: 0.5rem; }
  .exercise-list-actions { justify-content: center; margin-top: 0.5rem; }
}

.nav-container { display: flex; justify-content: space-between; align-items: center; padding: 1rem 2rem; margin: 1rem 2rem; position: sticky; top: 1rem; z-index: 100; }
.nav-brand { font-size: 1.25rem; font-weight: 700; }
.nav-links { display: flex; align-items: center; gap: 1.5rem; list-style: none; flex: 1; justify-content: flex-end; }
.nav-menu { display: flex; gap: 0.5rem; margin-right: auto; margin-left: 2rem; }
.nav-link { color: var(--text-secondary); font-weight: 500; padding: 0.5rem 1rem; border-radius: var(--border-radius-sm); transition: all var(--transition-fast); }
.nav-link:hover { color: var(--text-primary); background: rgba(255, 255, 255, 0.05); }
.nav-link.active { color: var(--accent-primary); background: var(--accent-glow); }

@media (max-width: 768px) {
  .nav-container { flex-direction: column; padding: 1rem; margin: 1rem; gap: 1rem; }
  .nav-links { flex-wrap: wrap; justify-content: center; gap: 0.5rem; width: 100%; }
  .nav-menu { flex-wrap: wrap; justify-content: center; margin: 0; }
  .nav-menu-right { flex-wrap: wrap; justify-content: center; margin: 0; }
  .nav-divider { display: none; }
}

/* Tracker Matrix Styles */
.tracker-wrapper { max-width: 1000px; margin: 0 auto; }
.progress-container { margin-bottom: 2rem; }
.progress-bar-bg { height: 12px; background: var(--bg-surface-hover); border-radius: var(--border-radius-full); overflow: hidden; margin-bottom: 0.75rem; box-shadow: inset 0 2px 4px rgba(0,0,0,0.2); }
.progress-bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent-primary), var(--success)); transition: width 0.5s ease-in-out; }
.progress-text { text-align: center; font-weight: 500; color: var(--text-secondary); }

.matrix-container { padding: 1rem; overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none; }
.matrix-container::-webkit-scrollbar { display: none; }
.matrix-header { display: flex; margin-bottom: 1rem; border-bottom: 1px solid var(--border-color); padding-bottom: 1rem; }
.matrix-row { display: flex; align-items: center; margin-bottom: 0.5rem; border-bottom: 1px solid rgba(255, 255, 255, 0.05); padding-bottom: 0.5rem; }
.matrix-row:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.matrix-cell { flex: 1; display: flex; justify-content: center; min-width: 60px; }
.empty-cell { flex: 2; min-width: 150px; justify-content: flex-start; }
.exercise-name { flex: 2; min-width: 150px; justify-content: flex-start; font-weight: 600; color: var(--text-primary); align-items: center; cursor: pointer; transition: color 0.2s; }
.exercise-name:hover { color: var(--accent-primary); text-decoration: underline; }
.day-header { flex-direction: column; align-items: center; }
.day-name { font-size: 0.9rem; color: var(--text-secondary); font-weight: 500; }
.day-date { font-size: 1.2rem; font-weight: 700; }
.day-header.today { color: var(--accent-primary); }
.day-header.today .day-name, .day-header.today .day-date { color: var(--accent-primary); }

.checkbox-cell { cursor: pointer; align-items: center; }
.check-circle { width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--border-color); background: rgba(0,0,0,0.2); display: flex; align-items: center; justify-content: center; transition: all var(--transition-fast); color: white; }
.check-circle:hover { transform: scale(1.1); border-color: var(--accent-glow); }
.check-circle svg { width: 20px; height: 20px; animation: checkAnim 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; }
.check-circle.completed { background: var(--success); border-color: var(--success); box-shadow: 0 0 10px var(--success-glow); }

@keyframes checkAnim { 0% { transform: scale(0); } 100% { transform: scale(1); } }

@media (max-width: 768px) {
  .matrix-container { padding-left: 1rem; padding-right: 1rem; }
  .empty-cell, .exercise-name { width: 110px; min-width: 110px; max-width: 110px; flex: 0 0 110px; padding-left: 0; padding-right: 0.5rem; }
  .matrix-header { margin-bottom: 0.5rem; padding-left: 0; }
  .matrix-cell { min-width: 45px; flex-shrink: 0; }
  .exercise-name { font-size: 0.9rem; border-radius: 0 8px 8px 0; }
  .check-circle { width: 30px; height: 30px; }
  .check-circle svg { width: 16px; height: 16px; }
  .day-name { font-size: 0.8rem; }
  .day-date { font-size: 1rem; }
}

/* Exercises Library Grid */
.exercises-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1.5rem; }
.exercise-card { overflow: hidden; display: flex; flex-direction: column; }
.video-wrapper { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; background: #000; }
.video-wrapper iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
.exercise-card-content { padding: 1.25rem; flex-grow: 1; }
.exercise-card-content h4 { margin-bottom: 0.5rem; font-size: 1.1rem; }
.exercise-card-content p { color: var(--text-secondary); font-size: 0.9rem; line-height: 1.5; }

/* Stats specific */
.stats-container { max-width: 1000px; margin: 0 auto; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.5rem; }
.stat-card { padding: 2rem; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.stat-icon { font-size: 3rem; margin-bottom: 1rem; }
.stat-value { font-size: 3rem; font-weight: 800; line-height: 1; margin-bottom: 0.5rem; color: var(--text-primary); }
.stat-label { font-size: 1.1rem; color: var(--text-secondary); font-weight: 500; }
.streak-card .stat-value { color: var(--warning); }
.total-card .stat-value { color: var(--success); }
.history-list { display: flex; flex-direction: column; gap: 0.75rem; }
.history-item { display: flex; justify-content: space-between; align-items: center; padding: 1rem; background: rgba(255,255,255,0.05); border-radius: var(--border-radius-sm); border-left: 4px solid var(--accent-primary); overflow: hidden; }
.history-badge { background: var(--bg-surface-hover); padding: 0.25rem 0.75rem; border-radius: 9999px; font-size: 0.85rem; font-weight: 500; }

/* Tabs */
.tabs-container { display: flex; background: rgba(255, 255, 255, 0.05); border-radius: var(--border-radius-md); padding: 0.25rem; margin-bottom: 2rem; }
.tab-btn { flex: 1; padding: 0.75rem 1rem; border: none; background: transparent; color: var(--text-muted); font-weight: 600; font-size: 1rem; cursor: pointer; border-radius: calc(var(--border-radius-md) - 0.25rem); transition: all 0.3s ease; text-align: center; }
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { background: var(--bg-surface); color: var(--text-primary); box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); }
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
