/* ══════════════════════════════════════════════════════
   Bryson Grading & Paving — Public Order Portal
   Light mode — bold brand, clean and readable
   ══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@600;700;800&family=DM+Sans:wght@300;400;500&display=swap');

:root {
  --black:    #242424;
  --red:      #ed0e0b;
  --red-dk:   #b50b09;
  --red-lt:   #ff3330;
  --red-bg:   #fff2f2;
  --red-bdr:  #fca5a5;
  --red-glow: rgba(237,14,11,0.15);

  --yellow:   #f6c30a;
  --yellow-dk:#d4a408;
  --yellow-bg:#fefce8;

  --bg:       #f4f4f4;
  --surface:  #ffffff;
  --surface2: #f9f9f9;
  --border:   #e0e0e0;
  --border-dk:#cccccc;

  --text-primary:   #1a1a1a;
  --text-secondary: #444444;
  --text-muted:     #888888;

  --success:    #166534;
  --success-bg: #f0fdf4;
  --success-bdr:#86efac;

  --font-display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --font-body:    'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.08);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.10);
  --shadow-lg:  0 8px 28px rgba(0,0,0,0.13);
  --shadow-red: 0 4px 16px rgba(237,14,11,0.25);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}
a { color: var(--red-dk); text-decoration: none; transition: color .2s; }
a:hover { color: var(--black); }

/* ── Views ── */
.view { display: none !important; min-height: 100vh; }
.view.active { display: block !important; animation: fadeUp .3s cubic-bezier(.22,.68,0,1.2); }
#login-view.active,
#register-view.active,
#forgot-view.active,
#reset-view.active { display: flex !important; }
#app-view.active   { display: flex !important; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ══════════════════════════════════════
   AUTH SHELL — split layout
══════════════════════════════════════ */
.auth-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* Left brand panel */
.auth-brand {
  flex: 0 0 42%;
  background: var(--black);
  border-right: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 3rem 2.5rem;
  position: relative;
  overflow: hidden;
}
.auth-brand::before {
  content: '';
  position: absolute;
  top: -80px; left: -80px;
  width: 320px; height: 320px;
  background: var(--red);
  opacity: .07;
  border-radius: 50%;
  pointer-events: none;
}
.auth-brand::after {
  content: '';
  position: absolute;
  bottom: -60px; right: -60px;
  width: 240px; height: 240px;
  background: var(--yellow);
  opacity: .05;
  border-radius: 50%;
  pointer-events: none;
}

.auth-logo {
  width: 160px;
  height: 160px;
  object-fit: contain;
  margin-bottom: 1.75rem;
  animation: logoIn .5s cubic-bezier(.22,.68,0,1.2) .1s both;
}
@keyframes logoIn {
  from { opacity: 0; transform: scale(.85); }
  to   { opacity: 1; transform: scale(1); }
}

.auth-headline {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 5vw, 3.75rem);
  font-weight: 800;
  color: #ffffff;
  line-height: .95;
  letter-spacing: -.01em;
  margin-bottom: .75rem;
  animation: slideRight .5s cubic-bezier(.22,.68,0,1.2) .2s both;
}
@keyframes slideRight {
  from { opacity: 0; transform: translateX(-16px); }
  to   { opacity: 1; transform: translateX(0); }
}

.auth-sub {
  font-size: 13px;
  color: #aaaaaa;
  font-weight: 300;
  letter-spacing: .03em;
  animation: slideRight .5s cubic-bezier(.22,.68,0,1.2) .25s both;
}

.auth-divider {
  width: 48px;
  height: 3px;
  background: var(--red);
  margin: 1.5rem 0;
  animation: growIn .4s ease .35s both;
}
@keyframes growIn {
  from { width: 0; opacity: 0; }
  to   { width: 48px; opacity: 1; }
}

.auth-tagline {
  font-size: 14px;
  color: #cccccc;
  line-height: 1.6;
  animation: slideRight .5s cubic-bezier(.22,.68,0,1.2) .4s both;
}
.auth-tagline a { color: var(--yellow); font-weight: 500; }
.auth-tagline a:hover { color: #fff; }

/* Right form panel */
.auth-card {
  flex: 1;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 3rem 2.5rem;
  overflow-y: auto;
  animation: fadeUp .4s ease .15s both;
}

.auth-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  margin-top: .875rem;
  font-size: 13px;
  color: var(--text-muted);
}
.auth-links a { color: var(--text-secondary); font-weight: 500; }
.auth-links a:hover { color: var(--red); }
.auth-links-sep { color: var(--border-dk); }
.auth-foot { font-size: 12px; color: var(--text-muted); text-align: center; margin-top: 1.25rem; line-height: 1.7; }
.auth-foot a { color: var(--red-dk); font-weight: 500; }

