/* =============================================
   ODFC Customer Portal
   Colors: #d8262e (fire red), #1a1a1a (near-black), #fb8e28 (flame orange)
   ============================================= */

:root {
  --primary: #d8262e;
  --primary-dark: #b01e25;
  --primary-light: #fde8e9;
  --dark: #1a1a1a;
  --dark-mid: #2a2a2a;
  --accent: #fb8e28;
  --accent-dark: #e07820;
  --text-dark: #111827;
  --text-body: #374151;
  --text-muted: #6b7280;
  --bg-light: #f8fafc;
  --bg-white: #ffffff;
  --border: #e5e7eb;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.12);
  --radius: 12px;
  --radius-sm: 6px;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font); color: var(--text-body); background: var(--bg-white); line-height: 1.6; font-size: 16px; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
ul { list-style: none; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }

h1 { font-size: clamp(1.75rem, 3.5vw, 2.75rem); font-weight: 800; line-height: 1.15; color: var(--text-dark); }
h2 { font-size: clamp(1.35rem, 2.5vw, 1.9rem); font-weight: 700; line-height: 1.25; color: var(--text-dark); }
h3 { font-size: 1.15rem; font-weight: 600; color: var(--text-dark); }
h4 { font-size: 0.95rem; font-weight: 600; color: var(--text-dark); }
p { color: var(--text-body); }

