/* PetroLink Design System — PetroOps Style */

:root {
  --brand:          #10B981;
  --brand-dark:     #059669;
  --brand-dim:      #064E3B;
  --brand-glow:     rgba(16,185,129,0.14);
  --accent:         #38BDF8;
  --accent-dark:    #0284C7;
  --status-green:   #22C55E;
  --status-red:     #EF4444;
  --status-yellow:  #F59E0B;
  --status-blue:    #38BDF8;
  --status-orange:  #F97316;
  --status-purple:  #A78BFA;
  --font-sans:      'Barlow', sans-serif;
  --font-cond:      'Barlow Condensed', sans-serif;
  --font-mono:      'JetBrains Mono', monospace;
  --radius-sm: 3px;
  --radius-md: 6px;
  --radius-lg: 10px;
}

:root, [data-theme="light"] {
  --bg-void:    #F4F7F6;
  --bg-deep:    #FFFFFF;
  --bg-panel:   #FFFFFF;
  --bg-raised:  #EEF4F2;
  --border-col: #C8DDD7;
  --muted-col:  #8AADA4;
  --text-primary:   #0C1F1A;
  --text-secondary: #1E3530;
  --text-tertiary:  #4A706A;
  --text-disabled:  #A8C4BF;
  --shadow-panel: 0 2px 12px rgba(16,185,129,0.07);
  --shadow-hover:  0 4px 24px rgba(16,185,129,0.13);
}

[data-theme="dark"] {
  --bg-void:    #0A0F0D;
  --bg-deep:    #101814;
  --bg-panel:   #172018;
  --bg-raised:  #1E2B22;
  --border-col: #273D30;
  --muted-col:  #3A5C4A;
  --text-primary:   #E8F5F0;
  --text-secondary: #B8D4CA;
  --text-tertiary:  #7AA898;
  --text-disabled:  #3A5C4A;
  --shadow-panel: 0 2px 12px rgba(0,0,0,0.5);
  --shadow-hover:  0 4px 24px rgba(0,0,0,0.7);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bg-void);
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.6;
}

/* ── TOP NAV ── */
.topnav {
  position: fixed; top: 0; left: 0; right: 0; height: 56px; z-index: 1000;
  background: var(--bg-deep); border-bottom: 1px solid var(--border-col);
  display: flex; align-items: center; padding: 0 1.5rem; gap: 1rem;
  box-shadow: var(--shadow-panel);
}
.brand-name {
  font-family: var(--font-cond); font-weight: 700; color: var(--brand);
  letter-spacing: 0.06em; text-transform: uppercase; font-size: 1.1rem;
  text-decoration: none; white-space: nowrap;
}
.brand-name .brand-hex {
  display: inline-block; width: 22px; height: 22px; background: var(--brand);
  clip-path: polygon(50% 0%,90% 25%,90% 75%,50% 100%,10% 75%,10% 25%);
  margin-right: 6px; vertical-align: middle;
}

/* ── SIDEBAR ── */
.sidebar {
  position: fixed; top: 56px; left: 0; width: 220px; bottom: 0;
  background: var(--bg-deep); border-right: 1px solid var(--border-col);
  overflow-y: auto; overflow-x: hidden; z-index: 900;
  transition: width 0.22s ease;
  display: flex; flex-direction: column;
}
.sidebar-nav { flex: 1; overflow-y: auto; overflow-x: hidden; }
.sidebar-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 18px;
  color: var(--text-tertiary); text-decoration: none;
  font-family: var(--font-cond); font-size: 0.82rem; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase;
  border-left: 3px solid transparent;
  transition: all 0.15s;
  white-space: nowrap;
}
.sidebar-item:hover { color: var(--text-primary); background: var(--bg-raised); }
.sidebar-item.active { color: var(--brand); border-left-color: var(--brand); background: var(--brand-glow); }
.sidebar-item i { font-size: 1rem; flex-shrink: 0; }
.sidebar-label { overflow: hidden; transition: opacity 0.15s, width 0.22s; }
.sidebar-section {
  font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--muted-col);
  padding: 16px 18px 6px; margin-top: 4px;
  white-space: nowrap; overflow: hidden;
  transition: opacity 0.15s;
}

