/* ===== PYNMON CORE DESIGN SYSTEM ===== */

/* Design System Variables – palette derived from the Pynenc logo */
:root {
  /* Navigation Menu (Dark Warm Theme) */
  --nav-bg: #3b2320;
  --nav-bg-secondary: #4a2e2a;
  --nav-active: #d05030;
  --nav-hover: #5a3a35;
  --nav-text-primary: #f0ebe8;
  --nav-text-secondary: #c4a89e;
  --nav-brand: #d05030;

  /* Main Content (Light Theme) */
  --content-bg: #faf8f6;
  --card-bg: #ffffff;
  --border-color: #e0d6d0;
  --table-border: #ede6e1;
  --text-primary: #2c1a14;
  --text-secondary: #6b5147;
  --text-muted: #a89288;

  /* Status Colors */
  --error-red: #dc3545;
  --success-green: #28a745;
  --warning-orange: #ffc107;
  --info-teal: #17a2b8;

  /* Typography */
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
}

/* Body and Layout */
body {
  background-color: var(--content-bg);
  font-family: var(--font-family);
  font-size: 14px;
  color: var(--text-primary);
}

/* Navigation Menu */
.navbar {
  background-color: var(--nav-bg) !important;
  border-bottom: 1px solid var(--nav-bg);
  padding: 0.75rem 1rem;
}

.navbar-brand {
  color: var(--nav-brand) !important;
  font-weight: 600;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.navbar-logo {
  height: 22px;
  width: auto;
  opacity: 0.9;
}

.navbar-nav .nav-link {
  color: var(--nav-text-primary) !important;
  font-weight: 500;
  font-size: 14px;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  margin: 0 2px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
}

.navbar-nav .nav-link:hover {
  background-color: var(--nav-hover);
  color: var(--nav-text-primary) !important;
}

.navbar-nav .nav-link.active {
  background-color: var(--nav-hover);
  color: var(--nav-text-primary) !important;
  border-left: 2px solid var(--nav-active);
  padding-left: 0.9rem;
}

.navbar-nav .nav-link .material-icons {
  font-size: 18px;
  margin-right: 0.5rem;
  color: var(--nav-text-secondary);
}

.navbar-nav .nav-link.active .material-icons {
  color: var(--nav-active);
}

/* App Dropdown */
.dropdown-menu {
  background-color: var(--nav-bg-secondary);
  border: 1px solid var(--nav-hover);
  border-radius: 4px;
}

.dropdown-item {
  color: var(--nav-text-primary);
  font-size: 13px;
}

.dropdown-item:hover {
  background-color: var(--nav-hover);
  color: var(--nav-text-primary);
}

.dropdown-item.active {
  background-color: var(--nav-active);
  color: white;
}

/* Main Content */
.container {
  max-width: 100%;
  padding: 1rem;
}

.container h1 {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

/* Cards */
.card {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  box-shadow: none;
  margin-bottom: 1rem;
}

.card-header {
  background-color: var(--card-bg);
  border-bottom: 1px solid var(--border-color);
  font-size: 16px;
  font-weight: 600;
  padding: 1rem;
  color: var(--text-primary);
}

.card-body {
  padding: 1rem;
}

/* Tables */
.table {
  color: var(--text-primary);
  font-size: 14px;
}

.table th {
  border-bottom: 1px solid var(--table-border);
  font-weight: 500;
  font-size: 12px;
  text-transform: none;
  letter-spacing: normal;
  color: var(--text-secondary);
  padding: 0.5rem 0.75rem;
}

.table td {
  padding: 0.25rem 0.75rem;
  border-bottom: 1px solid var(--table-border);
  font-size: 12px;
}

.table-hover tbody tr:hover {
  background-color: #f8f9fa;
}

/* Buttons */
.btn {
  font-size: 12px;
  padding: 0.375rem 0.75rem;
  border-radius: 4px;
  font-weight: 500;
}

.btn-primary {
  background-color: var(--nav-active);
  border-color: var(--nav-active);
}

.btn-outline-primary {
  color: var(--nav-active);
  border-color: var(--nav-active);
}

.btn-outline-primary:hover {
  background-color: var(--nav-active);
  border-color: var(--nav-active);
}

/* Status Badges */
.badge {
  font-size: 11px;
  font-weight: 500;
}

.bg-success {
  background-color: var(--success-green) !important;
}
.bg-danger {
  background-color: var(--error-red) !important;
}
.bg-warning {
  background-color: var(--warning-orange) !important;
}
.bg-info {
  background-color: var(--info-teal) !important;
}

/* Form Elements */
.form-control,
.form-select {
  font-size: 14px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 0.375rem 0.75rem;
}

.form-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

/* Compact Filter Forms */
.filter-form {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border: 1px solid #ced4da;
  margin-bottom: 1rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.filter-form .card-header {
  background: linear-gradient(135deg, #ffffff 0%, #f1f3f4 100%);
  border-bottom: 1px solid #ced4da;
  font-size: 13px;
  font-weight: 600;
  padding: 0.75rem 1rem;
  color: var(--text-primary);
  border-radius: 0;
  margin: 0;
}

.filter-form .card-body {
  padding: 1.25rem;
  background: transparent;
}

.filter-form .form-control,
.filter-form .form-select {
  font-size: 12px;
  padding: 0.375rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 3px;
}

.filter-form .status-select {
  height: 120px;
  resize: vertical;
}

.filter-form .form-text {
  font-size: 10px;
  margin-top: 0.25rem;
  color: var(--text-muted);
  line-height: 1.2;
}

.filter-form label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  display: block;
}

.filter-form .btn {
  font-size: 12px;
  padding: 0.5rem 1rem;
  border-radius: 3px;
  font-weight: 500;
}

/* Table Improvements */
.table code {
  font-size: 11px;
  background-color: transparent;
  color: inherit;
  padding: 0;
  word-break: break-all;
}

.table .text-primary {
  color: var(--nav-active) !important;
}

.table .text-secondary {
  color: var(--text-secondary) !important;
}

.table th {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: none;
  letter-spacing: normal;
  border-bottom: 2px solid var(--table-border);
  padding: 0.75rem 0.5rem;
}

.table td {
  padding: 0.5rem;
  font-size: 12px;
  vertical-align: middle;
  border-bottom: 1px solid var(--table-border);
}

/* Alerts */
.alert {
  border-radius: 4px;
  font-size: 14px;
}

/* Improved Card System */
.metric-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: box-shadow 0.2s ease;
}

.metric-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.info-card {
  background: #faf8f6;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 1rem;
  border-left: 3px solid var(--nav-active);
}

.section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: none;
  letter-spacing: normal;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--table-border);
  padding-bottom: 0.5rem;
}

