/* =====================================================
   Tattoo Booking — Style
   Aesthetic: Dark studio / raw industrial minimal
   Font: DM Serif Display + DM Mono
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Mono:wght@300;400;500&display=swap');

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

:root {
  --bg:         #0d0d0d;
  --surface:    #161616;
  --border:     #272727;
  --muted:      #3a3a3a;
  --text:       #e8e4dc;
  --text-dim:   #7a7570;
  --accent:     #c9a96e;   /* warm gold — ink on skin */
  --accent-dim: #7a5f38;
  --red:        #c0392b;
  --green:      #27ae60;
  --yellow:     #e6a817;
  --blue:       #3498db;
  --radius:     6px;
  --radius-lg:  10px;
  --font-head:  'DM Serif Display', Georgia, serif;
  --font-body:  'DM Mono', 'Courier New', monospace;
  --tab-h:      56px;
  --header-h:   58px;
}

html { font-size: 17px; -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  min-height: 100dvh;
  overflow-x: hidden;
  padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom));
}

/* ── Scrollbar ──────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--muted); border-radius: 2px; }

/* ── Typography ─────────────────────────────────── */
h1, h2, h3 { font-family: var(--font-head); font-weight: 400; line-height: 1.2; }
h1 { font-size: 2rem; }
h2 { font-size: 1.55rem; }
h3 { font-size: 1.2rem; }

/* ── Header ─────────────────────────────────────── */
#app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  z-index: 100;
  gap: 10px;
}

#app-header .logo {
  font-family: var(--font-head);
  font-size: 1.30rem;
  color: var(--accent);
  letter-spacing: 0.02em;
  flex: 1;
}

#app-header .logo span {
  font-style: italic;
  color: var(--text-dim);
  font-size: 0.5rem;
  display: block;
  font-family: var(--font-body);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

#app-header .btn-logout,
#app-header .btn-install,
#app-header .btn-lang,
#app-header .btn-feedback,
#app-header .btn-admin {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  height: 36px;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

#app-header .btn-logout {
  width: 36px;
}

#app-header .btn-install {
  padding: 0 12px;
  font-family: var(--font-body);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

#app-header .btn-lang {
  width: 52px;
  padding: 0 8px;
  font-family: var(--font-body);
  font-size: 0.78rem;
}

#app-header .btn-logout:hover,
#app-header .btn-install:hover,
#app-header .btn-lang:hover,
#app-header .btn-feedback:hover,
#app-header .btn-admin:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* ── Main content area ──────────────────────────── */
#main {
  margin-top: var(--header-h);
  padding: 16px;
  max-width: 680px;
  margin-left: auto;
  margin-right: auto;
}

/* ── Tab bar ────────────────────────────────────── */
#tab-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 100;
}

.tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: color 0.15s;
  -webkit-tap-highlight-color: transparent;
  padding: 0;
}

.tab-btn svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.5; }
.tab-btn.active { color: var(--accent); }
.tab-btn:active { opacity: 0.7; }

/* ── Section ────────────────────────────────────── */
.section { display: none; }
.section.active { display: block; }

/* ── Page title ─────────────────────────────────── */
.page-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 20px;
}

.page-title h2 { color: var(--text); }

.page-title .date-label {
  font-size: 0.82rem;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ── Dashboard stats row ─────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 10px;
  text-align: center;
  cursor: default;
}

.stat-card .stat-num {
  font-family: var(--font-head);
  font-size: 2rem;
  color: var(--accent);
  line-height: 1;
}

.stat-card .stat-label {
  font-size: 0.78rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 4px;
}

/* ── Section heading within page ────────────────── */
.block-title {
  font-size: 0.78rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

/* ── Card list ──────────────────────────────────── */
.card-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 24px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  position: relative;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
  cursor: pointer;
}

.card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.card:active { border-color: var(--accent-dim); }

.card.urgency-red { box-shadow: inset 4px 0 0 rgba(192,57,43,0.25); }
.card.urgency-amber { box-shadow: inset 4px 0 0 rgba(230,168,23,0.25); }

.card-left { flex: 1; min-width: 0; }

.card-name {
  font-size: 1.08rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-sub {
  font-size: 0.9rem;
  color: var(--text-dim);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-note {
  font-size: 0.9rem;
  color: var(--text-dim);
  margin-top: 6px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.card-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  align-items: flex-start;
}

.btn-icon {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-dim);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s, border-color 0.15s;
}

.btn-icon svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.5; }
.btn-icon:active { color: var(--accent); border-color: var(--accent); }

.btn-icon.danger:active { color: var(--red); border-color: var(--red); }