/* Sidebar collapse toggle button */
.sidebar-collapse-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 18px;
  color: var(--text-tertiary); cursor: pointer;
  font-family: var(--font-cond); font-size: 0.82rem; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase;
  border-top: 1px solid var(--border-col);
  border-left: 3px solid transparent;
  transition: all 0.15s; user-select: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.sidebar-collapse-btn:hover { color: var(--text-primary); background: var(--bg-raised); }
.sidebar-collapse-btn i { font-size: 1rem; flex-shrink: 0; }

/* ── COLLAPSED STATE (desktop only) ── */
.sidebar.sidebar-collapsed { width: 56px; }
.sidebar.sidebar-collapsed .sidebar-label { opacity: 0; width: 0; }
.sidebar.sidebar-collapsed .sidebar-section { opacity: 0; padding-top: 8px; padding-bottom: 8px; }
.sidebar.sidebar-collapsed .sidebar-item {
  padding: 10px 0; justify-content: center; gap: 0;
}
.sidebar.sidebar-collapsed .sidebar-collapse-btn {
  padding: 10px 0; justify-content: center; gap: 0;
}
.sidebar.sidebar-collapsed ~ .main-content { margin-left: 56px; }

/* ── MAIN CONTENT ── */
.main-content {
  margin-left: 220px; margin-top: 56px; padding: 2rem;
  min-height: calc(100vh - 56px);
  transition: margin-left 0.22s ease;
}
.page-header { margin-bottom: 1.75rem; }
.page-eyebrow {
  font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--brand); margin-bottom: 4px;
  display: flex; align-items: center; gap: 8px;
}
.page-eyebrow::before { content: ''; display: inline-block; width: 20px; height: 1px; background: var(--brand); }
.page-title {
  font-family: var(--font-cond); font-size: 2rem; font-weight: 700;
  color: var(--text-primary); line-height: 1.1;
}
.breadcrumb-petro {
  display: flex; flex-direction: row; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 0.72rem;
  color: var(--muted-col); list-style: none; flex-wrap: nowrap;
  padding: 0; padding-left: 0; margin: 0 0 8px;
}
.breadcrumb-petro li { padding: 0; margin: 0; list-style: none; flex-shrink: 0; }
.breadcrumb-petro li a { color: var(--text-tertiary); text-decoration: none; }
.breadcrumb-petro li a:hover { color: var(--brand); }
.breadcrumb-petro li.active { color: var(--text-secondary); }
.breadcrumb-petro .sep { color: var(--border-col); user-select: none; }
.page-meta {
  font-family: var(--font-mono); font-size: 0.72rem; color: var(--muted-col);
  display: flex; flex-direction: row; align-items: center; gap: 20px; flex-wrap: wrap; margin-top: 4px;
}

/* ── PHOTO GRID ── */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  padding: 1rem;
}
@media (max-width: 575px) { .photo-grid { grid-template-columns: 1fr; } }

/* ── HTMX LOADING INDICATOR ── */
.htmx-indicator { opacity: 0; transition: opacity 200ms ease-in; pointer-events: none; }
.htmx-request .htmx-indicator { opacity: 1; }
.htmx-request.htmx-indicator { opacity: 1; }

/* ── STAT CARD ── */
.stat-card {
  background: var(--bg-panel); border: 1px solid var(--border-col);
  border-radius: var(--radius-md); padding: 1.25rem;
  box-shadow: var(--shadow-panel); transition: box-shadow 0.2s;
}
.stat-card:hover { box-shadow: var(--shadow-hover); }
a.stat-card-link { display:block; text-decoration:none; color:inherit; cursor:pointer; }
a.stat-card-link:hover { box-shadow: var(--shadow-hover); border-color: var(--brand); }
.stat-value {
  font-family: var(--font-cond); font-size: 2.2rem; font-weight: 700;
  color: var(--text-primary); line-height: 1;
}
.stat-label {
  font-family: var(--font-mono); font-size: 0.65rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted-col); margin-top: 4px;
}

