/* =====================================================
   FORJA - GYM TRACKER APP
   Mobile-first, minimal design
   ===================================================== */

/* CSS Variables */
:root {
    --bg-dark: #0f0f0f;
    --bg-card: #1a1a1a;
    --accent-gold: #c8a96e;
    --accent-brown: #8b7355;
    --text-primary: #f0f0f0;
    --text-secondary: #888888;
    --success: #4caf50;
    --warning: #ff9800;
    --error: #f44336;
    --border-radius: 12px;
    --transition: 0.2s ease;
}

/* =====================================================
   RESET & BASE
   ===================================================== */

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    overflow-x: hidden;
    padding-bottom: 80px;
    touch-action: pan-y;
    -webkit-user-select: none;
    user-select: none;
}

/* =====================================================
   TYPOGRAPHY
   ===================================================== */

h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 12px;
}

h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 12px;
}

h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
}

h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

p {
    color: var(--text-secondary);
    margin-bottom: 8px;
}

a {
    color: var(--accent-gold);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: #d9b885;
}

/* =====================================================
   CONTAINERS
   ===================================================== */

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 16px;
    padding-bottom: 80px;
}

.content {
    padding-top: 16px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 16px;
    background-color: var(--bg-card);
    border-bottom: 1px solid rgba(200, 169, 110, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 16px;
}

.header h1 {
    margin: 0;
    flex: 1;
}

/* =====================================================
   CARDS
   ===================================================== */

.card {
    background-color: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 16px;
    border: 1px solid rgba(200, 169, 110, 0.05);
    transition: border-color var(--transition);
}

.card:hover {
    border-color: rgba(200, 169, 110, 0.15);
}

/* =====================================================
   BUTTONS
   ===================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: 'Inter', sans-serif;
    text-decoration: none;
    white-space: nowrap;
    touch-action: pan-y;
}

.btn-primary {
    background-color: var(--accent-gold);
    color: var(--bg-dark);
}

.btn-primary:hover,
.btn-primary:active {
    background-color: #d9b885;
    transform: scale(0.98);
}

.btn-secondary {
    background-color: rgba(200, 169, 110, 0.1);
    color: var(--accent-gold);
    border: 1px solid var(--accent-gold);
}

.btn-secondary:hover {
    background-color: rgba(200, 169, 110, 0.2);
}

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

.btn-success:hover {
    background-color: #45a049;
}

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

.btn-warning:hover {
    background-color: #e68900;
}

.btn-large {
    min-height: 56px;
    width: 100%;
    font-size: 18px;
    margin-top: 12px;
}

.btn-small {
    padding: 8px 12px;
    font-size: 14px;
    width: auto;
}

.btn-back {
    background: none;
    border: none;
    color: var(--accent-gold);
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
}

.logout-btn {
    font-size: 12px;
    padding: 8px 12px;
    background-color: rgba(244, 67, 54, 0.1);
    color: #f44336;
    border-radius: 6px;
    transition: background-color var(--transition);
}

.logout-btn:hover {
    background-color: rgba(244, 67, 54, 0.2);
}

/* =====================================================
   FORMS
   ===================================================== */

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px;
    background-color: rgba(240, 240, 240, 0.05);
    border: 1px solid rgba(200, 169, 110, 0.2);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    transition: border-color var(--transition);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-gold);
}

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

/* =====================================================
   AUTH PAGES
   ===================================================== */

.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 16px;
    background-color: var(--bg-dark);
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background-color: var(--bg-card);
    padding: 32px;
    border-radius: var(--border-radius);
    border: 1px solid rgba(200, 169, 110, 0.1);
}

.app-title {
    font-size: 32px;
    text-align: center;
    color: var(--accent-gold);
    margin-bottom: 8px;
}

.app-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 28px;
    font-size: 14px;
}

.auth-form {
    margin-bottom: 20px;
}

.auth-footer {
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--accent-gold);
}

/* =====================================================
   ALERTS
   ===================================================== */

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
    border-left: 4px solid;
}

.alert-error {
    background-color: rgba(244, 67, 54, 0.1);
    border-left-color: #f44336;
    color: #ff6b6b;
}

.alert-success {
    background-color: rgba(76, 175, 80, 0.1);
    border-left-color: var(--success);
    color: #66bb6a;
}

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

.day-indicator {
    margin-bottom: 20px;
}

.day-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.day-date {
    color: var(--accent-gold);
    font-weight: 600;
    font-size: 16px;
}

.routine-name {
    color: var(--accent-gold);
    margin-bottom: 16px;
}

.rest-day {
    text-align: center;
    padding: 32px 0;
    font-size: 18px;
    color: var(--accent-gold);
}

.btn-start-workout {
    font-size: 18px;
}

