/* ──────────────────────────────────────────────────────────────
   Byron Hair Solution — Main Stylesheet
   Matches the original React/Tailwind dark design
   ──────────────────────────────────────────────────────────── */

:root {
  --bg:            #ffffff;
  --bg-card:       #ffffff;
  --bg-muted:      #ffffff;
  --border:        #000000;
  --text:          #000000;
  --text-muted:    #000000;
  --text-label:    #000000;
  --gold:          #d4a843;
  --gold-light:    rgba(212,168,67,.15);
  --gold-dark:     #b8912f;
  --green:         #22c55e;
  --red:           #ef4444;
  --blue:          #3b82f6;
  --radius:        0.7rem;
  --radius-lg:     0.75rem;
  --shadow:        0 4px 24px rgba(0,0,0,.5);
  --transition:    .18s ease;
}

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

html { font-size: 15px; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--gold); text-decoration: none; }
a:hover { opacity: .8; }

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

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Typography ─────────────────────────────────────────────── */
h1 { font-size: 1.4rem; font-weight: 700; }
h2 { font-size: 1.15rem; font-weight: 600; }
h3 { font-size: 1rem; font-weight: 600; }
.text-muted { color: var(--text-muted); font-size: .85rem; }
.text-gold   { color: var(--gold); }

/* ── Layout ─────────────────────────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1rem; }

/* ── Header ─────────────────────────────────────────────────── */
.app-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: .75rem 0;
  box-shadow: 0 2px 10px rgba(0,0,0,.4);
}
.app-header .inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
}
.brand { display: flex; align-items: center; gap: .75rem; }
.brand img { height: 40px; width: auto; }
.brand-text h1 { font-size: 1rem; line-height: 1.2; }
.brand-text p { font-size: .72rem; color: var(--text-muted); }

/* ── Main Content ───────────────────────────────────────────── */
.main-content { padding: 1.5rem 0 3rem; }

/* ── Card ───────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.card-body { padding: 1.25rem; }
.card-header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }

/* ── Stat Cards ─────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card { padding: 1.25rem; }
.stat-card .inner { display: flex; align-items: center; gap: .9rem; }
.stat-icon {
  width: 42px; height: 42px; border-radius: var(--radius);
  background: var(--gold-light);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.stat-icon svg { width: 20px; height: 20px; color: var(--gold); stroke: var(--gold); }
.stat-label { font-size: .78rem; color: var(--text-muted); margin-bottom: .15rem; }
.stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1; }

/* ── Tabs ───────────────────────────────────────────────────── */
.tabs { }
.tab-list {
  display: flex; gap: .25rem;
  background: var(--bg-muted);
  border-radius: var(--radius);
  padding: .25rem;
  margin-bottom: 1.25rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.tab-list::-webkit-scrollbar { display: none; }
.tab-btn {
  flex-shrink: 0;
  padding: .45rem 1rem;
  border: none; background: transparent;
  color: var(--text-muted);
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer; font-size: .875rem; font-weight: 500;
  transition: var(--transition);
}
.tab-btn.active {
  background: var(--bg-card);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0,0,0,.4);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Table ───────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
thead tr { border-bottom: 1px solid var(--border); }
th { padding: .75rem 1rem; text-align: left; font-weight: 600; color: var(--text-muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; }
td { padding: .7rem 1rem; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,.02); }
.td-right { text-align: right; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem 1rem; border-radius: var(--radius);
  font-size: .875rem; font-weight: 500; cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
  white-space: nowrap;
  text-decoration: none;
}
.btn-sm { padding: .35rem .75rem; font-size: .8rem; }
.btn-icon { padding: .4rem; border-radius: var(--radius); }

.btn-primary { background: var(--gold); color: #0f0f0f; border-color: var(--gold); }
.btn-primary:hover { background: var(--gold-dark); border-color: var(--gold-dark); opacity: 1; }

.btn-outline { background: transparent; color: var(--text); border-color: var(--border); }
.btn-outline:hover { background: var(--bg-muted); opacity: 1; }

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg-muted); color: var(--text); opacity: 1; }

.btn-danger { background: transparent; border-color: var(--red); color: var(--red); }
.btn-danger:hover { background: rgba(239,68,68,.1); opacity: 1; }