/* ── DATA TABLE ── */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.data-table th {
  font-family: var(--font-mono); font-size: 0.65rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted-col);
  padding: 0.6rem 1rem; border-bottom: 1px solid var(--border-col);
  text-align: left; background: var(--bg-raised); font-weight: 600;
}
.data-table td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--border-col); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--bg-raised); }

/* ── BADGE STATUS ── */
.badge-status {
  font-family: var(--font-mono); font-size: 0.65rem; letter-spacing: 0.06em;
  text-transform: uppercase; padding: 3px 8px; border-radius: var(--radius-sm); font-weight: 600;
}
.badge-green  { background: rgba(34,197,94,0.12);  color: #22C55E; }
.badge-red    { background: rgba(239,68,68,0.12);   color: #EF4444; }
.badge-yellow { background: rgba(245,158,11,0.12);  color: #F59E0B; }
.badge-blue   { background: rgba(56,189,248,0.12);  color: #38BDF8; }
.badge-orange { background: rgba(249,115,22,0.12);  color: #F97316; }

/* ── BUTTONS ── */
.btn-brand {
  background: var(--brand); color: #0C1F1A;
  font-family: var(--font-cond); font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; font-size: 0.8rem;
  border: none; border-radius: var(--radius-sm); padding: 0.5rem 1.25rem;
  cursor: pointer; transition: background 0.15s; display: inline-flex;
  align-items: center; gap: 6px; text-decoration: none;
}
.btn-brand:hover { background: var(--brand-dark); color: #0C1F1A; }
.btn-ghost {
  background: transparent; color: var(--brand);
  font-family: var(--font-cond); font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; font-size: 0.8rem;
  border: 1px solid var(--brand); border-radius: var(--radius-sm);
  padding: 0.5rem 1.25rem; cursor: pointer; transition: all 0.15s;
  display: inline-flex; align-items: center; gap: 6px; text-decoration: none;
}
.btn-ghost:hover { background: var(--brand-glow); }

/* ── FORM CONTROLS ── */
.form-label-mono {
  font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted-col); display: block; margin-bottom: 5px;
}
.form-input {
  width: 100%; background: var(--bg-raised); border: 1px solid var(--border-col);
  border-radius: var(--radius-sm); color: var(--text-primary);
  padding: 0.45rem 0.75rem; font-family: var(--font-sans); font-size: 0.9rem;
  transition: border-color 0.15s;
}
.form-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow); }

/* ── ALERTS ── */
.alert-success { background: rgba(34,197,94,0.1);  border-left: 3px solid #22C55E; color: #166534; padding: 0.75rem 1rem; border-radius: var(--radius-sm); }
.alert-danger  { background: rgba(239,68,68,0.1);  border-left: 3px solid #EF4444; color: #991B1B; padding: 0.75rem 1rem; border-radius: var(--radius-sm); }
.alert-warning { background: rgba(245,158,11,0.1); border-left: 3px solid #F59E0B; color: #92400E; padding: 0.75rem 1rem; border-radius: var(--radius-sm); }
.alert-info    { background: rgba(56,189,248,0.1); border-left: 3px solid #38BDF8; color: #0C4A6E; padding: 0.75rem 1rem; border-radius: var(--radius-sm); }

/* ── RESPONSIVE ── */

/* Hamburger: hidden on desktop, shown on tablet/mobile */
.topnav-hamburger { display: none; }

/* Tablet and smaller: hide sidebar off-screen, full-width content */
@media (max-width: 1199.98px) {
  .topnav-hamburger { display: block; }
  .sidebar {
    left: -220px; width: 220px !important;
    transition: left 0.3s ease-in-out;
    z-index: 1050;
  }
  .sidebar.sidebar-open {
    left: 0;
  }
  .sidebar-collapse-btn { display: none; }
  .sidebar-label { opacity: 1 !important; width: auto !important; }
  .sidebar-section { opacity: 1 !important; }
  .sidebar-item { padding: 10px 18px !important; justify-content: flex-start !important; gap: 10px !important; }
  .main-content {
    margin-left: 0 !important;
    padding: 1rem;
    transition: none;
  }
}

/* Backdrop shown behind open sidebar on tablet/mobile */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1040;
}
.sidebar-backdrop.active {
  display: block;
}

/* Data tables: horizontal scroll on narrow screens */
.table-responsive-wrapper {
  overflow-x: auto;
  min-width: 0;
}

/* ── GLOBAL SEARCH ── */
.topnav-search {
  flex: 1 1 0;
  max-width: 320px;
  position: relative;
}
.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.search-icon-left {
  position: absolute;
  left: 10px;
  color: var(--muted-col);
  font-size: 0.85rem;
  pointer-events: none;
  z-index: 1;
}
.search-input {
  width: 100%;
  background: var(--bg-raised);
  border: 1px solid var(--border-col);
  border-radius: 20px;
  color: var(--text-primary);
  padding: 0.35rem 2rem 0.35rem 2rem;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-input::placeholder { color: var(--muted-col); }
.search-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
  background: var(--bg-deep);
}
.search-slash {
  position: absolute;
  right: 10px;
  background: var(--bg-panel);
  border: 1px solid var(--border-col);
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--muted-col);
  padding: 1px 5px;
  pointer-events: none;
  transition: opacity 0.15s;
}
.search-input:focus ~ .search-slash { opacity: 0; }

/* Dropdown */
.search-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--bg-panel);
  border: 1px solid var(--border-col);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  z-index: 2000;
  overflow: hidden;
  max-height: 480px;
  overflow-y: auto;
  min-width: 320px;
}
.search-dropdown.open { display: block; }
.search-group-header {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-col);
  padding: 10px 14px 4px;
  border-top: 1px solid var(--border-col);
  background: var(--bg-raised);
}
.search-group-header:first-child { border-top: none; }
.search-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  text-decoration: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.1s;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}
.search-result-item:hover,
.search-result-item.active {
  background: var(--brand-glow);
  color: var(--text-primary);
}
.search-result-item i {
  font-size: 0.9rem;
  color: var(--brand);
  flex-shrink: 0;
  width: 18px;
  text-align: center;
}
.search-result-label {
  font-family: var(--font-cond);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-result-sub {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}
.search-view-all {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px 8px 42px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  color: var(--accent);
  text-decoration: none;
  transition: color 0.1s;
}
.search-view-all:hover { color: var(--accent-dark); }
.search-empty {
  padding: 24px 14px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted-col);
}
.search-loading {
  padding: 16px 14px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted-col);
}

