/* ─────────────────────────────────────────────────────
   Saladino Smoke — Ordering Portal
   Matches staff.saladinocatering.com design language
───────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Abel&family=Source+Code+Pro:wght@400;600;700&display=swap');

:root {
  --red:        #A74D4A;
  --red-dark:   #8C3E3B;
  --red-light:  #C46A67;
  --dark:       #121212;
  --dark-soft:  #2A2A2A;
  --dark-card:  #1E1E1E;
  --dark-input: #252525;
  --cream:      #F5F5F5;
  --gray-400:   #BBBBBB;
  --gray-500:   #888;
  --gray-600:   #555;
  --success:    #4A8C5C;
  --success-lt: #6DBF86;
  --warning:    #C4963A;
  --error:      #C44A4A;
  --border:     #252525;
  --border-lt:  #333;
  --font-h:     'Abel', sans-serif;
  --font-b:     'Source Code Pro', monospace;
  --radius:     4px;
  --shadow:     0 2px 12px rgba(0,0,0,.45);
  --shadow-lg:  0 12px 40px rgba(0,0,0,.55);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }

body {
  font-family: var(--font-b);
  background: var(--dark);
  color: var(--cream);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--red-light); text-decoration: none; }
a:hover { color: var(--red); }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--dark); }
::-webkit-scrollbar-thumb { background: var(--dark-soft); border-radius: 3px; }

/* ════════════════════════════════════════
   SITE HEADER (matches staff portal)
════════════════════════════════════════ */
.site-header {
  background: var(--red);
  padding: .9rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-brand {
  text-align: center;
  flex: 1;
}

.logo-text {
  font-family: var(--font-h);
  font-size: 1.6rem;
  color: var(--cream);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.logo-sub {
  font-size: .62rem;
  color: rgba(245,245,245,.72);
  letter-spacing: 3px;
  text-transform: uppercase;
  display: block;
  margin-top: 2px;
}

.header-side {
  min-width: 140px;
}

.header-user {
  text-align: right;
}

.header-user-email {
  font-size: .72rem;
  color: rgba(245,245,245,.75);
  display: block;
  margin-bottom: .3rem;
}

/* ════════════════════════════════════════
   BUTTONS
════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-b);
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  cursor: pointer;
  border-radius: var(--radius);
  transition: all .2s;
  text-decoration: none;
  white-space: nowrap;
}

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

.btn-logout {
  background: rgba(0,0,0,.2);
  border: 1px solid rgba(245,245,245,.25);
  color: var(--cream);
  padding: .28rem .7rem;
}
.btn-logout:hover { background: rgba(0,0,0,.4); color: var(--cream); }

.btn-primary {
  background: var(--red);
  color: var(--cream);
  border: none;
  padding: .85rem 1.2rem;
}
.btn-primary:hover { background: var(--red-dark); color: var(--cream); }

.btn-primary-full {
  width: 100%;
  justify-content: center;
  background: var(--red);
  color: var(--cream);
  border: none;
  padding: .85rem;
  font-size: .9rem;
  margin-top: .25rem;
}
.btn-primary-full:hover { background: var(--red-dark); }

.btn-sm {
  background: #252525;
  border: 1px solid var(--border-lt);
  color: var(--gray-400);
  padding: .28rem .65rem;
}
.btn-sm:hover { border-color: var(--red-light); color: var(--red-light); }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-lt);
  color: var(--gray-500);
  padding: .28rem .65rem;
}
.btn-ghost:hover { color: var(--cream); border-color: #555; }

/* ════════════════════════════════════════
   LOGIN PAGE
════════════════════════════════════════ */
.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.login-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.login-card {
  background: var(--dark-card);
  border: 1px solid #2E2E2E;
  border-radius: 8px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo .logo-text {
  font-size: 2.1rem;
  color: var(--red-light);
  display: block;
}

.login-logo .logo-sub {
  color: var(--gray-500);
  font-size: .68rem;
}

.login-tagline {
  font-size: .8rem;
  color: var(--gray-500);
  text-align: center;
  margin-bottom: 1.75rem;
  line-height: 1.5;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: .68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--gray-400);
  margin-bottom: .4rem;
}

.form-group input {
  width: 100%;
  background: var(--dark-input);
  border: 1.5px solid #3A3A3A;
  border-radius: var(--radius);
  color: var(--cream);
  font-family: var(--font-b);
  font-size: .88rem;
  padding: .65rem .75rem;
  outline: none;
  transition: border-color .2s;
}

.form-group input:focus { border-color: var(--red); }
.form-group input::placeholder { color: var(--gray-600); }

.login-error {
  font-size: .75rem;
  color: var(--error);
  margin-top: .4rem;
  background: rgba(196,74,74,.08);
  border: 1px solid rgba(196,74,74,.2);
  border-radius: var(--radius);
  padding: .45rem .65rem;
}

.login-error[hidden] { display: none; }

.login-footer-note {
  text-align: center;
  font-size: .65rem;
  color: var(--gray-600);
  margin-top: 1.5rem;
}

/* ════════════════════════════════════════
   DASHBOARD LAYOUT
════════════════════════════════════════ */
.dashboard-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Tab bar — matches staff portal */
.tab-bar {
  display: flex;
  gap: 0;
  margin-bottom: 0;
  border-bottom: 2px solid var(--dark-soft);
  background: var(--dark);
  padding: 0 1rem;
}

.tab-btn {
  background: none;
  border: none;
  color: var(--gray-500);
  font-family: var(--font-b);
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: .75rem 1.25rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all .2s;
}

.tab-btn:hover { color: var(--cream); }
.tab-btn.active { color: var(--red-light); border-bottom-color: var(--red); }

/* ════════════════════════════════════════
   MAIN CONTENT AREA
════════════════════════════════════════ */
.app-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
  width: 100%;
}

.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* Section header — matches staff portal */
.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  gap: 1rem;
}