/* ══════════════════════════════════════
   FORM ELEMENTS
══════════════════════════════════════ */
.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: .4rem;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: .7rem .9rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--text-primary);
  background: var(--surface);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-glow);
  background: var(--surface);
}
.form-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23ed0e0b' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .9rem center;
  padding-right: 2.4rem;
  cursor: pointer;
}
.form-group textarea { resize: vertical; min-height: 90px; line-height: 1.6; }
.form-group input[type=date] { color: var(--text-primary); }
.form-group input.autofilled { background: var(--red-bg); color: var(--red-dk); border-color: var(--red-bdr); }
.form-group input.autofilled:focus { background: var(--surface); color: var(--text-primary); border-color: var(--red); }
.readonly-field { background: var(--surface2) !important; color: var(--text-muted) !important; cursor: not-allowed; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.form-group.span2 { grid-column: span 2; }

.req { color: var(--red); margin-left: 2px; }
.field-hint { font-size: 12px; color: var(--text-muted); margin-top: .35rem; display: block; }
.autofill-note { font-size: 11px; color: var(--text-muted); margin-top: .3rem; display: flex; align-items: center; gap: 5px; }
.autofill-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--red); flex-shrink: 0; }

/* Same-as-billing checkbox */
.same-address-row { margin-bottom: 1rem; }
.checkbox-label {
  display: flex;
  align-items: center;
  gap: .625rem;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-secondary);
  user-select: none;
}
.checkbox-label input[type=checkbox] { display: none; }
.checkbox-custom {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-dk);
  border-radius: 4px;
  background: var(--surface);
  flex-shrink: 0;
  transition: background .2s, border-color .2s;
  position: relative;
}
.checkbox-label input:checked + .checkbox-custom { background: var(--red); border-color: var(--red); }
.checkbox-label input:checked + .checkbox-custom::after {
  content: '';
  position: absolute;
  top: 2px; left: 5px;
  width: 5px; height: 9px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}
#location-fields.hidden { display: none; }

/* ══════════════════════════════════════
   BUTTONS
══════════════════════════════════════ */
.btn-primary {
  width: 100%;
  padding: .85rem;
  background: var(--red);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .06em;
  cursor: pointer;
  transition: background .2s, box-shadow .2s, transform .1s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
}
.btn-primary:hover  { background: var(--red-lt); box-shadow: var(--shadow-red); }
.btn-primary:active { transform: scale(.99); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }

.btn-secondary {
  padding: .6rem 1.25rem;
  background: var(--surface2);
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: .75rem;
  transition: background .2s, border-color .2s, color .2s;
}
.btn-secondary:hover { background: var(--red-bg); border-color: var(--red); color: var(--red-dk); }

.submit-btn {
  width: 100%;
  padding: 1.1rem;
  background: var(--red);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: .08em;
  cursor: pointer;
  transition: background .2s, box-shadow .2s, transform .1s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .625rem;
}
.submit-btn:hover    { background: var(--red-lt); box-shadow: var(--shadow-red); }
.submit-btn:active   { transform: scale(.995); }
.submit-btn:disabled { opacity: .5; cursor: not-allowed; }
.submit-row { padding: .5rem 0 3rem; }

.icon-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: .4rem .75rem;
  font-size: 12px;
  font-family: var(--font-body);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .2s, color .2s, border-color .2s;
  letter-spacing: .03em;
}
.icon-btn:hover { background: var(--red); border-color: var(--red); color: #fff; }
.icon-btn-out:hover { background: var(--surface2); border-color: var(--border-dk); color: var(--text-primary); }

/* ══════════════════════════════════════
   ALERTS
══════════════════════════════════════ */
.alert { padding: .875rem 1rem; border-radius: var(--radius-md); font-size: 14px; margin-bottom: 1rem; line-height: 1.5; }
.alert-error   { background: var(--red-bg);     color: var(--red-dk);  border: 1px solid var(--red-bdr); }
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid var(--success-bdr); }

.success-banner {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-bdr);
  border-left: 4px solid var(--success);
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
}

.notice-box {
  background: var(--yellow-bg);
  border: 1px solid rgba(246,195,10,.4);
  border-radius: var(--radius-md);
  padding: .75rem 1rem;
  font-size: 12px;
  color: #7a5c08;
  line-height: 1.6;
  margin-bottom: 1rem;
}

/* ══════════════════════════════════════
   APP SHELL
══════════════════════════════════════ */
#app-view { display: none; flex-direction: column; min-height: 100vh; }