.metric-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.metric-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid #f1f3f4;
}

.metric-item:last-child {
  border-bottom: none;
}

.metric-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.metric-value {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 600;
}

/* Badge Item Styling for Status Lists */
.badge-item {
  padding: 0.25rem 0;
  font-size: 13px;
}

.badge-item .badge {
  font-size: 11px;
  padding: 0.375rem 0.5rem;
  min-width: 80px;
  text-align: center;
}

/* Page Headers */
.h4.text-primary {
  color: var(--text-primary) !important;
  font-weight: 600;
  font-size: 1.5rem;
}

/* Typography Hierarchy */
.page-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.section-header {
  font-size: 1.1rem;
  font-weight: 500;
  color: #495057;
}

.compact-header {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: none;
  letter-spacing: normal;
}

.data-text {
  font-size: 0.875rem;
  color: var(--text-primary);
}

.metadata-text {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Component Classes */
.pynmon-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
  box-shadow: none;
}

.pynmon-card-header {
  background: #f8f9fa;
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 1rem;
  font-weight: 500;
  color: #495057;
}

.pynmon-card-body {
  padding: 1rem;
}

.pynmon-table {
  margin-bottom: 0;
  font-size: 0.875rem;
}

.pynmon-table th {
  border-top: none;
  border-bottom: 1px solid var(--border-color);
  padding: 0.5rem 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: #f8f9fa;
}

.pynmon-table td {
  padding: 0.5rem 0.75rem;
  border-top: 1px solid var(--table-border);
  vertical-align: middle;
}