/* ── Badges / Pills ─────────────────────────────── */
.badges { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 6px; }

.badge {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 3px;
  font-weight: 500;
}

/* Booking status */
.badge-pending   { background: rgba(230,168,23,0.15);  color: var(--yellow); }
.badge-confirmed { background: rgba(39,174,96,0.15);   color: var(--green);  }
.badge-done      { background: rgba(122,117,112,0.15); color: var(--text-dim);}

/* Deposit */
.badge-paid   { background: rgba(39,174,96,0.15);  color: var(--green); }
.badge-unpaid { background: rgba(192,57,43,0.15);  color: var(--red);   }

/* Lead status */
.badge-new       { background: rgba(52,152,219,0.15);  color: var(--blue);     }
.badge-contacted { background: rgba(201,169,110,0.15); color: var(--accent);   }
.badge-booked    { background: rgba(39,174,96,0.15);   color: var(--green);    }
.badge-lost      { background: rgba(122,117,112,0.15); color: var(--text-dim); }
.badge-urgency { font-weight: 600; }
.badge-urgency-red { background: rgba(192,57,43,0.18); color: var(--red); }
.badge-urgency-amber { background: rgba(230,168,23,0.18); color: var(--yellow); }

/* ── FAB (Floating Add Button) ──────────────────── */
.fab {
  position: fixed;
  bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 16px);
  right: 16px;
  width: 52px;
  height: 52px;
  background: var(--accent);
  color: #0d0d0d;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(201,169,110,0.35);
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s, box-shadow 0.15s;
  z-index: 90;
}

.fab svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 2; }
.fab:active { transform: scale(0.93); box-shadow: 0 2px 10px rgba(201,169,110,0.2); }

/* ── Empty state ────────────────────────────────── */
.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dim);
  font-size: 0.95rem;
  letter-spacing: 0.05em;
}

.empty svg { width: 40px; height: 40px; stroke: var(--muted); fill: none; stroke-width: 1; margin-bottom: 12px; }

/* ── Modal ──────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-width: 680px;
  max-height: 90dvh;
  overflow-y: auto;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  transform: translateY(40px);
  transition: transform 0.25s cubic-bezier(.32,.72,0,1);
}

.modal-overlay.open .modal {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-header h3 { font-family: var(--font-head); font-size: 1.4rem; }

.btn-close {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  -webkit-tap-highlight-color: transparent;
}

.btn-close svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; }

/* ── Form ───────────────────────────────────────── */
.form-group { margin-bottom: 14px; }

label {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-bottom: 6px;
}

input, select, textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 12px 13px;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.15s;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
}

textarea { resize: vertical; min-height: 72px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.form-actions { display: flex; gap: 10px; margin-top: 20px; }

/* ── Buttons ────────────────────────────────────── */
.btn {
  flex: 1;
  padding: 13px 16px;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 500;
  cursor: pointer;
  border: none;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s;
}

.btn:active { opacity: 0.75; }

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.btn-primary {
  background: var(--accent);
  color: #0d0d0d;
}

.btn-ghost {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-dim);
}

/* ── Filter bar ─────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
}

.filter-bar::-webkit-scrollbar { display: none; }

.filter-chip {
  flex-shrink: 0;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-dim);
  font-family: var(--font-body);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.15s;
}

.filter-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #0d0d0d;
}

/* ── Toast ──────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 80px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 20px;
  font-size: 0.95rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  white-space: nowrap;
  z-index: 300;
}

#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Loading skeleton ───────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--border) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  border-radius: var(--radius);
  height: 72px;
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Archive confirmation row ───────────────────── */
.delete-confirm {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: rgba(192,57,43,0.08);
  border: 1px solid rgba(192,57,43,0.2);
  border-radius: var(--radius);
  margin-top: 6px;
  font-size: 0.9rem;
  color: var(--text-dim);
}

