/* ── CASA Studio Portal — v9 ──────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&display=swap');

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

/* ── Design Tokens ───────────────────────────────────────────────────────── */
:root {
  --blue:       #4898EE;
  --blue-dark:  #2D7DD2;
  --navy:       #0E3E72;
  --cream:      #FEFFEC;
  --text:       #1C1C1E;
  --text2:      #3A3A3C;
  --muted:      rgba(60,60,67,.55);
  --surface:    #FFFFFF;
  --bg:         #F2F2F7;
  --border:     rgba(60,60,67,.12);
  --border2:    rgba(60,60,67,.22);
  --green:      #34C759;
  --red:        #FF3B30;
  --orange:     #FF9500;
  --r-sm:       8px;
  --r-md:       12px;
  --r-lg:       16px;
  --r-xl:       20px;
  --shadow-sm:  0 1px 3px rgba(0,0,0,.08),0 1px 2px rgba(0,0,0,.05);
  --shadow-md:  0 4px 16px rgba(0,0,0,.09),0 1px 4px rgba(0,0,0,.05);
  --shadow-lg:  0 12px 40px rgba(0,0,0,.12),0 3px 8px rgba(0,0,0,.06);
  --ease:       cubic-bezier(.4,0,.2,1);
}

/* ── Base ─────────────────────────────────────────────────────────────────── */
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
img { display: block; }