/* Weight Display */
.weight-display {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin: 20px 0;
}

.weight-number {
    font-size: 48px;
    font-weight: 700;
    color: var(--accent-gold);
}

.weight-unit {
    font-size: 24px;
    color: var(--text-secondary);
}

.progress-label {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 12px 0 8px 0;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background-color: rgba(200, 169, 110, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: var(--accent-gold);
    transition: width var(--transition);
}

/* Charts */
.chart {
    max-height: 300px;
    margin: 16px 0;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px;
    background-color: rgba(200, 169, 110, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(200, 169, 110, 0.1);
}

.stat-number {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent-gold);
    margin-bottom: 6px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
}

/* Routines Grid (Testing) */
.routines-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 12px;
}

.routine-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 12px;
    background-color: rgba(200, 169, 110, 0.08);
    border: 2px solid rgba(200, 169, 110, 0.2);
    border-radius: 10px;
    color: var(--text-primary);
    text-decoration: none;
    transition: all var(--transition);
    gap: 8px;
}

.routine-btn:hover,
.routine-btn:active {
    background-color: rgba(200, 169, 110, 0.15);
    border-color: var(--accent-gold);
    transform: scale(0.98);
}

.routine-day {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
}

.routine-title {
    font-size: 14px;
    color: var(--accent-gold);
    font-weight: 600;
    text-align: center;
    line-height: 1.2;
}

/* Sessions List */
.sessions-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.session-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background-color: rgba(200, 169, 110, 0.05);
    border-radius: 8px;
    border-left: 4px solid var(--accent-gold);
}

.session-info {
    flex: 1;
}

.session-routine {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.session-date {
    font-size: 12px;
    color: var(--text-secondary);
}

.session-stats {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--accent-gold);
    font-weight: 600;
}

/* Quick Links */
.quick-links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.quick-links .btn {
    margin: 0;
    font-size: 14px;
}

/* =====================================================
   WORKOUT SCREENS
   ===================================================== */

.workout-container {
    position: relative;
    width: 100%;
    background-color: var(--bg-dark);
    touch-action: pan-y;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition), visibility var(--transition);
    padding-bottom: 80px;
    touch-action: pan-y !important;
    pointer-events: none;
}

.screen.active {
    pointer-events: auto;
}

.screen.active {
    opacity: 1;
    visibility: visible;
    position: static;
    height: auto;
    min-height: 100vh;
    display: flex;
}

/* Warmup */
.warmup-content {
    text-align: center;
    width: 100%;
    max-width: 400px;
}

.warmup-content h1 {
    font-size: 32px;
    margin-bottom: 8px;
}

.warmup-description {
    color: var(--text-secondary);
    margin-bottom: 40px;
    font-size: 16px;
}

/* Timer Display */
.timer-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 40px 0;
}

.timer-number {
    font-size: 80px;
    font-weight: 700;
    color: var(--accent-gold);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.timer-label {
    color: var(--text-secondary);
    font-size: 16px;
    margin-top: 8px;
}

/* Workout Header */
.workout-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(200, 169, 110, 0.1);
    margin-bottom: 20px;
}

/* Exercise Screen */
.exercise-content {
    width: 100%;
    max-width: 500px;
}

.exercise-image {
      width: 100%;
      max-width: 300px;
      height: auto;
      max-height: 200px;
      object-fit: cover;
      border-radius: 8px;
      background-color: rgba(200, 169, 110, 0.1);
      margin: 20px 0;
      display: block;
      margin-left: auto;
      margin-right: auto;
  }

  /* Para videos */
  video.exercise-image {
      width: 100%;
      max-width: 300px;
      height: auto;
      max-height: 200px;
  }

#exercise-name {
    text-align: center;
    color: var(--accent-gold);
    font-size: 28px;
    margin-bottom: 12px;
}

.exercise-info {
    background-color: rgba(200, 169, 110, 0.05);
    padding: 16px;
    border-radius: 8px;
    margin: 20px 0;
}

.muscles-label {
    color: var(--accent-gold);
    font-weight: 600;
    margin-bottom: 8px;
}

.instructions {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

/* Set Counter */
.set-counter {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 20px 0;
    gap: 8px;
}

.set-number {
    font-size: 16px;
    color: var(--text-secondary);
}

.reps-number {
    font-size: 20px;
    font-weight: 700;
    color: var(--accent-gold);
}

/* Set Inputs */
.set-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 20px 0;
}

.input-group {
    display: flex;
    flex-direction: column;
}

.input-group label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.input-group input {
    padding: 10px;
    background-color: rgba(240, 240, 240, 0.05);
    border: 1px solid rgba(200, 169, 110, 0.2);
    border-radius: 6px;
    color: var(--text-primary);
    touch-action: pan-y;
    font-size: 16px;
}

