/* ══════════════════════════════════════════════════════
   Mountaintop Golf & Lake Club — Materials Order Portal
   Bryson Grading & Paving — Light Mode Brand Theme
   ══════════════════════════════════════════════════════ */

:root {
  /* Bryson brand */
  --black:      #242424;
  --yellow:     #f6c30a; /* kept for logo bg only */
  --yellow-dk:  #d4a408;
  --yellow-lt:  #fef9e7;
  --yellow-mid: #fde68a;
  --red:        #ed0e0b;
  --red-dk:     #b50b09;
  --red-lt:     #fef2f2;
  --brown:      #6a5649;
  --brown-lt:   #f5f0ed;
  --brown-mid:  #d6ccc7;
  --brown-dk:   #4a3c32;

  /* Light mode surfaces */
  --bg:         #f7f4f1;
  --surface:    #ffffff;
  --surface2:   #faf8f6;
  --border:     #e2d9d4;
  --border-dk:  #c8bdb7;

  /* Text */
  --text-primary:   #1a1008;
  --text-secondary: #4a3c32;
  --text-muted:     #8a7568;

  /* Semantic */
  --danger:     #ed0e0b;
  --danger-bg:  #fef2f2;
  --danger-bdr: #fca5a5;
  --success:    #166534;
  --success-bg: #f0fdf4;
  --success-bdr:#86efac;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  --font-sans:  -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --font-serif: Georgia, 'Times New Roman', serif;

  --shadow-sm: 0 1px 3px rgba(106,86,73,0.10);
  --shadow-md: 0 4px 12px rgba(106,86,73,0.14);
  --shadow-lg: 0 8px 28px rgba(106,86,73,0.18);
}

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

/* ── Views ── */
.view { display: none !important; min-height: 100vh; }
.view.active { display: block !important; animation: fadeUp 0.28s ease; }
#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(8px); } to { opacity: 1; transform: translateY(0); } }

/* ══════════════════════════════════════
   AUTH SCREENS
══════════════════════════════════════ */
#login-view,
#register-view,
#forgot-view,
#reset-view {
  background: var(--black);
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  min-height: 100vh;
  border-top: 4px solid var(--red);
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2.25rem 2rem;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
}

.login-logo { text-align: center; margin-bottom: 1.75rem; }
.login-logos-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1rem;
}
.login-logo-bryson {
  width: 72px;
  height: 72px;
  object-fit: contain;
  border-radius: var(--radius-md);
  background: #fff;
  padding: 4px;
  border: 1px solid var(--border);
}
.login-logo-divider {
  width: 1px;
  height: 48px;
  background: var(--border-dk);
  flex-shrink: 0;
}
.login-logo-mt {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 6px;
}
.login-logo h1 {
  font-family: var(--font-serif);
  font-size: 20px;
  color: var(--text-primary);
  line-height: 1.25;
  margin-bottom: .2rem;
}
.login-tagline { font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.login-footer { font-size: 12px; color: var(--text-muted); text-align: center; margin-top: 1.25rem; line-height: 1.8; }
.login-footer a { color: var(--brown-dk); font-weight: 600; }

/* ══════════════════════════════════════
   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-sans);
  font-size: 15px;
  color: var(--text-primary);
  background: var(--surface);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color .2s, box-shadow .2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(237,14,11,0.15);
}
.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='%23b50b09' 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: #fff5f5; color: var(--red-dk); border-color: rgba(237,14,11,.25); }
.form-group input.autofilled:focus { background: var(--surface); color: var(--text-primary); border-color: var(--yellow-dk); }
.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: 4px; }
.autofill-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--red); display: inline-block; flex-shrink: 0; }

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

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

.submit-btn {
  width: 100%;
  padding: 1rem;
  background: var(--red);
  color: var(--surface);
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  letter-spacing: .02em;
}
.submit-btn:hover    { background: var(--red-dk); }
.submit-btn:disabled { opacity: .55; cursor: not-allowed; }
.submit-row { padding: .5rem 0 2.5rem; }

.icon-btn {
  background: rgba(237,14,11,.08);
  border: 1px solid rgba(237,14,11,.25);
  color: var(--red-dk);
  border-radius: var(--radius-sm);
  padding: .4rem .875rem;
  font-size: 12px;
  font-family: var(--font-sans);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background .2s;
}
.icon-btn:hover { background: rgba(237,14,11,.15); }

.forgot-link { font-size: 13px; color: var(--brown-dk); font-weight: 600; cursor: pointer; }
.forgot-link:hover { color: var(--black); }

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

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

.topbar {
  background: var(--black);
  border-bottom: 3px solid var(--red);
  padding: .75rem 1.25rem;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: .75rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.topbar-left { display: flex; align-items: center; justify-content: flex-start; }
.topbar-center { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.topbar-logos { display: flex; align-items: center; gap: .625rem; flex-shrink: 0; }
.topbar-logo-bryson { width: 52px; height: 52px; object-fit: contain; border-radius: var(--radius-sm); background: #fff; padding: 2px; flex-shrink: 0; }
.topbar-logo-divider { width: 1px; height: 32px; background: #555; flex-shrink: 0; }
.topbar-logo-mt { width: 46px; height: 46px; object-fit: contain; border-radius: 50%; background: #fff; padding: 3px; flex-shrink: 0; }
.topbar-title { font-family: var(--font-serif); font-size: 18px; color: #fff; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-sub { font-size: 11px; color: #aaa; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; gap: .5rem; flex-shrink: 0; justify-content: flex-end; }

/* Tab bar */
.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: .85rem 1.1rem;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  border-bottom: 3px solid transparent;
  background: transparent;
  font-family: var(--font-sans);
  white-space: nowrap;
  flex-shrink: 0;
  transition: color .2s, border-color .2s;
}
.tab:hover  { color: var(--red-dk); }
.tab.active { color: var(--red-dk); border-bottom-color: var(--red); }