/* ── Login Page Layout ───────────────────────────────────────────────────── */
.page-center {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background: linear-gradient(160deg, #f0f6ff 0%, var(--cream) 100%);
}

/* ── Card ─────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: 44px 40px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}
@media (max-width: 480px) { .card { padding: 36px 24px; border-radius: var(--r-lg); } }

/* ── Typography ───────────────────────────────────────────────────────────── */
h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -.4px;
  color: var(--navy);
  margin-bottom: 6px;
}
h2 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -.2px;
  color: var(--navy);
}
.subtitle {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 28px;
  line-height: 1.55;
}
.section-label {
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

/* ── Form ─────────────────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }

input[type="email"],
input[type="text"],
input[type="url"],
input[type="date"],
select,
textarea {
  border: 1.5px solid var(--border2);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  background: var(--surface);
  width: 100%;
  outline: none;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
  appearance: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(72,152,238,.15);
}
input::placeholder, textarea::placeholder { color: var(--muted); }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 20px;
  border-radius: var(--r-sm);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.1px;
  cursor: pointer;
  border: none;
  transition: all .18s var(--ease);
  white-space: nowrap;
  min-height: 44px;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary  { background: var(--navy); color: #fff; width: 100%; }
.btn-primary:hover:not(:disabled)  { background: var(--blue-dark); }
.btn-secondary {
  background: var(--bg);
  color: var(--text2);
  border: 1px solid var(--border2);
  width: auto;
  font-size: 14px;
  font-weight: 500;
  padding: 9px 16px;
  min-height: 36px;
}
.btn-secondary:hover:not(:disabled) { background: #e8e8ed; }
.btn-danger   { background: #fff0f0; color: var(--red); border: 1px solid rgba(255,59,48,.25); }
.btn-danger:hover:not(:disabled) { background: #ffe5e3; }
.btn-outline  {
  background: transparent;
  color: var(--navy);
  border: 1.5px solid var(--border2);
  font-size: 13px;
  font-weight: 500;
  padding: 7px 14px;
  min-height: 34px;
}
.btn-outline:hover { border-color: var(--blue); color: var(--blue); }

/* ── Alerts ───────────────────────────────────────────────────────────────── */
.alert {
  border-radius: var(--r-sm);
  padding: 12px 16px;
  font-size: 14px;
  margin-bottom: 16px;
  line-height: 1.5;
  border: 1px solid transparent;
}
.alert-success { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.alert-error   { background: #fff1f0; border-color: #ffc5c2; color: #c0392b; }
.alert-info    { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }

/* ── Header ───────────────────────────────────────────────────────────────── */
.header {
  background: rgba(14,62,114,.97);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.header-right { display: flex; align-items: center; gap: 12px; }
.header-email {
  font-size: 13px;
  color: rgba(255,255,255,.65);
  letter-spacing: -.1px;
}
.header .btn-secondary {
  color: rgba(255,255,255,.85);
  background: rgba(255,255,255,.1);
  border-color: rgba(255,255,255,.18);
  font-size: 13px;
  font-weight: 500;
  padding: 7px 14px;
  min-height: 32px;
}
.header .btn-secondary:hover { background: rgba(255,255,255,.18); }

/* ── Admin Tabs ───────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  background: rgba(255,255,255,.08);
  border-radius: 10px;
  padding: 3px;
  margin-right: 8px;
}
.tab {
  padding: 5px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,.65);
  cursor: pointer;
  transition: all .18s var(--ease);
  white-space: nowrap;
  user-select: none;
}
.tab.active { background: rgba(255,255,255,.18); color: #fff; }
.tab:hover:not(.active) { color: rgba(255,255,255,.85); }

/* ── Main Layout ──────────────────────────────────────────────────────────── */
.main { max-width: 860px; margin: 0 auto; padding: 36px 20px 64px; }
@media (max-width: 600px) { .main { padding: 24px 16px 80px; } }

/* ── Section ──────────────────────────────────────────────────────────────── */
.section { margin-bottom: 40px; }

/* ── Content Cards ────────────────────────────────────────────────────────── */
.content-card {
  background: var(--surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.content-card + .content-card { margin-top: 12px; }

/* ── Booking Card ─────────────────────────────────────────────────────────── */
.booking-card {
  background: var(--surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 14px;
  border-left: 3px solid var(--blue);
}
.booking-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 22px 16px;
  flex-wrap: wrap;
}
.booking-card-header h2 { font-size: 15px; font-weight: 600; }
.booking-rows { border-top: 1px solid var(--border); }
.booking-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  padding: 12px 22px;
  gap: 16px;
  border-bottom: 1px solid var(--border);
}
.booking-row:last-child { border-bottom: none; }
.booking-row .label { color: var(--muted); font-size: 13px; }
.booking-row .value { font-weight: 500; color: var(--navy); text-align: right; }
.booking-actions {
  padding: 14px 22px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.booking-list { display: flex; flex-direction: column; }

/* ── Badge ────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -.05px;
  white-space: nowrap;
}
.badge-confirmed { background: rgba(52,199,89,.12); color: #1a7d35; }
.badge-pending   { background: rgba(72,152,238,.12); color: #1a5fa6; }
.badge-approved  { background: rgba(52,199,89,.12); color: #1a7d35; }
.badge-revision  { background: rgba(255,149,0,.12);  color: #a05f00; }
.badge-cancelled { background: rgba(255,59,48,.12);  color: #b02718; }

/* ── Upload Zone ──────────────────────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border2);
  border-radius: var(--r-md);
  padding: 36px 24px;
  text-align: center;
  cursor: pointer;
  transition: all .18s var(--ease);
  background: var(--bg);
  margin-bottom: 14px;
}
.upload-zone:hover, .upload-zone.dragging {
  border-color: var(--blue);
  background: rgba(72,152,238,.04);
}
.upload-zone .upload-icon { font-size: 32px; margin-bottom: 10px; }
.upload-zone p { font-size: 13px; color: var(--muted); margin-top: 4px; line-height: 1.5; }
.upload-zone strong { color: var(--navy); }
#fileInput { display: none; }

.upload-list { display: flex; flex-direction: column; gap: 8px; }
.upload-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}
.upload-item-info { flex: 1; min-width: 0; }
.upload-item-name { font-size: 14px; font-weight: 500; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upload-item-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ── Progress ─────────────────────────────────────────────────────────────── */
.progress-wrap { height: 4px; background: var(--border); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.progress-bar  { height: 100%; background: var(--blue); border-radius: 99px; transition: width .25s var(--ease); }

/* ── Empty State ──────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 36px 24px;
  color: var(--muted);
  font-size: 14px;
  background: var(--surface);
  border-radius: var(--r-md);
  border: 1px solid var(--border);
}
.empty-state-icon { font-size: 36px; margin-bottom: 10px; }
/* Legacy alias */
.empty { text-align: center; padding: 32px; color: var(--muted); font-size: 14px; background: var(--surface); border-radius: var(--r-md); border: 1px dashed var(--border2); }

/* ── Loader ───────────────────────────────────────────────────────────────── */
.loader { text-align: center; padding: 60px 24px; color: var(--muted); font-size: 14px; }
@keyframes pulse { 0%,100% { opacity:.4; } 50% { opacity:1; } }
.loading-pulse { animation: pulse 1.4s ease-in-out infinite; }

/* ── Delivery Card ────────────────────────────────────────────────────────── */
.delivery-card {
  background: var(--surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 16px;
  transition: box-shadow .2s;
}
.delivery-card:hover { box-shadow: var(--shadow-md); }
.delivery-inner { padding: 22px 24px; }
.delivery-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.delivery-title {
  font-size: 15px; font-weight: 700; color: var(--navy);
  letter-spacing: -.2px;
}
.delivery-date {
  font-size: 12px; color: var(--muted);
  margin-bottom: 16px; margin-top: 2px;
}
/* Responsive 16:9 video */
.delivery-video-wrap {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: var(--r-md);
  background: #000;
  margin-bottom: 16px;
}
.delivery-video-wrap iframe {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%; border: 0;
  border-radius: var(--r-md);
}
.delivery-video-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 16px;
  background: var(--bg);
  border: 1px solid var(--border2);
  border-radius: var(--r-sm);
  font-size: 14px; font-weight: 600; color: var(--blue);
  text-decoration: none;
  margin-bottom: 14px;
  transition: background .15s;
}
.delivery-video-link:hover { background: var(--border); }
.delivery-approved-msg {
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: var(--r-sm);
  padding: 12px 14px;
  font-size: 13px; color: #166534; line-height: 1.55;
  margin-top: 8px;
}
.delivery-revision-notes {
  background: #fff8ed;
  border: 1px solid rgba(255,149,0,.25);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  font-size: 13px; color: #a05f00;
  white-space: pre-wrap; line-height: 1.55;
  margin-top: 8px;
}
.delivery-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.btn-approve {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 20px; background: #1a7d35; color: #fff;
  border: none; border-radius: var(--r-sm);
  font-size: 14px; font-weight: 600; font-family: inherit;
  cursor: pointer; min-height: 44px; transition: background .18s;
  letter-spacing: -.1px;
}
.btn-approve:hover:not(:disabled) { background: #16612a; }
.btn-approve:disabled { opacity: .5; cursor: not-allowed; }
.btn-revision-req {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 20px; background: transparent; color: #92400e;
  border: 1.5px solid rgba(180,83,9,.25); border-radius: var(--r-sm);
  font-size: 14px; font-weight: 600; font-family: inherit;
  cursor: pointer; min-height: 44px; transition: all .18s;
  letter-spacing: -.1px;
}
.btn-revision-req:hover { background: rgba(180,83,9,.06); border-color: rgba(180,83,9,.4); }

/* ── Modal Overlay ────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn .18s var(--ease);
}
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }

/* Legacy rm-overlay alias */
.rm-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-box, .rm-box {
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: 32px 28px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-lg);
  animation: slideUp .22s var(--ease);
}
@keyframes slideUp { from { opacity:0; transform:translateY(16px); } to { opacity:1; transform:translateY(0); } }
@media (max-width: 600px) {
  .modal-overlay, .rm-overlay { align-items: flex-end; padding: 0; }
  .modal-box, .rm-box { border-radius: var(--r-xl) var(--r-xl) 0 0; max-height: 88vh; }
}

.modal-close, .rm-close {
  position: absolute; top: 16px; right: 18px;
  background: var(--bg); border: none;
  width: 28px; height: 28px; border-radius: 99px;
  font-size: 16px; cursor: pointer;
  color: var(--muted); line-height: 28px; text-align: center;
  transition: all .15s;
}
.modal-close:hover, .rm-close:hover { background: var(--border2); color: var(--text); }

.modal-title { font-size: 18px; font-weight: 700; letter-spacing: -.3px; color: var(--navy); margin-bottom: 8px; padding-right: 32px; }
.modal-subtitle { font-size: 13px; color: var(--muted); margin-bottom: 20px; line-height: 1.5; }
.modal-actions, .rm-actions {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  margin-top: 20px;
}

/* ── Reschedule Slots ─────────────────────────────────────────────────────── */
.rm-slot-picker { margin-bottom: 22px; padding-bottom: 22px; border-bottom: 1px solid var(--border); }
.rm-slot-picker:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.rm-slot-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 10px; }
.rm-date-input { max-width: 200px; margin-bottom: 10px; }
.rm-time-chips { display: flex; flex-wrap: wrap; gap: 8px; min-height: 34px; }
.rm-time-chip {
  padding: 7px 14px; border-radius: var(--r-sm);
  font-family: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer; border: 1.5px solid var(--border2);
  background: var(--bg); color: var(--text2); transition: all .15s;
}
.rm-time-chip:hover { border-color: var(--blue); color: var(--blue); background: rgba(72,152,238,.05); }
.rm-time-chip.selected { background: var(--navy); color: #fff; border-color: var(--navy); }
.rm-hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.rm-selected-label {
  font-size: 12px; color: #1a7d35; background: #f0fdf4;
  border: 1px solid #bbf7d0; border-radius: var(--r-sm);
  padding: 6px 12px; margin-top: 6px; display: inline-block;
}

/* ── Revision Textarea ────────────────────────────────────────────────────── */
.revision-textarea {
  width: 100%; box-sizing: border-box;
  min-height: 150px; resize: vertical;
  background: var(--bg);
  border: 1.5px solid var(--border2);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  font-size: 14px; font-family: inherit; color: var(--navy);
  line-height: 1.55;
  transition: border-color .15s;
}
.revision-textarea:focus { outline: none; border-color: var(--blue); }

/* ── Admin Grid ───────────────────────────────────────────────────────────── */
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 700px) { .admin-grid { grid-template-columns: 1fr; } }

/* ── Admin Table ──────────────────────────────────────────────────────────── */
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th {
  text-align: left; padding: 10px 14px;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.admin-table td {
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  color: var(--text2); vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--bg); }
.admin-table .name-cell { font-weight: 600; color: var(--navy); }

/* ── Info Block (credits etc.) ────────────────────────────────────────────── */
.info-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .booking-card-header { flex-direction: column; align-items: flex-start; }
  .delivery-actions { flex-direction: column; }
  .btn-approve, .btn-revision-req { width: 100%; justify-content: center; }
  .header { padding: 0 16px; }
  .tabs { display: none; }
}