.btn-green { background: #16a34a; border-color: #16a34a; color: #fff; }
.btn-green:hover { background: #15803d; opacity: 1; }

.btn svg { width: 16px; height: 16px; stroke: currentColor; }

/* ── Forms ───────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-group:last-child { margin-bottom: 0; }
label { display: block; font-size: .82rem; font-weight: 500; color: var(--text-label); margin-bottom: .35rem; }
input, select, textarea {
  width: 100%; padding: .55rem .8rem;
  background: var(--bg-muted); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: .875rem; font-family: inherit;
  transition: border-color var(--transition);
  appearance: none;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold-light);
}
input::placeholder { color: var(--text-muted); }
select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .7rem center; padding-right: 2rem; }
textarea { resize: vertical; min-height: 80px; }

/* Readonly / disabled */
input:disabled, input[readonly], select:disabled {
  opacity: .5; cursor: not-allowed;
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 500px) { .form-row { grid-template-columns: 1fr; } }

.form-hint { font-size: .78rem; color: var(--text-muted); margin-top: .3rem; }
.earning-preview {
  background: var(--bg-muted); border-radius: var(--radius);
  padding: .75rem 1rem; font-size: .875rem; margin-top: .5rem;
}
.earning-preview p { margin: .15rem 0; }
.earning-preview strong { color: var(--gold); }

/* ── Modal / Dialog ──────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,.7);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  opacity: 0; pointer-events: none;
  transition: opacity var(--transition);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 480px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow);
  transform: scale(.95);
  transition: transform var(--transition);
}
.modal-overlay.open .modal { transform: scale(1); }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.15rem 1.25rem; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1rem; }
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: .25rem; border-radius: var(--radius); }
.modal-close:hover { background: var(--bg-muted); color: var(--text); }
.modal-body { padding: 1.25rem; }
.modal-footer { padding: .75rem 1.25rem 1.25rem; }

/* ── Badge ───────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: .2rem .6rem; border-radius: 99px;
  font-size: .72rem; font-weight: 600;
}
.badge-gold    { background: var(--gold-light); color: var(--gold); }
.badge-green   { background: rgba(34,197,94,.15); color: var(--green); }
.badge-red     { background: rgba(239,68,68,.15); color: var(--red); }
.badge-muted   { background: var(--bg-muted); color: var(--text-muted); }

/* ── Alert / Flash ───────────────────────────────────────────── */
.alert {
  padding: .75rem 1rem; border-radius: var(--radius);
  font-size: .875rem; margin-bottom: 1rem;
  display: flex; align-items: flex-start; gap: .5rem;
}
.alert-success { background: rgba(34,197,94,.1); border: 1px solid rgba(34,197,94,.3); color: #86efac; }
.alert-error   { background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.3); color: #fca5a5; }
.alert-info    { background: rgba(59,130,246,.1); border: 1px solid rgba(59,130,246,.3); color: #93c5fd; }
.alert-dismiss { margin-left: auto; background: none; border: none; color: inherit; cursor: pointer; font-size: 1rem; opacity: .6; }
.alert-dismiss:hover { opacity: 1; }

/* ── Section header ──────────────────────────────────────────── */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: .75rem; margin-bottom: 1rem;
}
.section-header h2 { margin: 0; }
.section-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ── Period Filter ───────────────────────────────────────────── */
.period-filter select { width: auto; font-size: .8rem; padding: .35rem .7rem; }

/* ── Worker summary card ─────────────────────────────────────── */
.worker-card { margin-bottom: 1rem; }
.worker-card .card-header { display: flex; align-items: center; justify-content: space-between; }
.worker-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1rem; padding: 1rem 1.25rem;
}
.worker-stat-label { font-size: .75rem; color: var(--text-muted); margin-bottom: .2rem; }
.worker-stat-value { font-size: 1.2rem; font-weight: 700; }

/* ── Login page ──────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); padding: 1rem;
}
.login-card {
  width: 100%; max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.login-header {
  padding: 2rem 2rem 1rem;
  text-align: center;
}
.login-header img { height: 80px; margin: 0 auto 1rem; }
.login-header p { color: var(--text-muted); font-size: .85rem; }
.login-body { padding: 1.25rem 2rem 2rem; }
.login-body .btn { width: 100%; justify-content: center; margin-top: .5rem; }
.login-toggle { text-align: center; margin-top: 1rem; font-size: .82rem; color: var(--text-muted); }
.login-toggle button { background: none; border: none; color: var(--gold); cursor: pointer; text-decoration: underline; font-size: inherit; }

/* ── Pending approval ────────────────────────────────────────── */
.pending-card { text-align: center; }
.pending-card .pending-box {
  background: var(--bg-muted); border-radius: var(--radius);
  padding: 1.5rem; margin: 1rem 0;
}
.pending-card h3 { font-size: 1.1rem; margin-bottom: .5rem; }

/* ── Empty state ─────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .section-header { flex-direction: column; align-items: flex-start; }
  table { font-size: .8rem; }
  th, td { padding: .6rem .75rem; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .tab-btn { font-size: .8rem; padding: .4rem .75rem; }
}

/* ── Spinner ─────────────────────────────────────────────────── */
.spinner {
  width: 36px; height: 36px; border: 3px solid var(--border);
  border-top-color: var(--gold); border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 3rem auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Print ───────────────────────────────────────────────────── */
@media print {
  .app-header, .btn, .tab-list, .modal-overlay { display: none !important; }
  body { background: #fff; color: #000; }
  .card { border: 1px solid #ccc; box-shadow: none; }
}