.topbar {
  background: var(--black);
  border-bottom: 3px solid var(--red);
  padding: .6rem 1.25rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,.2);
}
.topbar-logo-wrap { flex-shrink: 0; }
.topbar-logo { width: 52px; height: 52px; object-fit: contain; display: block; }
.topbar-center { text-align: center; }
.topbar-title {
  display: block;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: .04em;
  line-height: 1.1;
}
.topbar-sub { display: block; font-size: 11px; color: #aaaaaa; margin-top: 1px; }
.topbar-actions { display: flex; gap: .4rem; justify-content: flex-end; }

/* Tabs */
.tab-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 1.25rem;
  display: flex;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: var(--shadow-sm);
}
.tab-bar::-webkit-scrollbar { display: none; }
.tab {
  padding: .875rem 1.25rem;
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-body);
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  border-bottom: 3px solid transparent;
  background: transparent;
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: .05em;
  text-transform: uppercase;
  transition: color .2s, border-color .2s;
}
.tab:hover  { color: var(--text-primary); }
.tab.active { color: var(--red-dk); border-bottom-color: var(--red); }

.tab-content { display: none; padding: 1.25rem; }
.tab-content.active { display: block; animation: fadeUp .25s ease; }

/* ══════════════════════════════════════
   CARDS
══════════════════════════════════════ */
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.375rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
  transition: border-color .2s, box-shadow .2s;
}
.form-card:focus-within { border-color: var(--border-dk); box-shadow: var(--shadow-md); }

.form-card-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: .05em;
  text-transform: uppercase;
  margin-bottom: 1rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: .625rem;
}
.card-num {
  font-size: 11px;
  font-weight: 800;
  color: var(--red);
  background: var(--red-bg);
  border: 1px solid var(--red-bdr);
  border-radius: 4px;
  padding: .1rem .4rem;
  letter-spacing: .04em;
  min-width: 28px;
  text-align: center;
  flex-shrink: 0;
}
.form-card-note { font-size: 13px; color: var(--text-muted); margin-bottom: .875rem; margin-top: -.25rem; font-style: italic; line-height: 1.5; }

/* Order cards */
.order-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--red);
  border-radius: var(--radius-lg);
  padding: 1rem 1.125rem;
  margin-bottom: .75rem;
  box-shadow: var(--shadow-sm);
  transition: border-left-color .2s, box-shadow .2s, transform .2s;
}
.order-card:hover { transform: translateX(3px); box-shadow: var(--shadow-md); border-left-color: var(--yellow-dk); }
.order-card-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: .5rem; }
.order-number { font-family: var(--font-display); font-size: 14px; font-weight: 700; color: var(--red-dk); letter-spacing: .04em; }
.order-material { font-size: 15px; color: var(--text-primary); margin-bottom: .25rem; font-weight: 600; }
.order-detail { font-size: 13px; color: var(--text-muted); }

/* Badges */
.badge { display: inline-flex; align-items: center; padding: .22rem .65rem; border-radius: 100px; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.badge-pending   { background: var(--yellow-bg); color: #7a5c08;        border: 1px solid rgba(246,195,10,.4); }
.badge-confirmed { background: #eff6ff;           color: #1d4ed8;        border: 1px solid #bfdbfe; }
.badge-delivered { background: var(--success-bg); color: var(--success); border: 1px solid var(--success-bdr); }
.badge-cancelled { background: var(--red-bg);     color: var(--red-dk);  border: 1px solid var(--red-bdr); }

/* Conditional blocks */
.conditional-block { display: none; margin-top: .75rem; padding: 1rem; background: var(--surface2); border-radius: var(--radius-md); border: 1px solid var(--border); }
.conditional-block.visible { display: block; animation: fadeUp .2s ease; }

/* Section headers */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.section-title { font-family: var(--font-display); font-size: 22px; font-weight: 700; color: var(--text-primary); letter-spacing: .03em; text-transform: uppercase; }
.page-header { margin-bottom: 1.5rem; }
.page-sub { font-size: 13px; color: var(--text-muted); margin-top: .3rem; }

/* Loading / empty */
.loading-state, .empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.loading-state p, .empty-state p { font-size: 14px; margin-top: .875rem; line-height: 1.6; }
.empty-icon { font-size: 2.5rem; margin-bottom: .5rem; opacity: .4; display: block; }

/* Spinners */
.spinner { width: 16px; height: 16px; border: 2px solid rgba(237,14,11,.25); border-top-color: var(--red); border-radius: 50%; animation: spin .65s linear infinite; display: inline-block; }
.spinner-lg { width: 36px; height: 36px; border: 3px solid var(--border); border-top-color: var(--red); border-radius: 50%; animation: spin .65s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Responsive */
@media (max-width: 700px) {
  .auth-shell { flex-direction: column; }
  .auth-brand { flex: none; padding: 2rem 1.5rem 1.5rem; border-bottom: 1px solid #333; }
  .auth-logo { width: 100px; height: 100px; }
  .auth-headline { font-size: 2.5rem; }
  .auth-card { padding: 1.75rem 1.25rem; }
}
@media (max-width: 520px) {
  .form-row { grid-template-columns: 1fr; }
  .form-group.span2 { grid-column: span 1; }
  .topbar { gap: .5rem; padding: .5rem .875rem; }
  .topbar-title { font-size: 16px; }
  .topbar-logo { width: 40px; height: 40px; }
}
