/* =============================================================================
   FitKit — app.css
   Design tokens + shared components. Light theme throughout.
   ============================================================================= */

/* ─── Tokens ─────────────────────────────────────────────────────────────── */
:root {
  /* Brand */
  --fk-green:        #28a745;
  --fk-green-hover:  #24963e;
  --fk-green-soft:   rgba(40, 167, 69, 0.12);

  /* Backgrounds */
  --bg:              #f4f4f5;
  --bg-elev-1:       #ffffff;
  --bg-elev-2:       #f0f0f1;
  --bg-elev-3:       #e4e4e6;

  /* Borders */
  --border:          #e2e2e4;
  --border-strong:   #c8c8cc;

  /* Text */
  --text:            #111111;
  --text-muted:      #666666;
  --text-dim:        #999999;

  /* Status */
  --danger:          #dc3545;
  --warning:         #d97706;
  --info:            #2563eb;
  --success:         var(--fk-green);

  /* Scale */
  --radius-sm:       8px;
  --radius:          12px;
  --radius-lg:       18px;
  --shadow:          0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-lg:       0 8px 32px rgba(0, 0, 0, 0.14);

  /* Layout */
  --sidebar-w:       248px;
  --header-h:        64px;

  /* Typography */
  --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

/* ─── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--fk-green); }

img { max-width: 100%; display: block; }

/* ─── App shell ───────────────────────────────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.app-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg);
}

.app-header {
  padding: 0 28px;
  top: 0;
  z-index: 20;
}

.app-header h3 {
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0;
  padding: 15px 0 0 0;
  color: #333;
}

.header-meta {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 300;
  letter-spacing: 0.03em;
}

.app-content {
  padding: 28px;
  flex: 1;
  overflow-x: auto;
}

/* ─── Card ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-elev-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 20px; }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.card-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

.card-sub {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-top: 2px;
}

/* ─── Grid helpers ────────────────────────────────────────────────────────── */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1100px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 700px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ─── Stat card ───────────────────────────────────────────────────────────── */
.stat {
  background: var(--bg-elev-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
}
.stat-label {
  color: var(--text-muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.stat-value {
  margin-top: 10px;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
}
.stat-sub {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ─── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-elev-1);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: 0.15s ease;
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover {
  background: var(--bg-elev-2);
  border-color: var(--border-strong);
  color: var(--text);
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--fk-green);
  border-color: var(--fk-green);
  color: #fff;
}
.btn-primary:hover {
  background: var(--fk-green-hover);
  border-color: var(--fk-green-hover);
  color: #fff;
}

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
.btn-danger:hover {
  background: #c82333;
  border-color: #c82333;
  color: #fff;
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
}
.btn-ghost:hover {
  background: var(--bg-elev-2);
  border-color: var(--border);
}

.btn-sm { height: 32px; padding: 0 12px; font-size: 0.82rem; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 1rem; }

/* ─── Forms ───────────────────────────────────────────────────────────────── */
.form-row { margin-bottom: 18px; }
.form-row-inline { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.form-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text);
}

.form-control {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  background: var(--bg-elev-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  transition: 0.15s ease;
}
.form-control::placeholder { color: var(--text-dim); }
.form-control:focus {
  outline: none;
  border-color: var(--fk-green);
  box-shadow: 0 0 0 3px var(--fk-green-soft);
}

textarea.form-control {
  height: auto;
  padding: 12px 14px;
  min-height: 96px;
  resize: vertical;
}
select.form-control {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #888 50%),
                    linear-gradient(135deg, #888 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 36px;
  cursor: pointer;
}

.form-hint  { color: var(--text-dim);   font-size: 0.82rem; margin-top: 6px; }
.form-error { color: var(--danger);     font-size: 0.86rem; margin-top: 6px; font-weight: 600; }

/* ─── Tables ──────────────────────────────────────────────────────────────── */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.92rem;
}
.table th,
.table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
}
.table th {
  background: #dceedd;
  color: #3a5c3b;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.76rem;
  position: sticky;
  top: 0;
  z-index: 1;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: #f7fdf8; }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elev-1);
  box-shadow: var(--shadow);
}

/* ─── Badges ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  background: var(--bg-elev-3);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 1px solid var(--border);
}
.badge-success { background: rgba(40, 167, 69, 9); color: #1a7a32; border-color: rgba(40,167,69,0.25); }
.badge-danger  { background: rgba(220,  53,  69, 0.10); color: #a71d2a; border-color: rgba(220,53,69,0.25); }
.badge-warning { background: rgba(217, 119,   6, 0.10); color: #92520a; border-color: rgba(217,119,6,0.25); }
.badge-info    { background: rgba( 37, 99, 235, 9); color: #1e40af; border-color: rgba(37,99,235,0.25); }

/* ─── Flash messages ──────────────────────────────────────────────────────── */
.flash {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-weight: 600;
  font-size: 0.9rem;
  border: 1px solid transparent;
}
.flash-success { background: rgba(40,167,69,0.10); border-color: rgba(40,167,69,0.30); color: #1a5c2a; }
.flash-error   { background: rgba(220,53,69,0.10);  border-color: rgba(220,53,69,0.30);  color: #7f1d27; }
.flash-info    { background: rgba(37,99,235,0.10);  border-color: rgba(37,99,235,0.30);  color: #1e3a8a; }

/* ─── Utilities ───────────────────────────────────────────────────────────── */
.muted  { color: var(--text-muted); }
.dim    { color: var(--text-dim); }
.right  { text-align: right; }
.center { text-align: center; }

.mt-0 { margin-top:    0; }
.mt-1 { margin-top:  8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom:    0; }
.mb-1 { margin-bottom:  8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

/* ─── Mobile ──────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .app-content { padding: 16px; }
}
