/* ============================================================
   DESERT SAGE DRAFTING — Portal & Admin Shared Styles
   ============================================================ */

/* ── Portal Layout ── */
.portal-wrapper {
  display: flex;
  min-height: 100vh;
  background: var(--cream);
}

/* ── Sidebar ── */
.portal-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--charcoal);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform 0.3s var(--ease);
}

.sidebar-logo {
  padding: 1.5rem 1.5rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-logo img {
  height: 40px;
  width: auto;
  filter: brightness(0) invert(1);
  opacity: 0.9;
}
.sidebar-logo .sidebar-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.35);
  margin-top: 0.4rem;
}

.sidebar-user {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.sidebar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--sage);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
  overflow: hidden;
}
.sidebar-avatar img { width: 100%; height: 100%; object-fit: cover; }
.sidebar-user-info { min-width: 0; }
.sidebar-user-name {
  font-size: 0.88rem;
  font-weight: 500;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.4);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0;
  overflow-y: auto;
}

.sidebar-section-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.25);
  padding: 0.75rem 1.5rem 0.4rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1.5rem;
  font-size: 0.88rem;
  color: rgba(255,255,255,0.6);
  border-left: 3px solid transparent;
  transition: all 0.2s ease;
  margin: 0.1rem 0;
}
.sidebar-link svg { width: 16px; height: 16px; flex-shrink: 0; }
.sidebar-link:hover {
  color: white;
  background: rgba(255,255,255,0.06);
}
.sidebar-link.active {
  color: white;
  background: rgba(92,122,92,0.2);
  border-left-color: var(--sage-light);
}

.sidebar-badge {
  margin-left: auto;
  background: var(--terracotta);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar-footer a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.82rem;
  color: rgba(255,255,255,0.4);
  padding: 0.4rem 0;
  transition: color 0.2s;
}
.sidebar-footer a:hover { color: rgba(255,255,255,0.8); }
.sidebar-footer a svg { width: 14px; height: 14px; }

/* ── Main Content Area ── */
.portal-main {
  flex: 1;
  margin-left: 260px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.portal-topbar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.portal-topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.portal-page-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--charcoal);
  letter-spacing: 0.01em;
}
.portal-breadcrumb {
  font-size: 0.8rem;
  color: var(--charcoal-light);
}
.portal-breadcrumb a { color: var(--sage); }

.portal-topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.topbar-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--charcoal-mid);
  transition: background var(--trans);
  position: relative;
}
.topbar-icon-btn:hover { background: var(--cream-dark); }
.topbar-icon-btn svg { width: 18px; height: 18px; }
.topbar-notif-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--terracotta);
  border: 1.5px solid white;
}

.portal-content {
  flex: 1;
  padding: 2rem;
  max-width: 1100px;
  width: 100%;
}

/* ── Portal Cards / Stats ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-icon.green  { background: var(--sage-mist); color: var(--sage); }
.stat-icon.sand   { background: #FAF3E8; color: var(--sand-dark); }
.stat-icon.terra  { background: #FBF0EB; color: var(--terracotta); }
.stat-icon.blue   { background: #EBF2FB; color: #3B82F6; }
.stat-icon svg { width: 20px; height: 20px; }

.stat-info { min-width: 0; }
.stat-value {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 500;
  color: var(--charcoal);
  line-height: 1;
  margin-bottom: 0.2rem;
}
.stat-label {
  font-size: 0.78rem;
  color: var(--charcoal-light);
  letter-spacing: 0.04em;
}

/* ── Project Card ── */
.project-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--trans);
}
.project-card:hover {
  box-shadow: 0 8px 32px rgba(0,0,0,0.08);
  border-color: var(--sage-light);
}

.project-card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.project-card-title {
  font-weight: 600;
  font-size: 1rem;
  color: var(--charcoal);
}
.project-card-type {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sage);
  background: var(--sage-mist);
  padding: 0.2rem 0.6rem;
  border-radius: 2px;
}

.project-card-body { padding: 1.5rem; }

/* ── Status Tracker ── */
.status-tracker {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 1rem 0;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.status-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 80px;
  position: relative;
}

.status-step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 14px;
  left: 50%;
  width: 100%;
  height: 2px;
  background: var(--border);
  z-index: 0;
}
.status-step.done:not(:last-child)::after,
.status-step.active:not(:last-child)::after {
  background: var(--sage);
}

.status-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--cream);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  z-index: 1;
  transition: all 0.3s ease;
}
.status-step.done .status-dot {
  background: var(--sage);
  border-color: var(--sage);
  color: white;
}
.status-step.active .status-dot {
  background: white;
  border-color: var(--sage);
  border-width: 3px;
  box-shadow: 0 0 0 4px rgba(92,122,92,0.15);
}