.tab-content { display: none; padding: 1.25rem; flex: 1; }
.tab-content.active { display: block; }

/* ══════════════════════════════════════
   CARDS
══════════════════════════════════════ */
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}
.form-card-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--brown-dk);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: .875rem;
  padding-bottom: .6rem;
  border-bottom: 2px solid var(--red);
}
.form-card-note { font-size: 13px; color: var(--text-muted); margin-bottom: .75rem; margin-top: -.2rem; 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: box-shadow .2s, border-left-color .2s;
}
.order-card:hover { box-shadow: var(--shadow-md); border-left-color: var(--red-dk); }
.order-card-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: .5rem; }
.order-number { font-size: 13px; font-weight: 700; color: var(--red-dk); }
.order-material { font-size: 15px; color: var(--text-primary); margin-bottom: .25rem; font-weight: 600; }
.order-detail { font-size: 13px; color: var(--text-secondary); }

/* Badges */
.badge { display: inline-flex; align-items: center; padding: .22rem .65rem; border-radius: 100px; font-size: 11px; font-weight: 700; }
.badge-pending   { background: #fff7ed;  color: #92400e;  border: 1px solid #fed7aa; }
.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(--danger-bg);  color: var(--red-dk);    border: 1px solid var(--danger-bdr); }

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

/* Section headers */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.section-title { font-family: var(--font-serif); font-size: 20px; color: var(--text-primary); font-weight: 500; }
.page-header { margin-bottom: 1.25rem; }
.page-sub { font-size: 13px; color: var(--text-muted); margin-top: .25rem; }

/* 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: .75rem; }
.empty-state-icon { font-size: 2.5rem; margin-bottom: .5rem; opacity: .5; }

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

/* Notice box */
.notice-box { background: var(--red-lt); padding: .75rem; border-radius: var(--radius-md); border: 1px solid rgba(237,14,11,.2); font-size: 12px; color: var(--red-dk); line-height: 1.6; margin-bottom: 1rem; }

/* Responsive */
@media (max-width: 520px) {
  .form-row { grid-template-columns: 1fr; }
  .form-group.span2 { grid-column: span 1; }
  .topbar { grid-template-columns: auto 1fr auto; gap: .4rem; padding: .6rem .75rem; }
  .topbar-title { font-size: 13px; }
  .topbar-logo-bryson { width: 38px; height: 38px; }
  .topbar-logo-mt { width: 34px; height: 34px; }
  .topbar-logo-divider { height: 24px; }
  .login-card { padding: 1.75rem 1.25rem; }
  .icon-btn { padding: .35rem .55rem; font-size: 11px; }
}
