/**
 * components.css — Shared Component Styles
 *
 * Design rules:
 * - All buttons min-height 48px (touch target)
 * - All font sizes >= 14px
 * - border-radius: 12px default (Apple)
 * - Generous padding/whitespace
 * - Coach view: big cards, clear actions, one thing at a time
 * - CEO view: clean dense data (KPI + tables + charts)
 */

/* ═══════════════════════════════════════════
   BUTTONS — Min 48px height, big and clear
   ═══════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-xl);
  min-height: var(--touch-min);  /* 48px */
  font-size: var(--text-base);   /* 16px */
  font-weight: 600;
  border-radius: var(--radius-md);  /* 12px */
  transition: all 0.2s ease;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--fitcom-orange);
  color: var(--fitcom-white);
  box-shadow: 0 2px 8px rgba(246, 146, 30, 0.25);
}
.btn-primary:hover {
  background: var(--fitcom-orange-dark);
  box-shadow: 0 4px 14px rgba(246, 146, 30, 0.3);
}

.btn-outline {
  background: transparent;
  color: var(--fitcom-orange);
  border: 1.5px solid var(--fitcom-orange);
}
.btn-outline:hover { background: var(--bg-active); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: var(--space-sm) var(--space-md);
}
.btn-ghost:hover { background: var(--bg-hover); }

.btn-danger {
  background: var(--danger);
  color: var(--fitcom-white);
}
.btn-danger:hover { background: #E0312B; }

/* Smaller button — still meets 40px min for secondary actions */
.btn-sm {
  min-height: 40px;
  padding: var(--space-sm) var(--space-md);
  font-size: var(--text-sm);  /* 14px — minimum */
  font-weight: 500;
}

/* Large hero button — Grab style, for primary coach actions */
.btn-lg {
  min-height: var(--touch-xl);  /* 64px */
  padding: var(--space-lg) var(--space-2xl);
  font-size: var(--text-xl);    /* 20px */
  font-weight: 700;
  border-radius: var(--radius-lg);
}

.btn-icon {
  width: var(--touch-min);  /* 48px */
  height: var(--touch-min);
  min-height: var(--touch-min);
  padding: 0;
  border-radius: var(--radius-md);
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* ═══════════════════════════════════════════
   CARDS — Apple-style with 12px radius
   ═══════════════════════════════════════════ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);  /* 16px for main cards */
  padding: var(--space-xl);
  box-shadow: var(--shadow-sm);
}

.card-hover {
  transition: all 0.2s ease;
  cursor: pointer;
}
.card-hover:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--fitcom-orange-light);
}
.card-hover:active {
  transform: scale(0.985);
}

/* Action Card — Grab-style big card for coaches (one action per card) */
.card-action {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  min-height: 80px;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}
.card-action:hover {
  border-color: var(--fitcom-orange);
  box-shadow: var(--shadow-md);
}
.card-action:active {
  transform: scale(0.98);
}
.card-action-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--fitcom-orange-bg);
  color: var(--fitcom-orange);
}
.card-action-body {
  flex: 1;
  min-width: 0;
}
.card-action-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
}
.card-action-desc {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  margin-top: 2px;
}
.card-action-arrow {
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════
   KPI CARDS — CEO dashboard, clean data
   ═══════════════════════════════════════════ */
.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
}
.kpi-card .kpi-value {
  font-size: var(--text-4xl);  /* 40px hero number */
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.kpi-card .kpi-label {
  font-size: var(--text-sm);   /* 14px — minimum */
  color: var(--text-tertiary);
  font-weight: 500;
  margin-top: var(--space-sm);
}
.kpi-card .kpi-trend {
  font-size: var(--text-sm);
  font-weight: 600;
  margin-top: var(--space-xs);
}
.kpi-trend-up { color: var(--success); }
.kpi-trend-down { color: var(--danger); }
.kpi-trend-flat { color: var(--text-muted); }

/* ═══════════════════════════════════════════
   BADGES — Status pills
   ═══════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  font-size: var(--text-sm);  /* 14px minimum */
  font-weight: 500;
  border-radius: var(--radius-full);
  white-space: nowrap;
}
.badge-planning  { background: #F3F4F6; color: #6B7280; }
.badge-to-shoot  { background: var(--warning-light); color: #92400E; }
.badge-editing   { background: var(--info-light); color: #1E40AF; }
.badge-to-upload { background: #EDE9FE; color: #5B21B6; }
.badge-published { background: var(--success-light); color: #166534; }
.badge-draft     { background: #FEF3C7; color: #92400E; }
.badge-approved  { background: var(--success-light); color: #166534; }

/* ═══════════════════════════════════════════
   FORM INPUTS — 48px height, 16px font
   ═══════════════════════════════════════════ */
.input, .select, .textarea {
  width: 100%;
  min-height: var(--touch-min);  /* 48px */
  padding: var(--space-md);
  font-size: var(--text-base);   /* 16px prevents iOS zoom */
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-md);  /* 12px */
  background: var(--bg-card);
  color: var(--text-primary);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(246, 146, 30, 0.1);
}
.input::placeholder, .textarea::placeholder {
  color: var(--text-muted);
}
.textarea {
  min-height: 100px;
  resize: vertical;
  line-height: var(--leading-relaxed);
}
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%239CA3AF' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-md) center;
  padding-right: var(--space-2xl);
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}
.form-label {
  font-size: var(--text-sm);  /* 14px */
  font-weight: 600;
  color: var(--text-secondary);
}

/* ═══════════════════════════════════════════
   AVATAR
   ═══════════════════════════════════════════ */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--fitcom-orange);
  color: var(--fitcom-white);
  font-size: var(--text-sm);
  font-weight: 600;
  flex-shrink: 0;
}
.avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.avatar-lg { width: 56px; height: 56px; font-size: var(--text-lg); }

/* ═══════════════════════════════════════════
   PROGRESS BAR
   ═══════════════════════════════════════════ */
.progress {
  height: 8px;
  background: var(--border-light);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--fitcom-orange);
  transition: width 0.4s ease;
}
.progress-lg { height: 12px; }

/* ═══════════════════════════════════════════
   DATA TABLE — CEO view, clean & scannable
   ═══════════════════════════════════════════ */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-default);
  background: var(--bg-card);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th {
  text-align: left;
  font-size: var(--text-sm);  /* 14px */
  font-weight: 600;
  color: var(--text-tertiary);
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border-default);
  background: var(--bg-primary);
  position: sticky;
  top: 0;
}
.data-table td {
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
  font-size: var(--text-base);
}
.data-table tr:last-child td {
  border-bottom: none;
}
.data-table tr:hover td {
  background: var(--bg-hover);
}