/* Mobile search toggle button */
.search-toggle-btn {
  display: none;
  background: transparent;
  border: none;
  color: var(--brand);
  font-size: 1.15rem;
  padding: 0.3rem 0.5rem;
  cursor: pointer;
  line-height: 1;
}

/* Mobile search overlay (slides down from topnav) */
.search-overlay {
  display: none;
  position: fixed;
  top: 56px;
  left: 0;
  right: 0;
  background: var(--bg-deep);
  border-bottom: 1px solid var(--border-col);
  padding: 10px 1rem;
  z-index: 1100;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}
.search-overlay.open { display: block; }
.search-overlay .search-dropdown {
  left: 0;
  right: 0;
  min-width: 0;
}

@media (max-width: 991.98px) {
  .topnav-search { display: none; }
  .search-toggle-btn { display: block; }
}

/* ── SEARCH RESULTS PAGE ── */
.search-results-section { margin-bottom: 2.5rem; }
.search-results-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-col);
}
.search-results-section-title {
  font-family: var(--font-cond);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.search-results-section-title i { color: var(--brand); }
.search-count-badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  background: var(--brand-glow);
  color: var(--brand);
  border-radius: 20px;
  padding: 2px 9px;
  font-weight: 600;
}
.search-no-results {
  padding: 3rem 0;
  text-align: center;
}
.search-no-results i {
  font-size: 3rem;
  color: var(--muted-col);
  display: block;
  margin-bottom: 1rem;
}
.search-no-results p {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted-col);
}