/* Set Mode */
.set-mode,
.timer-mode,
.rest-mode {
    width: 100%;
}

.hidden {
    display: none !important;
}

/* Rest Mode */
.rest-mode h2 {
    text-align: center;
    color: var(--accent-gold);
    margin-bottom: 40px;
}

/* Cardio */
.cardio-content {
    text-align: center;
    width: 100%;
}

.cardio-type {
    color: var(--text-secondary);
    margin-bottom: 40px;
    font-size: 16px;
}

#cardio-controls,
#cardio-running {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

/* Summary */
.summary-content {
    text-align: center;
    width: 100%;
    max-width: 400px;
}

.summary-content h1 {
    color: var(--success);
    margin-bottom: 32px;
}

.summary-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 32px;
}

.summary-stats .stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.summary-stats .stat-label {
    color: var(--text-secondary);
    font-size: 12px;
    margin-bottom: 8px;
}

.summary-stats .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--accent-gold);
}

#notes-input {
    width: 100%;
    margin-bottom: 16px;
}

/* =====================================================
   PROGRESS PAGE
   ===================================================== */

.weight-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.weight-form > div {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.weight-form .form-group {
    margin-bottom: 0;
}

/* Records List */
.records-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.record-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background-color: rgba(200, 169, 110, 0.05);
    border-radius: 8px;
    border-left: 4px solid var(--accent-gold);
}

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

.record-value {
    color: var(--accent-gold);
    font-weight: 700;
    font-size: 16px;
}

/* =====================================================
   HISTORY PAGE
   ===================================================== */

.sessions-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.session-card {
    cursor: pointer;
    transition: transform var(--transition), border-color var(--transition);
}

.session-card:hover {
    transform: translateY(-2px);
    border-color: rgba(200, 169, 110, 0.3);
}

.session-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.session-link h3 {
    color: var(--accent-gold);
    margin-bottom: 6px;
}

.session-date {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.session-stats {
    display: flex;
    gap: 16px;
    font-size: 12px;
    margin-bottom: 8px;
}

.session-stats .stat {
    color: var(--text-secondary);
}

.session-notes {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(200, 169, 110, 0.1);
}

/* Session Detail */
.session-date-detail {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 20px;
}

.session-detail-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 20px 0;
    padding: 20px;
    background-color: rgba(200, 169, 110, 0.05);
    border-radius: 8px;
}

.session-detail-stats .stat-item {
    display: flex;
    flex-direction: column;
}

.session-detail-stats .stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.session-detail-stats .stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent-gold);
}

/* Exercises Detail */
.exercises-detail {
    margin: 20px 0;
}

.exercise-detail-group {
    background-color: rgba(200, 169, 110, 0.05);
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 12px;
}

.exercise-detail-group h4 {
    color: var(--accent-gold);
    margin-bottom: 12px;
}

.sets-detail {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.set-detail {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    background-color: rgba(240, 240, 240, 0.02);
    border-radius: 4px;
}

.set-label {
    font-size: 12px;
    color: var(--text-secondary);
}

.set-data {
    font-size: 14px;
    color: var(--accent-gold);
    font-weight: 600;
}

/* Notes Section */
.notes-section {
    margin-top: 20px;
    padding: 16px;
    background-color: rgba(200, 169, 110, 0.05);
    border-radius: 8px;
    border-left: 4px solid var(--accent-gold);
}

.notes-section h3 {
    color: var(--accent-gold);
    margin-bottom: 12px;
}

.notes-section p {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

/* =====================================================
   BOTTOM NAVIGATION
   ===================================================== */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 60px;
    background-color: var(--bg-card);
    border-top: 1px solid rgba(200, 169, 110, 0.1);
    z-index: 99;
    max-width: 600px;
    margin: 0 auto;
}

.nav-item {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    font-size: 24px;
    color: var(--text-secondary);
    transition: color var(--transition), transform var(--transition);
    text-decoration: none;
}

.nav-item:hover,
.nav-item.active {
    color: var(--accent-gold);
}

.nav-item:active {
    transform: scale(0.9);
}

/* =====================================================
   RESPONSIVE
   ===================================================== */

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .timer-number {
        font-size: 64px;
    }

    #exercise-name {
        font-size: 24px;
    }
}

@media (orientation: landscape) {
    .container {
        padding-bottom: 20px;
    }

    .screen {
        padding-bottom: 20px;
    }
}

/* =====================================================
   UTILITIES
   ===================================================== */

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

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

.gap-16 {
    gap: 16px;
}

.mt-16 {
    margin-top: 16px;
}

.mb-16 {
    margin-bottom: 16px;
}

.pt-20 {
    padding-top: 20px;
}

.pb-80 {
    padding-bottom: 80px;
}