/* ═══════════════════════════════════════════
   MODAL — Apple-like centered sheet
   ═══════════════════════════════════════════ */
#modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  animation: fadeIn 0.2s ease;
}
#modal-content {
  background: var(--bg-card);
  border-radius: var(--radius-xl);  /* 20px — Apple sheet */
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.25s ease;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-xl) var(--space-xl) var(--space-lg);
}
.modal-header h2 {
  font-size: var(--text-xl);
  font-weight: 700;
}
.modal-body {
  padding: 0 var(--space-xl) var(--space-xl);
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-md);
  padding: var(--space-lg) var(--space-xl);
  border-top: 1px solid var(--border-light);
}

/* Mobile: modal becomes full-screen sheet from bottom */
@media (max-width: 768px) {
  #modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  #modal-content {
    max-width: 100%;
    max-height: 92vh;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    animation: slideUp 0.3s ease;
  }
}

/* ═══════════════════════════════════════════
   TOAST — Notifications
   ═══════════════════════════════════════════ */
#toast-container {
  position: fixed;
  bottom: calc(var(--space-xl) + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  pointer-events: none;
  width: 90%;
  max-width: 400px;
}
.toast {
  padding: var(--space-md) var(--space-xl);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--fitcom-white);
  background: var(--fitcom-dark);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: slideUp 0.3s ease;
  text-align: center;
  width: 100%;
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); color: var(--fitcom-dark); }

/* ═══════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-3xl) var(--space-xl);
  color: var(--text-tertiary);
  text-align: center;
}
.empty-state svg {
  width: 56px;
  height: 56px;
  margin-bottom: var(--space-lg);
  opacity: 0.3;
}
.empty-state p {
  font-size: var(--text-lg);
  line-height: var(--leading-relaxed);
}

/* ═══════════════════════════════════════════
   DIVIDER
   ═══════════════════════════════════════════ */
.divider {
  height: 1px;
  background: var(--border-default);
  margin: var(--space-xl) 0;
}

/* ═══════════════════════════════════════════
   SECTION HEADER — Used inside pages
   ═══════════════════════════════════════════ */
.section-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-md);
}

/* ═══════════════════════════════════════════
   GRID LAYOUT
   ═══════════════════════════════════════════ */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-lg); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-lg); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-lg); }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--space-lg); }

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }
  /* 2-col stays on larger phones */
  .grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 769px) and (max-width: 1023px) {
  .grid-3, .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ═══════════════════════════════════════════
   ANIMATIONS — Restrained, Apple-like
   ═══════════════════════════════════════════ */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ═══════════════════════════════════════════
   PRINT
   ═══════════════════════════════════════════ */
@media print {
  #sidebar, #header, #bottom-nav, #toast-container, #modal-overlay,
  .btn, .no-print { display: none !important; }
  #page-content { padding: 0; max-width: none; }
  body { background: white; font-size: 12pt; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}