.section-title {
  font-family: var(--font-h);
  font-size: 1.6rem;
  color: var(--cream);
}

.section-sub {
  font-size: .72rem;
  color: var(--gray-500);
  margin-top: .1rem;
}

/* ════════════════════════════════════════
   GENERATE TAB
════════════════════════════════════════ */
.gen-card {
  background: var(--dark-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
}

.gen-card-title {
  font-family: var(--font-h);
  font-size: 1.15rem;
  color: var(--cream);
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: .65rem;
}

.date-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: .35rem;
}

.field-group label {
  font-size: .68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--gray-400);
}

.field-group input {
  background: var(--dark-input);
  border: 1.5px solid #3A3A3A;
  border-radius: var(--radius);
  color: var(--cream);
  font-family: var(--font-b);
  font-size: .85rem;
  padding: .55rem .7rem;
  outline: none;
  transition: border-color .2s;
}

.field-group input:focus { border-color: var(--red); }

.btn-row {
  display: flex;
  gap: .65rem;
  flex-wrap: wrap;
}

.btn-gen {
  background: var(--red);
  color: var(--cream);
  border: none;
  padding: .6rem 1.1rem;
  font-family: var(--font-b);
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-gen:hover { background: var(--red-dark); }
.btn-gen:disabled { opacity: .4; cursor: not-allowed; }

.btn-email {
  background: #252525;
  color: var(--gray-400);
  border: 1px solid var(--border-lt);
  padding: .6rem 1.1rem;
  font-family: var(--font-b);
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all .2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-email:hover { border-color: var(--red-light); color: var(--red-light); }
.btn-email:disabled { opacity: .4; cursor: not-allowed; }

/* Status messages */
.status-msg {
  margin-top: .85rem;
  padding: .65rem .85rem;
  background: var(--dark-soft);
  border-radius: var(--radius);
  font-size: .78rem;
  color: var(--gray-400);
  display: flex;
  align-items: center;
  gap: .5rem;
}

.status-msg[hidden] { display: none; }
.status-msg.ok    { color: var(--success-lt); background: rgba(74,140,92,.1); border: 1px solid rgba(74,140,92,.2); }
.status-msg.warn  { color: var(--warning); }
.status-msg.error { color: var(--error); background: rgba(196,74,74,.08); border: 1px solid rgba(196,74,74,.2); }

.doc-links {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin-top: .65rem;
}

.doc-link {
  background: rgba(167,77,74,.12);
  border: 1px solid rgba(196,106,103,.25);
  color: var(--red-light);
  border-radius: 20px;
  font-size: .7rem;
  font-weight: 700;
  padding: .25rem .7rem;
  cursor: pointer;
  font-family: var(--font-b);
  text-transform: uppercase;
  letter-spacing: .4px;
  transition: background .15s;
}

.doc-link:hover { background: rgba(167,77,74,.22); }

/* Spinner */
.spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid #3A3A3A;
  border-top-color: var(--red-light);
  border-radius: 50%;
  animation: spin .65s linear infinite;
  vertical-align: middle;
  flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ════════════════════════════════════════
   DOC LIST (recent + archive)
════════════════════════════════════════ */
.doc-list {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.doc-list-empty {
  font-size: .78rem;
  color: var(--gray-600);
  padding: .85rem 0;
  text-align: center;
}

.doc-row {
  background: var(--dark-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-lt);
  border-radius: 5px;
  padding: .75rem 1rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  cursor: pointer;
  transition: border-color .2s, background .15s;
}

.doc-row:hover { border-left-color: var(--red-light); background: #1a1a1a; }

.doc-row.type-workorder  { border-left-color: rgba(196,106,103,.5); }
.doc-row.type-order-guide { border-left-color: rgba(74,140,92,.5); }

.doc-icon { font-size: 1rem; flex-shrink: 0; }

.doc-name {
  flex: 1;
  font-size: .82rem;
  font-weight: 600;
  color: var(--cream);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.doc-date {
  font-size: .68rem;
  color: var(--gray-500);
  flex-shrink: 0;
}

.doc-print-btn {
  background: none;
  border: 1px solid #333;
  color: var(--gray-600);
  border-radius: var(--radius);
  font-size: .65rem;
  padding: .2rem .45rem;
  cursor: pointer;
  font-family: var(--font-b);
  transition: all .15s;
  flex-shrink: 0;
}

.doc-print-btn:hover { border-color: var(--gray-500); color: var(--cream); }

/* ════════════════════════════════════════
   ARCHIVE TAB
════════════════════════════════════════ */
.archive-controls {
  display: flex;
  align-items: flex-end;
  gap: .65rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.archive-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.archive-group { display: flex; flex-direction: column; gap: .5rem; }

.archive-week-label {
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--gray-600);
  padding: .3rem 0;
  border-bottom: 1px solid #222;
  margin-bottom: .3rem;
}

/* ════════════════════════════════════════
   SHEET TAB — full-width, fills viewport
════════════════════════════════════════ */
.sheet-fullwidth {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 116px); /* viewport minus header + tab bar */
  padding: 0;
}

.sheet-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .85rem 1.25rem;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}

.sheet-embed-wrap {
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

.sheet-embed {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  background: #fff;
}

/* ════════════════════════════════════════
   DOCUMENT VIEWER MODAL
════════════════════════════════════════ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.82);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.modal-backdrop[hidden] { display: none; }

.modal {
  background: var(--dark-card);
  border: 1px solid #303030;
  border-radius: 8px;
  width: 100%;
  max-width: 960px;
  height: 90vh;
  max-height: 860px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  align-items: center;
  padding: .85rem 1.1rem;
  border-bottom: 1px solid var(--border);
  gap: .75rem;
  flex-shrink: 0;
  background: var(--dark-soft);
  border-radius: 8px 8px 0 0;
}

.modal-title {
  flex: 1;
  font-family: var(--font-h);
  font-size: 1.1rem;
  color: var(--cream);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal-actions {
  display: flex;
  gap: .5rem;
  align-items: center;
  flex-shrink: 0;
}

.modal-close {
  background: rgba(0,0,0,.3);
  border: 1px solid rgba(245,245,245,.15);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: .85rem;
  color: var(--cream);
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
  flex-shrink: 0;
  font-family: var(--font-b);
}

.modal-close:hover { background: rgba(196,74,74,.3); }

.modal-body {
  flex: 1;
  overflow: hidden;
  border-radius: 0 0 8px 8px;
}

.doc-preview {
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
  display: block;
}

/* ════════════════════════════════════════
   TOAST
════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  padding: .75rem 1rem;
  border-radius: var(--radius);
  font-family: var(--font-b);
  font-size: .78rem;
  color: var(--cream);
  background: var(--dark-soft);
  border: 1px solid var(--border-lt);
  box-shadow: var(--shadow);
  z-index: 400;
  min-width: 220px;
  animation: toast-in .2s ease;
}

.toast[hidden] { display: none; }
.toast-info    { border-color: var(--border-lt); }
.toast-success { border-color: rgba(74,140,92,.5); color: var(--success-lt); }
.toast-error   { border-color: rgba(196,74,74,.4); color: var(--error); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════ */
@media (max-width: 640px) {
  .date-row    { grid-template-columns: 1fr; }
  .btn-row     { flex-direction: column; }
  .tab-btn     { padding: .65rem .85rem; font-size: .7rem; }
  .modal       { height: 100vh; max-height: none; border-radius: 0; }
  .header-side { display: none; }
  .app-container { padding: 1rem .75rem 3rem; }
}