/* === BUTTONS === */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.6rem 1.4rem; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 0.9rem; cursor: pointer;
  border: 2px solid transparent; transition: all 0.2s ease;
  text-decoration: none; white-space: nowrap; font-family: var(--font);
}
.btn-sm { padding: 0.4rem 0.9rem; font-size: 0.82rem; }
.btn-lg { padding: 0.8rem 2rem; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn-outline { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-ghost { background: transparent; color: var(--text-muted); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg-light); color: var(--text-dark); }
.btn-text { color: var(--primary); font-weight: 600; background: none; border: none; cursor: pointer; font-family: var(--font); font-size: 0.9rem; padding: 0; }
.btn-text:hover { color: var(--primary-dark); text-decoration: underline; }
.btn-danger { background: #dc2626; color: #fff; border-color: #dc2626; }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; color: #fff; }

/* === FORMS === */
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; font-size: 0.88rem; font-weight: 600; color: var(--text-dark); margin-bottom: 0.4rem; }
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%; padding: 0.65rem 0.9rem;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 0.92rem; font-family: var(--font); color: var(--text-dark);
  background: #fff; transition: border-color 0.15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.form-group textarea { resize: vertical; min-height: 100px; }
.form-hint { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.3rem; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* === ALERTS === */
.alert { padding: 0.85rem 1rem; border-radius: var(--radius-sm); font-size: 0.9rem; margin-bottom: 1.25rem; border: 1px solid transparent; }
.alert-error { background: #fde8ec; color: #9c0c23; border-color: #f5c0c9; }
.alert-success { background: #d1fae5; color: #065f46; border-color: #a7f3d0; }
.alert-info { background: var(--primary-light); color: var(--primary-dark); border-color: #f5c0c9; }
.alert-warning { background: #fffbeb; color: #92400e; border-color: #fde68a; }

/* === AUTH === */
.auth-section {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #111111 0%, #1f1f1f 60%, #2d1a1a 100%);
  padding: 2rem; position: relative; overflow: hidden;
}
.auth-bg-flame {
  position: absolute; bottom: -60px; right: -60px;
  width: 400px; height: 400px; opacity: 0.04;
  background: radial-gradient(circle, var(--accent) 0%, var(--primary) 60%, transparent 80%);
  border-radius: 50%;
}
.auth-container { width: 100%; max-width: 480px; position: relative; z-index: 1; }
.auth-brand { text-align: center; margin-bottom: 2rem; }
.auth-brand img { height: 60px; margin: 0 auto 0.75rem; }
.auth-brand h2 { color: #fff; font-size: 1.1rem; font-weight: 500; opacity: 0.8; }
.auth-brand .auth-tagline { color: rgba(255,255,255,0.5); font-size: 0.82rem; }
.auth-card {
  background: #fff; border-radius: var(--radius);
  padding: 2.5rem; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.auth-card h1 { font-size: 1.6rem; margin-bottom: 0.35rem; }
.auth-subtitle { color: var(--text-muted); font-size: 0.88rem; margin-bottom: 1.75rem; }
.auth-footer { text-align: center; padding-top: 1.25rem; font-size: 0.88rem; color: var(--text-muted); border-top: 1px solid var(--border); margin-top: 1.25rem; }
.auth-footer a { color: var(--primary); }
.auth-footer a:hover { color: var(--primary-dark); }

/* === PORTAL LAYOUT === */
.portal-layout { display: flex; min-height: 100vh; }

.portal-sidebar {
  width: 260px; flex-shrink: 0;
  background: linear-gradient(180deg, #111111 0%, #1f1f1f 100%);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}

.portal-brand {
  padding: 1.25rem 1.25rem 1rem; border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex; align-items: center; gap: 0.75rem;
}
.portal-brand img {
  height: 48px; width: 48px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.12); flex-shrink: 0;
}
.portal-brand-text { }
.portal-brand-name { font-size: 0.82rem; font-weight: 700; color: #fff; line-height: 1.2; }
.portal-brand-name span { color: var(--accent); }
.portal-label {
  display: block; font-size: 0.68rem; color: rgba(255,255,255,0.35);
  letter-spacing: 1.5px; text-transform: uppercase; margin-top: 0.4rem;
}

.portal-menu { flex: 1; padding: 1rem 0; }
.portal-menu li a,
.portal-logout-btn {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.7rem 1.25rem; color: rgba(255,255,255,0.6);
  font-size: 0.88rem; font-weight: 500; transition: all 0.15s;
  cursor: pointer; text-decoration: none; width: 100%;
  background: none; border: none; font-family: var(--font);
}
.portal-menu li a:hover,
.portal-logout-btn:hover { background: rgba(255,255,255,0.07); color: #fff; }
.portal-menu li a.active {
  background: var(--primary); color: #fff;
  border-right: 3px solid var(--accent);
}
.portal-menu-section {
  font-size: 0.65rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.5px; color: rgba(255,255,255,0.25);
  padding: 1rem 1.25rem 0.4rem;
}
.portal-divider { height: 1px; background: rgba(255,255,255,0.08); margin: 0.5rem 1rem; }
.portal-logout-btn { color: rgba(255,100,100,0.7); }
.portal-logout-btn:hover { color: #ff6b6b; background: rgba(255,100,100,0.08); }

.portal-user-info {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 1rem 1.25rem; border-top: 1px solid rgba(255,255,255,0.08);
}
.portal-avatar {
  width: 36px; height: 36px; background: var(--primary); color: #fff;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.88rem; flex-shrink: 0;
}
.portal-avatar.admin { background: var(--accent); }
.portal-user-name { font-size: 0.84rem; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.portal-user-role { font-size: 0.72rem; color: rgba(255,255,255,0.4); }

/* === PORTAL MAIN === */
.portal-main { flex: 1; background: var(--bg-light); min-width: 0; }

.portal-topbar {
  background: #fff; border-bottom: 1px solid var(--border);
  padding: 1rem 2rem; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50; box-shadow: var(--shadow-sm);
}
.portal-topbar h1 { font-size: 1.2rem; font-weight: 700; }
.portal-topbar-actions { display: flex; align-items: center; gap: 0.75rem; }

.portal-content { padding: 2rem; }

/* === STAT CARDS === */
.portal-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; margin-bottom: 2rem; }
.stat-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.5rem; display: flex; align-items: center; gap: 1rem;
  transition: box-shadow 0.2s;
}
.stat-card:hover { box-shadow: var(--shadow-md); }
.stat-card-icon {
  width: 52px; height: 52px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.stat-card-icon.locations { background: var(--primary-light); color: var(--primary); }
.stat-card-icon.jobs { background: #fff7ed; color: var(--accent); }
.stat-card-icon.reports { background: #d1fae5; color: #059669; }
.stat-card-number { font-size: 2rem; font-weight: 800; color: var(--text-dark); line-height: 1; }
.stat-card-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.2rem; }

/* === SECTIONS === */
.portal-section {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.75rem; margin-bottom: 1.5rem;
}
.portal-section-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem;
  flex-wrap: wrap; gap: 0.75rem;
}
.portal-section-header h2 { font-size: 1.1rem; margin: 0; }

/* === DATA TABLE === */
.data-table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left; font-size: 0.75rem; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px;
  padding: 0.75rem 1rem; border-bottom: 2px solid var(--border); white-space: nowrap;
}
.data-table td {
  padding: 0.9rem 1rem; border-bottom: 1px solid var(--border); font-size: 0.9rem;
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { cursor: pointer; transition: background 0.1s; }
.data-table tbody tr:hover td { background: var(--bg-light); }
.data-table code { font-size: 0.82rem; background: var(--bg-light); padding: 0.2rem 0.45rem; border-radius: 3px; font-family: monospace; }

/* === STATUS BADGES === */
.badge {
  display: inline-flex; align-items: center; padding: 0.25rem 0.65rem;
  border-radius: 50px; font-size: 0.74rem; font-weight: 600; white-space: nowrap;
}
.badge-green { background: #d1fae5; color: #065f46; }
.badge-red { background: var(--primary-light); color: var(--primary-dark); }
.badge-orange { background: #fff7ed; color: #c2410c; }
.badge-blue { background: #eff6ff; color: #1d4ed8; }
.badge-gray { background: var(--bg-light); color: var(--text-muted); }
.badge-yellow { background: #fffbeb; color: #92400e; }

/* === LOCATION CARDS === */
.location-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.25rem; }
.location-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.5rem; transition: all 0.2s; text-decoration: none; display: block;
}
.location-card:hover {
  border-color: var(--primary); box-shadow: var(--shadow-md);
  transform: translateY(-2px); color: inherit;
}
.location-card-name { font-size: 1rem; font-weight: 700; color: var(--text-dark); margin-bottom: 0.4rem; }
.location-card-addr { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 1rem; display: flex; align-items: flex-start; gap: 0.4rem; }
.location-card-meta { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.location-card-icon {
  width: 40px; height: 40px; background: var(--primary-light); border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center; color: var(--primary); flex-shrink: 0;
  margin-bottom: 1rem;
}

/* === DETAIL VIEWS === */
.detail-header {
  display: flex; align-items: flex-start; gap: 1.5rem; flex-wrap: wrap;
  margin-bottom: 2rem;
}
.detail-header-info { flex: 1; }
.detail-header-title { font-size: 1.6rem; font-weight: 800; color: var(--text-dark); margin-bottom: 0.25rem; }
.detail-header-sub { color: var(--text-muted); font-size: 0.9rem; }
.detail-header-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }

.detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 1.5rem; }

.info-list { display: flex; flex-direction: column; gap: 0.75rem; }
.info-item { display: flex; gap: 0.75rem; align-items: flex-start; }
.info-item-icon { width: 18px; flex-shrink: 0; color: var(--text-muted); margin-top: 2px; }
.info-item-label { font-size: 0.8rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.info-item-value { font-size: 0.92rem; color: var(--text-dark); }

/* === CONTACTS === */
.contact-card {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.9rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
  margin-bottom: 0.75rem;
}
.contact-avatar {
  width: 38px; height: 38px; border-radius: 50%; background: var(--primary-light);
  color: var(--primary); display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.9rem; flex-shrink: 0;
}
.contact-name { font-weight: 600; font-size: 0.9rem; color: var(--text-dark); }
.contact-role { font-size: 0.78rem; color: var(--text-muted); }
.contact-actions { margin-left: auto; display: flex; gap: 0.5rem; }
.contact-link { font-size: 0.82rem; color: var(--primary); display: flex; align-items: center; gap: 0.3rem; }
.contact-link:hover { color: var(--primary-dark); }

/* === ATTACHMENTS === */
.attachment-list { display: flex; flex-direction: column; gap: 0.75rem; }
.attachment-item {
  display: flex; align-items: center; gap: 0.9rem;
  padding: 1rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
  transition: background 0.15s; background: #fff;
}
.attachment-item:hover { background: var(--bg-light); }
.attachment-icon {
  width: 40px; height: 40px; background: var(--primary-light); border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--primary);
}
.attachment-icon.pdf { background: #fde8ec; color: var(--primary); }
.attachment-icon.img { background: #eff6ff; color: #2563eb; }
.attachment-icon.doc { background: #dbeafe; color: #1d4ed8; }
.attachment-name { font-weight: 600; font-size: 0.9rem; color: var(--text-dark); margin-bottom: 0.15rem; }
.attachment-meta { font-size: 0.78rem; color: var(--text-muted); }
.attachment-download { margin-left: auto; }

/* === JOB STATUS === */
.job-status-complete { background: #d1fae5; color: #065f46; }
.job-status-open { background: #fffbeb; color: #92400e; }
.job-status-scheduled { background: #eff6ff; color: #1d4ed8; }
.job-status-invoiced { background: #f3e8ff; color: #7c3aed; }
.job-status-canceled { background: var(--bg-light); color: var(--text-muted); }

/* === BREADCRUMB === */
.breadcrumb { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 1.25rem; flex-wrap: wrap; }
.breadcrumb a { color: var(--primary); }
.breadcrumb a:hover { color: var(--primary-dark); }
.breadcrumb-sep { color: var(--border); }

/* === EMPTY STATE === */
.empty-state {
  text-align: center; padding: 3rem 2rem; color: var(--text-muted);
}
.empty-state svg { margin: 0 auto 1rem; opacity: 0.3; }
.empty-state h3 { font-size: 1rem; margin-bottom: 0.5rem; color: var(--text-dark); }
.empty-state p { font-size: 0.88rem; max-width: 360px; margin: 0 auto 1.5rem; }

/* === SEARCH / FILTERS === */
.filter-bar {
  display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.filter-bar input,
.filter-bar select {
  padding: 0.55rem 0.85rem; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 0.88rem; font-family: var(--font); color: var(--text-dark); background: #fff;
}
.filter-bar input:focus,
.filter-bar select:focus { outline: none; border-color: var(--primary); }

/* === ADMIN === */
.admin-badge {
  display: inline-flex; align-items: center; gap: 0.35rem;
  background: var(--primary-light); color: var(--primary-dark);
  font-size: 0.72rem; font-weight: 700; padding: 0.2rem 0.6rem;
  border-radius: 50px; text-transform: uppercase; letter-spacing: 0.5px;
}

.user-table-role { }

.checkbox-list { display: flex; flex-direction: column; gap: 0.5rem; max-height: 400px; overflow-y: auto; }
.checkbox-item { display: flex; align-items: center; gap: 0.65rem; padding: 0.6rem 0.75rem; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.checkbox-item input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); flex-shrink: 0; cursor: pointer; }
.checkbox-item label { font-size: 0.88rem; cursor: pointer; }
.checkbox-item label strong { color: var(--text-dark); }
.checkbox-item label span { color: var(--text-muted); font-size: 0.8rem; display: block; }

/* === PROFILE === */
.profile-card { max-width: 640px; }
.profile-avatar-lg {
  width: 72px; height: 72px; background: var(--primary); color: #fff; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.6rem;
  margin-bottom: 1.25rem;
}

/* === FIRE DIVIDER === */
.fire-divider {
  height: 3px; background: linear-gradient(90deg, var(--primary), var(--accent), var(--primary));
  border: none; border-radius: 2px; margin: 0;
}

/* === RESPONSIVE === */
@media (max-width: 900px) {
  .portal-sidebar { width: 220px; }
  .detail-grid { grid-template-columns: 1fr; }
  .portal-stats { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .portal-sidebar { display: none; }
  .portal-layout { flex-direction: column; }
  .portal-topbar { padding: 0.85rem 1rem; }
  .portal-content { padding: 1rem; }
  .portal-stats { grid-template-columns: 1fr; }
  .location-grid { grid-template-columns: 1fr; }
  .data-table th, .data-table td { padding: 0.65rem 0.75rem; }
}