.delete-confirm.show { display: flex; }
.delete-confirm .btn-del { padding: 5px 11px; background: var(--red); color: #fff; border: none; border-radius: 4px; font-size: 0.82rem; cursor: pointer; font-family: var(--font-body); }
.delete-confirm .btn-cancel { padding: 5px 11px; background: none; border: 1px solid var(--border); color: var(--text-dim); border-radius: 4px; font-size: 0.82rem; cursor: pointer; font-family: var(--font-body); }

/* ── Follow-up date indicator ───────────────────── */
.followup-due { color: var(--yellow); }
.followup-overdue { color: var(--red); }

/* ── Responsive ─────────────────────────────────── */
@media (min-width: 480px) {
  #main { padding: 20px 24px; }
}

@media (min-width: 680px) {
  .stats-row { gap: 14px; }
  .card { padding: 14px 16px; }
}

/* ══════════════════════════════════════════════════════
   DESIGN APPROVAL SYSTEM
   ══════════════════════════════════════════════════════ */

/* ── Design status badges ───────────────────────────── */
.badge-design-draft    { background: rgba(122,117,112,0.15); color: var(--text-dim); }
.badge-design-sent     { background: rgba(52,152,219,0.15);  color: var(--blue);     }
.badge-design-approved { background: rgba(39,174,96,0.15);   color: var(--green);    }

/* ── Card design thumbnail ──────────────────────────── */
.card-design-thumb {
  margin-top: 10px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  max-width: 220px;
  position: relative;
}

.card-design-thumb a {
  display: block;
  line-height: 0;
}

.card-design-thumb img {
  width: 100%;
  height: auto;
  max-height: 130px;
  object-fit: cover;
  display: block;
  transition: opacity 0.15s;
}

.card-design-thumb img:hover { opacity: 0.85; }

/* ── Form divider (section separator inside modal) ──── */
.form-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 14px;
}

.form-divider span {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  white-space: nowrap;
}

.form-divider::before,
.form-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Design image preview (inside modal) ────────────── */
.design-preview {
  margin-top: 8px;
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
  max-width: 100%;
}

.design-preview img {
  width: 100%;
  height: auto;
  max-height: 180px;
  object-fit: contain;
  display: block;
}

.design-preview-clear {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(13,13,13,0.75);
  border: 1px solid var(--border);
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s;
  padding: 0;
}

.design-preview-clear:hover { color: var(--text); }

/* ══════════════════════════════════════════════════════
   IMAGE SOURCE TABS (URL / Upload switcher)
   ══════════════════════════════════════════════════════ */

.img-source-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.img-source-tab {
  flex: 1;
  padding: 8px 10px;
  background: var(--bg);
  border: none;
  color: var(--text-dim);
  font-family: var(--font-body);
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.img-source-tab + .img-source-tab {
  border-left: 1px solid var(--border);
}

.img-source-tab.active {
  background: var(--accent);
  color: #0d0d0d;
}

/* ── File upload zone ───────────────────────────────── */
.file-upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 16px;
  border: 1px dashed var(--muted);
  border-radius: var(--radius);
  color: var(--text-dim);
  font-size: 0.92rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
  text-align: center;
}

.file-upload-zone:active,
.file-upload-zone:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ══════════════════════════════════════════════════════
   VIEW MODAL (read-only detail panel)
   ══════════════════════════════════════════════════════ */

.modal--view .modal-header h3 {
  color: var(--accent);
}

.view-field {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.view-field:last-of-type { border-bottom: none; }

.view-field--col {
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.view-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  flex-shrink: 0;
}

.view-value {
  font-size: 1rem;
  color: var(--text);
  text-align: right;
}

.view-field--col .view-value {
  text-align: left;
}

.view-notes {
  white-space: pre-wrap;
  line-height: 1.5;
  font-size: 0.98rem;
  color: var(--text-dim);
}

.view-design-img {
  margin-top: 12px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.view-design-img img {
  width: 100%;
  height: auto;
  max-height: 260px;
  object-fit: contain;
  display: block;
  background: var(--bg);
}

.view-modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.view-modal-actions .btn { flex: 1; }

.view-followup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.view-followup-actions .btn {
  flex: 1;
  min-width: 150px;
}

.contact-today-label {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 6px;
  border: 1px solid var(--accent-dim);
  border-radius: 3px;
  color: var(--accent);
  font-size: 0.78rem;
}

/* ══════════════════════════════════════════════════════
   ARCHIVE
   ══════════════════════════════════════════════════════ */

.badge-archived {
  background: rgba(122,117,112,0.12);
  color: var(--text-dim);
  border: 1px solid var(--muted);
  font-style: italic;
}

/* Muted look for archived cards */
.card:has(.badge-archived) {
  opacity: 0.82;
}

/* Archive filter chip — distinct tint */
.filter-chip[data-filter="archive"].active {
  background: var(--muted);
  border-color: var(--muted);
  color: var(--text);
}

/* ── Admin styles ────────────────────────────────────── */
.activity-item {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.activity-item:last-child {
  border-bottom: none;
}

.message-item {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
}

.message-item.spam {
  opacity: 0.7;
}

.message-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.message-body {
  white-space: pre-wrap;
}

.btn-spam {
  background: var(--danger);
  color: white;
  border: none;
  padding: 4px 8px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.8rem;
}

.spam-label {
  color: var(--danger);
  font-size: 0.8rem;
}
