/* ═══════════════════════════════════════════════════════════════════════════
   BuildMyShift — Application Styles
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #111827; background: #F9FAFB; line-height: 1.5; font-size: 14px;
}
a { color: #2563EB; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── App Nav ── */
.app-nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,0.97); backdrop-filter: blur(10px);
  border-bottom: 1px solid #E5E7EB; height: 56px;
}
.app-nav-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 24px;
  height: 100%; display: flex; align-items: center; justify-content: space-between;
}
.app-back {
  font-size: 13px; font-weight: 500; color: #6B7280; text-decoration: none;
}
.app-back:hover { color: #111827; text-decoration: none; }
.app-wordmark {
  display: flex; align-items: center; gap: 8px;
  font-size: 16px; font-weight: 700; color: #111827; text-decoration: none;
}
.app-wordmark:hover { text-decoration: none; }
.app-wordmark-icon {
  width: 28px; height: 28px; background: #2563EB; border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px; color: white;
}
/* ── Nav Right (Auth) ── */
.app-nav-right {
  display: flex; align-items: center; gap: 16px; flex-shrink: 0;
}
.nav-link {
  font-family: inherit; font-size: 13px; font-weight: 500; color: #6B7280;
  cursor: pointer; transition: color 0.15s; background: none; border: none;
  padding: 0; text-decoration: none;
}
.nav-link:hover { color: #111827; text-decoration: none; }
.nav-link-primary { color: #2563EB; font-weight: 600; }
.nav-link-primary:hover { color: #1D4ED8; }
.nav-link-dim { color: #9CA3AF; font-size: 12px; }
.nav-link-dim:hover { color: #6B7280; }
.nav-link-accent { color: #F59E0B; font-weight: 700; }
.nav-link-accent:hover { color: #D97706; }

/* ── Trial Banner ── */
.trial-banner { text-align: center; padding: 10px 16px; font-size: 14px; }
.trial-banner a { font-weight: 600; text-decoration: underline; }
.trial-active { background: #EFF6FF; color: #1E40AF; border-bottom: 1px solid #BFDBFE; }
.trial-active a { color: #1D4ED8; }
.trial-expired { background: #FEF3C7; color: #92400E; border-bottom: 1px solid #FDE68A; }
.trial-expired a { color: #B45309; }
.nav-separator { width: 1px; height: 16px; background: #E5E7EB; }
.nav-user-email {
  font-size: 12px; font-weight: 500; color: #9CA3AF;
  max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ── Modal ── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(0,0,0,0.4); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
}
.modal-card {
  background: #fff; border-radius: 16px; padding: 32px;
  width: 100%; max-width: 420px; position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal-card h2 { font-size: 20px; font-weight: 700; margin-bottom: 20px; }
.modal-close {
  position: absolute; top: 16px; right: 16px;
  background: none; border: none; font-size: 24px; color: #9CA3AF;
  cursor: pointer; line-height: 1;
}
.modal-close:hover { color: #374151; }
.auth-toggle-text {
  text-align: center; font-size: 13px; color: #6B7280; margin-top: 16px;
}
.auth-toggle-text a { font-weight: 600; }

/* ── Scenario List (Load Modal) ── */
.scenario-list { max-height: 360px; overflow-y: auto; }
.scenario-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px; border: 1px solid #E5E7EB; border-radius: 10px;
  margin-bottom: 8px; cursor: pointer; transition: all 0.15s;
}
.scenario-item:hover { background: #F0F4FF; border-color: #93C5FD; }
.scenario-item-name { font-size: 14px; font-weight: 600; color: #111827; }
.scenario-item-date { font-size: 11px; color: #9CA3AF; }
.scenario-item-delete {
  background: none; border: none; font-size: 16px; color: #D1D5DB;
  cursor: pointer; padding: 4px 8px; border-radius: 6px; line-height: 1;
}
.scenario-item-delete:hover { color: #EF4444; background: #FEF2F2; }
.scenario-empty { text-align: center; padding: 40px 20px; color: #9CA3AF; font-size: 14px; }

/* ── Import Drop Zone ── */
.import-drop-zone {
  border: 2px dashed #D1D5DB; border-radius: 12px; padding: 32px 20px;
  text-align: center; transition: border-color 0.2s, background 0.2s; cursor: pointer;
}
.import-drop-zone.dragover { border-color: #3B82F6; background: #EFF6FF; }
.import-drop-zone p { margin: 4px 0; font-size: 14px; color: #6B7280; }
.import-drop-icon { font-size: 32px; margin-bottom: 8px; }

/* ── Step Indicator ── */
.step-indicator { background: rgba(255,255,255,0.97); backdrop-filter: blur(10px); border-bottom: 1px solid #E5E7EB; padding: 12px 0; position: sticky; top: 56px; z-index: 99; pointer-events: none; }
.step-indicator-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 24px;
  display: flex; gap: 24px; pointer-events: none;
}
.step-item {
  display: flex; align-items: center; gap: 10px; flex: 1;
  padding: 8px 12px; border-radius: 10px; cursor: pointer; transition: background 0.15s;
  pointer-events: auto;
}
.step-item.active { background: #EFF6FF; }
.step-item.done { background: #F0FDF4; }
.step-icon {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: #fff; background: #D1D5DB;
  flex-shrink: 0;
}
.step-item.active .step-icon { background: #2563EB; }
.step-item.done .step-icon { background: #16A34A; }
.step-item.done .step-icon::after { content: "\2713"; }
.step-label { font-size: 13px; font-weight: 600; color: #374151; }
.step-caption { font-size: 11px; color: #9CA3AF; }

/* ── Tab Navigation ── */
.tab-nav {
  background: #fff; border-bottom: 2px solid #E5E7EB;
  display: flex; max-width: 1200px; margin: 0 auto; padding: 0 24px;
}
.tab-btn {
  padding: 14px 20px; border: none; background: none;
  font-family: inherit; font-size: 14px; font-weight: 600; color: #6B7280;
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s; white-space: nowrap;
}
.tab-btn:hover { color: #374151; }
.tab-btn.active { color: #2563EB; border-bottom-color: #2563EB; }

/* ── Tab Content ── */
.tab-content { display: none; padding: 24px 0 60px; }
.tab-content.active { display: block; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* ── Typography ── */
.page-title { font-size: 28px; font-weight: 800; color: #111827; margin-bottom: 8px; letter-spacing: -0.5px; }
.section-title { font-size: 20px; font-weight: 700; color: #111827; margin: 28px 0 8px; }
.subsection-title { font-size: 15px; font-weight: 600; color: #374151; margin: 20px 0 8px; }
.section-caption { font-size: 13px; color: #6B7280; margin-bottom: 12px; }

/* ── Cards ── */
.card {
  background: #fff; border: 1px solid #E5E7EB; border-radius: 12px;
  padding: 20px 24px; margin-bottom: 16px;
}
.info-card { background: #F8FAFC; border-color: #CBD5E1; }
.info-card h3 { font-size: 18px; font-weight: 700; color: #1E293B; margin-bottom: 8px; }
.info-card p { font-size: 14px; color: #475569; margin-bottom: 12px; }
.info-card ul { margin: 0; padding: 0 0 0 8px; list-style: none; }
.info-card li { font-size: 13px; color: #475569; line-height: 2; }

/* ── Banners ── */
.banner {
  padding: 10px 18px; border-radius: 0 8px 8px 0; margin: 16px 0;
  font-weight: 600; font-size: 14px; border-left: 4px solid;
}
.banner-blue { background: #EFF6FF; border-left-color: #3B82F6; color: #1E40AF; }
.banner-green { background: #F0FDF4; border-left-color: #22C55E; color: #14532D; }
.banner-yellow { background: #FFFBEB; border-left-color: #F59E0B; color: #78350F; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: 8px; font-family: inherit; font-weight: 600;
  cursor: pointer; transition: all 0.15s; font-size: 14px; padding: 10px 20px;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: #2563EB; color: #fff; }
.btn-primary:hover { background: #1D4ED8; transform: translateY(-1px); }
.btn-outline { background: transparent; color: #374151; border: 1.5px solid #D1D5DB; }
.btn-outline:hover { border-color: #9CA3AF; color: #111827; }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-block { display: flex; width: 100%; }

/* ── Forms ── */
.form-row {
  display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; align-items: flex-start;
}
.form-group { display: flex; flex-direction: column; gap: 4px; min-width: 140px; flex: 1; }
.form-label { font-size: 13px; font-weight: 600; color: #374151; }
label { font-size: 13px; font-weight: 600; color: #374151; }
.form-input, .form-select, .form-textarea {
  padding: 8px 12px; border: 1.5px solid #D1D5DB; border-radius: 8px;
  font-family: inherit; font-size: 14px; color: #111827; background: #fff;
  outline: none; transition: border-color 0.15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: #2563EB; }
.form-textarea { resize: vertical; }
.form-select { appearance: auto; }

/* ── Radio & Checkbox ── */
.radio-group { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 16px; }
.radio-label, .checkbox-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 500; color: #374151; cursor: pointer;
}

/* ── Day Inputs (7-column row) ── */
.day-inputs {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin-bottom: 12px;
}
.day-input-group { display: flex; flex-direction: column; gap: 4px; }
.day-input-group label { font-size: 12px; font-weight: 600; color: #6B7280; text-align: center; }
.day-input-group input {
  padding: 8px 6px; border: 1.5px solid #D1D5DB; border-radius: 8px;
  font-family: inherit; font-size: 14px; color: #111827; text-align: center;
  outline: none; width: 100%;
}
.day-input-group input:focus { border-color: #2563EB; }

/* ── Preset Grid ── */
.preset-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.preset-btn {
  background: #fff; border: 1.5px solid #D1D5DB; border-radius: 12px;
  padding: 16px 12px; text-align: center; cursor: pointer;
  transition: all 0.15s; font-family: inherit;
}
.preset-btn:hover { border-color: #9CA3AF; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.preset-btn.active { border-color: #2563EB; background: #EFF6FF; box-shadow: 0 0 0 3px rgba(37,99,235,0.15); }
.preset-btn-name { font-size: 14px; font-weight: 700; color: #111827; margin-bottom: 4px; }
.preset-btn-desc { font-size: 12px; color: #6B7280; }
.preset-btn-hours { font-size: 11px; color: #9CA3AF; margin-top: 4px; }

/* ── Expander / Collapsible ── */
.expander { padding: 0; overflow: hidden; }
.expander-header {
  padding: 14px 20px; cursor: pointer; display: flex; justify-content: space-between; align-items: center;
  font-size: 14px; font-weight: 600; color: #374151; user-select: none;
}
.expander-header:hover { background: #F9FAFB; }
.expander-chevron { font-size: 12px; color: #9CA3AF; transition: transform 0.2s; }
.expander-header.expander-open .expander-chevron { transform: rotate(180deg); }
.expander-header.expander-open + .expander-body { display: block !important; }
.expander-body { padding: 0 20px 20px; }

/* ── Data Tables ── */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 10px; border: 1px solid #E5E7EB; }
.data-table {
  width: 100%; border-collapse: collapse; font-size: 13px; background: #fff;
}
.data-table th {
  background: #F9FAFB; padding: 10px 12px; text-align: left;
  font-weight: 600; color: #374151; border-bottom: 2px solid #E5E7EB;
  position: sticky; top: 0; z-index: 1; white-space: nowrap;
}
.data-table td {
  padding: 8px 12px; border-bottom: 1px solid #F3F4F6; white-space: nowrap;
}
.data-table tbody tr:nth-child(even) { background: #FAFBFC; }
.data-table tbody tr:hover { background: #F0F4FF; }

/* Editable cells */
.data-table td[contenteditable="true"] { cursor: text; }
.data-table td[contenteditable="true"]:focus {
  outline: 2px solid #2563EB; outline-offset: -2px; background: #EFF6FF;
}

/* ── Heatmap colors ── */
.heat-0 { background: #ffffff; color: #000000; }
.heat-1 { background: #FFFDE7; color: #000000; }
.heat-2 { background: #FFF59D; color: #000000; }
.heat-3 { background: #F9A825; color: #000000; }
.heat-4 { background: #E65100; color: #ffffff; }
.heat-5 { background: #B71C1C; color: #ffffff; }

/* ── Metrics ── */
.metrics-row { display: flex; gap: 16px; flex-wrap: wrap; margin: 16px 0; }
.metric-card {
  flex: 1; min-width: 160px; background: #fff; border: 1px solid #E5E7EB;
  border-radius: 12px; padding: 16px 20px; text-align: center;
}
.metric-card-label { font-size: 12px; font-weight: 600; color: #6B7280; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.metric-card-value { font-size: 28px; font-weight: 800; color: #111827; letter-spacing: -0.5px; }
.metric-display { background: #F9FAFB; border-radius: 8px; padding: 8px 12px; }
.metric-value { font-size: 24px; font-weight: 700; color: #111827; }

/* ── Results tabs ── */
.results-tabs { display: flex; gap: 0; margin: 20px 0 16px; border-bottom: 2px solid #E5E7EB; }
.results-tab-btn {
  padding: 10px 18px; border: none; background: none; font-family: inherit;
  font-size: 13px; font-weight: 600; color: #6B7280; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.15s;
}
.results-tab-btn.active { color: #2563EB; border-bottom-color: #2563EB; }
.results-tab-content { display: none; }
.results-tab-content.active { display: block; }

/* ── Validation ── */
.validation-msg { font-size: 13px; margin-top: 4px; }
.validation-msg.success { color: #16A34A; }
.validation-msg.warning { color: #D97706; }
.validation-msg.error { color: #DC2626; }

/* ── Divider ── */
.divider { border: none; border-top: 1px solid #E5E7EB; margin: 24px 0; }

/* ── Checkbox Row ── */
.checkbox-row { display: flex; flex-wrap: wrap; gap: 16px; }

/* ── Loading Spinner ── */
.loading-overlay {
  display: none; position: fixed; inset: 0; z-index: 9999;
  background: rgba(255,255,255,0.85); backdrop-filter: blur(2px);
  flex-direction: column; align-items: center; justify-content: center;
}
.loading-overlay.active { display: flex; }
.spinner {
  width: 40px; height: 40px; border: 4px solid #E5E7EB;
  border-top-color: #2563EB; border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { margin-top: 12px; font-size: 15px; font-weight: 600; color: #374151; }

/* ── Paste Data Layout ── */
.paste-layout {
  display: flex; gap: 16px; align-items: stretch;
}
.paste-textarea-wrap {
  flex: 1;
}
.paste-textarea-wrap textarea {
  width: 100%; height: 100%; min-height: 180px;
  font-family: 'SF Mono', 'Fira Code', 'Courier New', monospace;
  font-size: 12px; line-height: 1.5; resize: vertical;
  padding: 12px; border-radius: 8px;
}
.paste-actions {
  display: flex; flex-direction: column; gap: 10px; justify-content: flex-start;
  min-width: 180px;
}
.paste-actions .btn { white-space: nowrap; }

/* ── Export Link (subtle) ── */
.export-link {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 500; color: #9CA3AF;
  cursor: pointer; text-decoration: none; padding: 4px 0;
  transition: color 0.15s;
}
.export-link:hover { color: #374151; text-decoration: none; }
.export-link svg { width: 12px; height: 12px; fill: currentColor; }
.table-header-row {
  display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px;
}

/* ── Coverage Chart (Schedule Builder) ── */
.coverage-chart-wrap {
  position: relative; background: #fff; border: 1px solid #E5E7EB;
  border-radius: 12px; padding: 16px; overflow-x: auto;
}
.coverage-chart-wrap svg text { font-family: 'Inter', sans-serif; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .step-indicator-inner { flex-direction: column; gap: 8px; }
  .tab-nav { overflow-x: auto; }
  .preset-grid { grid-template-columns: repeat(2, 1fr); }
  .day-inputs { grid-template-columns: repeat(4, 1fr); }
  .form-row { flex-direction: column; }
  .metrics-row { flex-direction: column; }
  .paste-layout { flex-direction: column; }
  .paste-actions { flex-direction: row; min-width: unset; }
}
@media (max-width: 480px) {
  .preset-grid { grid-template-columns: 1fr; }
  .day-inputs { grid-template-columns: repeat(3, 1fr); }
}