.pynmon-table-compact th,
.pynmon-table-compact td {
  padding: 0.375rem 0.5rem;
  font-size: 0.8125rem;
}

.clickable-code {
  background: #faf5f2;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  color: #c04020;
  text-decoration: none;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.875em;
  transition: background-color 0.15s ease-in-out;
}

.clickable-code:hover {
  background: #ede1db;
  color: #902000;
}

.pynmon-action-btn {
  font-size: 0.875rem;
  padding: 0.375rem 0.75rem;
  border-radius: 0.25rem;
}

.status-success {
  background: #d1edcc;
  color: #0f5132;
  border: 1px solid #badbcc;
}

.status-error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c2c7;
}

.status-warning {
  background: #fff3cd;
  color: #664d03;
  border: 1px solid #ffecb5;
}

.status-info {
  background: #cff4fc;
  color: #055160;
  border: 1px solid #b6effb;
}

.status-muted {
  background: #e2e3e5;
  color: #41464b;
  border: 1px solid #c4c8cc;
}

/* Compact Design System */
.pynmon-title {
  font-size: 1.1rem !important;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.pynmon-container {
  padding: 0.75rem;
}

.pynmon-card {
  margin-bottom: 0.75rem;
}

.pynmon-card .card-header {
  padding: 0.75rem;
}

.pynmon-card .card-body {
  padding: 0.75rem;
}

.pynmon-row-compact {
  margin-bottom: 0.5rem;
}

/* Compact Timeline Styles */
.compact-timeline .compact-timeline-item {
  margin-bottom: 0.75rem !important;
  padding-bottom: 0.5rem;
}

.compact-timeline .compact-timeline-item:last-child {
  margin-bottom: 0;
}

.compact-timeline-content {
  padding-left: 0.5rem;
}

.compact-timeline-title {
  margin-bottom: 0.25rem !important;
  font-size: 0.875rem;
}

.compact-timeline .timeline-date {
  margin-bottom: 0.25rem !important;
  font-size: 0.75rem;
}

.compact-timeline .timeline-text {
  margin-bottom: 0;
  font-size: 0.8rem;
}

.compact-timeline .timeline-marker {
  width: 0.75rem;
  height: 0.75rem;
  margin-top: 0.25rem;
}

/* Code Styling */
code {
  background-color: #f8f9fa;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 12px;
  font-family: "Monaco", "Menlo", "Ubuntu Mono", monospace;
}

/* Responsive */
@media (max-width: 768px) {
  .col-md-3,
  .col-md-9 {
    flex: 0 0 100%;
    max-width: 100%;
  }

  .filter-form {
    margin-bottom: 1rem;
  }

  .container {
    padding: 0.5rem;
  }

  .navbar-nav .nav-link {
    padding: 0.5rem;
  }
}

/* ===== LOADING SPINNERS ===== */

/* Full-page overlay shown while navigating to a slow page */
.pynmon-loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(248, 249, 250, 0.85);
  z-index: 9999;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  gap: 12px;
}

.pynmon-loading-overlay.active {
  display: flex;
}

.pynmon-loading-overlay .spinner-border {
  width: 2.5rem;
  height: 2.5rem;
  color: var(--nav-active);
}

.pynmon-loading-overlay .loading-text {
  color: var(--text-secondary);
  font-size: 14px;
}

/* Inline spinner for sections loading inside a page */
.pynmon-inline-spinner {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 13px;
}

.pynmon-inline-spinner .spinner-border {
  width: 1.5rem;
  height: 1.5rem;
  color: var(--nav-active);
}

/* HTMX indicator support */
.htmx-indicator {
  display: none;
}

.htmx-request .htmx-indicator {
  display: inline-block;
}

.htmx-request .htmx-hide-on-request {
  display: none;
}

/* ===== SUBTLE BRAND ACCENT ===== */
/* Soft warm orange tint across the content background */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: rgba(208, 80, 48, 0.018);
}

/* Ensure main content sits above the body pseudo-element */
body > nav,
body > .container,
body > #pynmon-loading {
  position: relative;
  z-index: 1;
}