.status-step-label {
  font-size: 0.65rem;
  text-align: center;
  color: var(--charcoal-light);
  margin-top: 0.4rem;
  letter-spacing: 0.02em;
  line-height: 1.3;
}
.status-step.done .status-step-label,
.status-step.active .status-step-label {
  color: var(--sage-dark);
  font-weight: 500;
}

/* ── Invoice Table ── */
.invoice-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.invoice-table th {
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--charcoal-light);
  padding: 0.75rem 1rem;
  border-bottom: 2px solid var(--border);
}
.invoice-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--charcoal-mid);
  vertical-align: middle;
}
.invoice-table tr:last-child td { border-bottom: none; }
.invoice-table tr:hover td { background: var(--cream); }

.invoice-amount {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--charcoal);
  font-weight: 500;
}

.status-pill {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.status-pill.unpaid  { background: #FEF3EE; color: var(--terracotta); }
.status-pill.paid    { background: var(--sage-mist); color: var(--sage-dark); }
.status-pill.overdue { background: #FEE; color: #c00; }

/* ── Upload Zone ── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--cream);
}
.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--sage);
  background: var(--sage-mist);
}
.upload-zone svg { width: 36px; height: 36px; color: var(--sage-light); margin: 0 auto 0.75rem; }
.upload-zone p { font-size: 0.9rem; color: var(--charcoal-light); }
.upload-zone strong { color: var(--sage); }

.upload-progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 0.5rem;
}
.upload-progress-fill {
  height: 100%;
  background: var(--sage);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.file-list { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 1rem; }
.file-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.88rem;
}
.file-item svg { width: 16px; height: 16px; color: var(--sage); flex-shrink: 0; }
.file-item-name { flex: 1; color: var(--charcoal); font-weight: 500; }
.file-item-size { color: var(--charcoal-light); font-size: 0.78rem; }
.file-item-status { font-size: 0.72rem; font-weight: 600; }
.file-item-status.done  { color: var(--sage); }
.file-item-status.error { color: var(--terracotta); }

/* ── Section Panel ── */
.panel {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 1.5rem;
}
.panel-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.panel-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--charcoal);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.panel-title svg { width: 16px; height: 16px; color: var(--sage); }
.panel-body { padding: 1.5rem; }

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--charcoal-light);
}
.empty-state svg { width: 48px; height: 48px; margin: 0 auto 1rem; opacity: 0.3; }
.empty-state h4 { font-size: 1rem; color: var(--charcoal-mid); margin-bottom: 0.4rem; }
.empty-state p { font-size: 0.88rem; }

/* ── Auth Page (login/register) ── */
.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--cream);
}

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
}

.auth-box {
  width: 100%;
  max-width: 440px;
}

.auth-logo {
  margin-bottom: 2rem;
}
.auth-logo img { height: 48px; }

.auth-tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 2rem;
  gap: 0;
}
.auth-tab {
  flex: 1;
  padding: 0.75rem;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-align: center;
  color: var(--charcoal-light);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}
.auth-tab.active {
  color: var(--sage-dark);
  border-bottom-color: var(--sage);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.5rem 0;
  color: var(--charcoal-light);
  font-size: 0.82rem;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.8rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--charcoal);
  background: var(--white);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-body);
}
.google-btn:hover {
  border-color: var(--sage-light);
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}
.google-btn img { width: 18px; height: 18px; }

.auth-footer-text {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.82rem;
  color: var(--charcoal-light);
}
.auth-footer-text a { color: var(--sage); font-weight: 500; }

/* Auth Visual Panel */
.auth-visual {
  background: var(--charcoal);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 3rem;
}
.auth-visual-bg {
  position: absolute;
  inset: 0;
  background: url('/images/hero.jpg') center/cover;
  opacity: 0.2;
}
.auth-visual-content { position: relative; z-index: 1; }
.auth-visual h2 {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 300;
  color: white;
  margin-bottom: 1rem;
  line-height: 1.2;
}
.auth-visual p { color: rgba(255,255,255,0.55); font-size: 0.95rem; max-width: 360px; }
.auth-visual-features {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.auth-visual-feature {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.88rem;
  color: rgba(255,255,255,0.6);
}
.auth-visual-feature svg { width: 16px; height: 16px; color: var(--sage-light); flex-shrink: 0; }

/* ── Loading Spinner ── */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Mobile Sidebar Toggle ── */
.sidebar-mobile-toggle {
  display: none;
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--sage);
  color: white;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  z-index: 200;
  cursor: pointer;
}
.sidebar-mobile-toggle svg { width: 20px; height: 20px; }

/* ── Responsive ── */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
  .auth-panel { padding: 2rem 1.25rem; }
}
@media (max-width: 768px) {
  .portal-sidebar {
    transform: translateX(-100%);
  }
  .portal-sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.2);
  }
  .portal-main { margin-left: 0; }
  .portal-content { padding: 1.25rem; }
  .portal-topbar { padding: 0 1.25rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .sidebar-mobile-toggle { display: flex; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
}
