/* VMI Steel Buildings Admin Theme - Inspired by logo and brand identity */

:root {
  /* Brand / Accent */
  --accent: #f1702a;
  /* requested accent */
  --accent-600: #e16224;
  --accent-700: #c4551f;

  /* Legacy brand tokens (repurposed for dark) */
  --vmi-orange: var(--accent);
  --vmi-orange-dark: var(--accent-700);
  --vmi-orange-light: #ff8a4a;

  /* Dark palette */
  --vmi-black: #e6eefb;
  /* use as primary text color across app */
  --vmi-gray-dark: #a9b4c6;
  --vmi-gray: #8a97ab;
  --vmi-gray-light: #6b7a90;

  /* UI Surfaces */
  --bg-primary: #141a22;
  /* cards, navbar */
  --bg-secondary: #0e141b;
  /* page background */
  --bg-accent: #1a2230;
  /* subtle accents */
  --border-color: rgba(255, 255, 255, 0.08);

  /* Shadows */
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.35);
  --shadow-md: 0 6px 14px -2px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 18px 30px -6px rgba(0, 0, 0, 0.55);

  /* Text tokens */
  --text-color: #e6eefb;
  --text-muted: #a9b4c6;

  --bs-body-bg: var(--bg-secondary);
  --bs-body-color: var(--text-color);
  --bs-border-color: var(--border-color);
  --bs-heading-color: var(--text-color);
  --bs-card-bg: var(--bg-primary);
  --bs-card-border-color: var(--border-color);
  --bs-link-color: var(--accent);
  --bs-link-hover-color: var(--accent-600);
  --bs-dropdown-bg: var(--bg-primary);
  --bs-dropdown-link-color: var(--text-color);
  --bs-dropdown-link-hover-bg: var(--bg-accent);
}

* {
  box-sizing: border-box;
}

body {
  background: var(--bs-body-bg);
  color: var(--bs-body-color);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

/* Main Container - Consistent margins */
.main-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

@media (max-width: 768px) {
  .main-container {
    padding: 1.5rem 1rem;
  }
}

/* Navbar */
.navbar {
  background: var(--bg-primary) !important;
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  padding: 0.75rem 0;
}

.navbar .nav-link {
  color: var(--text-muted);
}

.navbar .nav-link:hover,
.navbar .nav-link:focus {
  color: var(--text-color);
}

.navbar .navbar-brand img {
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4));
  transition: transform 350ms ease, filter 350ms ease;
}

/* Keep header compact even with large logo attributes */
.navbar .navbar-brand {
  padding: 0 0 0 10px;
  display: flex;
  align-items: center;
  height: 64px;
  /* keep navbar compact */
  overflow: visible;
  /* allow logo to scale without clipping */
  position: relative;
  isolation: isolate;
}

.navbar .navbar-brand img {
  height: 120px;
  max-height: 200px;
  width: auto;
  margin: 0;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4));
}

.navbar .navbar-brand:hover img,
.navbar .navbar-brand:focus-visible img {
  transform: translateY(-1px) scale(1.04);
}

.navbar .navbar-brand:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 10px;
}

@media (prefers-reduced-motion: reduce) {
  .navbar .navbar-brand img,
  .navbar .navbar-brand::after {
    transition: none !important;
  }
}

/* Links and accents */
a {
  color: var(--accent);
}

a:hover {
  color: var(--accent-600);
}

/* Utility overrides for dark theme */
.text-dark {
  color: var(--text-color) !important;
}

.bg-light {
  background-color: #e9eef6 !important;
}

.border {
  border-color: var(--border-color) !important;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--text-color);
}

.navbar-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
}

@media (max-width: 768px) {
  .navbar-container {
    padding: 0 1rem;
  }
}

.navbar-brand {
  font-weight: 600;
  color: var(--vmi-black) !important;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}

.nav-link {
  color: var(--vmi-gray-dark) !important;
  font-weight: 500;
  padding: 0.5rem 1rem !important;
  transition: all 0.2s;
  border-radius: 6px;
  margin: 0 0.25rem;
}

.nav-link:hover {
  color: var(--vmi-orange) !important;
  background: var(--bg-accent);
}

.navbar-text {
  color: var(--vmi-gray-dark);
  font-size: 0.9rem;
}

/* Buttons */
.btn {
  font-weight: 500;
  border-radius: 8px;
  padding: 0.5rem 1.25rem;
  transition: all 0.2s;
  border: none;
}

.btn-primary {
  background: var(--vmi-orange);
  color: white;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--vmi-orange-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-outline-secondary {
  --bs-btn-color: var(--vmi-black);
  --bs-btn-border-color: var(--vmi-gray);
  --bs-btn-hover-color: var(--vmi-black);
  --bs-btn-hover-bg: var(--bg-accent);
  --bs-btn-hover-border-color: var(--vmi-gray-light);
  --bs-btn-active-color: var(--vmi-black);
  --bs-btn-active-bg: var(--bg-accent);
  --bs-btn-active-border-color: var(--vmi-gray-light);
  background: transparent;
  border: 1px solid var(--vmi-gray);
  color: var(--vmi-black);
}

.btn-outline-danger {
  background: white;
  border: 1px solid #FCA5A5;
  color: #DC2626;
}

.btn-outline-danger:hover {
  background: #FEF2F2;
  border-color: #DC2626;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.875rem;
}

/* Cards */
.card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-title {
  color: var(--text-color);
  font-weight: 600;
  font-size: 1.25rem;
}

.card-body {
  padding: 1.5rem;
}

/* Buttons */
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-600);
  border-color: var(--accent-600);
}

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

.btn-outline-primary:hover {
  background: rgba(241, 112, 42, 0.12);
  border-color: var(--accent);
}

/* Tables */
.table {
  color: var(--text-color);
}

.table thead th {
  color: var(--text-muted);
  border-color: var(--border-color);
}

.table tbody td,
.table tbody th {
  border-color: var(--border-color);
  color: var(--text-color);
}

/* Tables */
.table {
  margin-bottom: 0;
  border-collapse: separate;
  /* Allow border-radius on rows/cells if needed */
  border-spacing: 0;
}

.table thead tr th {
  color: var(--vmi-gray);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 1.5rem;
  /* More breathing room */
  background: rgba(255, 255, 255, 0.02);
  /* Subtle header bg */
}

.table tbody tr {
  transition: all 0.2s ease-in-out;
}

.table tbody tr:hover {
  background-color: var(--bg-accent) !important;
  /* Force dark hover */
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  position: relative;
  z-index: 1;
}

.table tbody td {
  padding: 1.25rem 1.5rem;
  /* More spacious cells */
  vertical-align: middle;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-color);
  font-size: 0.95rem;
}

.table-responsive {
  border-radius: 12px;
  overflow: hidden;
  /* Clip corners */
  border: 1px solid var(--border-color);
}

/* Clickable table rows */
.table tr.clickable-row {
  cursor: pointer;
}

/* Ensure text remains readable on hover */
.table tr.clickable-row:hover td,
.table tr.clickable-row:hover th,
.table tr.clickable-row:hover strong,
.table tr.clickable-row:hover span {
  color: var(--text-color);
}

/* Custom Action Buttons */
.btn-action-edit,
.btn-action-delete {
  padding: 0.4rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 6px;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

/* Edit Button - Soft Dark/Gray */
.btn-action-edit {
  background: rgba(255, 255, 255, 0.05);
  color: var(--vmi-gray-dark);
  border-color: rgba(255, 255, 255, 0.1);
}

.btn-action-edit:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

/* Delete Button - Soft Danger */
.btn-action-delete {
  background: rgba(220, 38, 38, 0.1);
  /* Low opacity red */
  color: #FCA5A5;
  /* Light red text */
  border-color: rgba(220, 38, 38, 0.2);
}

.btn-action-delete:hover {
  background: rgba(220, 38, 38, 0.2);
  color: #FECaca;
  border-color: rgba(220, 38, 38, 0.3);
  transform: translateY(-1px);
}


/* Card headers on dark - ensure consistent contrast */
.card-header {
  background: var(--bg-primary);
  color: var(--text-color);
  border-bottom: 1px solid var(--border-color);
}

/* List groups in cards */
.list-group-item {
  background: var(--bg-primary);
  color: var(--text-color);
  border-color: var(--border-color);
}

/* Forms */
.form-label {
  font-weight: 500;
  color: var(--vmi-gray-dark);
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.form-control,
.form-select {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.625rem 0.875rem;
  font-size: 0.95rem;
  transition: all 0.2s;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--vmi-orange);
  box-shadow: 0 0 0 3px rgba(239, 125, 78, 0.1);
}

/* Flash Messages */
.flash-area .alert {
  margin-bottom: 0.75rem;
  border-radius: 8px;
  border: none;
  padding: 1rem 1.25rem;
}

.alert-warning {
  background: #FEF3C7;
  color: #92400E;
}

.alert-success {
  background: #D1FAE5;
  color: #065F46;
}

.alert-danger {
  background: #FEE2E2;
  color: #991B1B;
}

/* Login Page */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #FFF5F1 0%, #FFFFFF 100%);
}

.login-card {
  max-width: 420px;
  width: 100%;
}

.login-logo {
  max-width: 400px;
  height: auto;
}

/* Dashboard Stats */
.stat-card {
  border-left: 4px solid var(--vmi-orange);
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--vmi-orange);
  line-height: 1;
}

.stat-label {
  color: var(--vmi-gray);
  font-weight: 500;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
}

/* Page Headers */
.page-header {
  margin-bottom: 2rem;
}

.page-header h2 {
  font-weight: 700;
  color: var(--vmi-black);
  font-size: 1.875rem;
}

/* Badges */
.badge {
  padding: 0.35em 0.65em;
  font-weight: 500;
  border-radius: 6px;
}

.badge.bg-primary {
  background: var(--vmi-orange) !important;
  color: white;
}

.badge.bg-secondary {
  background: var(--vmi-gray-light) !important;
  color: var(--vmi-black);
}

.badge.bg-info {
  background: #DBEAFE !important;
  color: #1E40AF;
}

.badge.bg-light {
  background: var(--bg-accent) !important;
  color: var(--vmi-black) !important;
  border: 1px solid var(--border-color);
}

.badge.text-bg-light,
.badge.bg-light.text-dark {
  background: var(--bg-accent) !important;
  color: var(--vmi-black) !important;
  border: 1px solid var(--border-color);
}

/* Utilities */
.text-muted {
  color: var(--vmi-gray) !important;
}

.text-orange {
  color: var(--vmi-orange) !important;
}

.bg-accent {
  background: var(--bg-accent) !important;
}

/* Responsive */
@media (max-width: 768px) {
  .navbar-brand img {
    height: 40px;
  }

  .navbar-brand {
    font-size: 0.95rem;
  }

  .navbar-text {
    font-size: 0.85rem;
  }

  .page-header {
    margin-bottom: 1.5rem;
  }

  .page-header h2 {
    font-size: 1.5rem;
  }

  .page-header p {
    font-size: 0.875rem;
  }

  .btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }

  .btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
  }

  .stat-value {
    font-size: 2rem;
  }

  .stat-label {
    font-size: 0.7rem;
  }

  .card-body {
    padding: 1rem;
  }

  .table {
    font-size: 0.875rem;
  }

  .table thead th {
    font-size: 0.7rem;
    padding: 0.5rem 0.75rem;
  }

  .table tbody td {
    padding: 0.75rem 0.75rem;
  }

  /* Hide less important columns on mobile */
  .table .hide-mobile {
    display: none;
  }

  /* Stack form buttons on mobile */
  .d-flex.gap-2 {
    flex-direction: column;
    gap: 0.5rem !important;
  }

  .d-flex.gap-2 .btn {
    width: 100%;
  }
}

@media (max-width: 576px) {
  .stat-value {
    font-size: 1.75rem;
  }

  /* Make action buttons stack vertically on very small screens */
  .table td form,
  .table td .btn {
    display: block;
    width: 100%;
    margin-bottom: 0.25rem;
  }

  .table td form:last-child,
  .table td .btn:last-child {
    margin-bottom: 0;
  }
}

/* Premium Dashboard Styles */

/* Hero Section */
.hero-welcome {
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  border-radius: 16px;
  padding: 3rem 2rem;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
}

.relative {
  position: relative;
}

.z-1 {
  z-index: 1;
}

.ls-1 {
  letter-spacing: 0.05em;
}

/* Premium Stat Cards */
.stat-card-premium {
  background: rgba(20, 26, 34, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.stat-card-premium:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px -4px rgba(0, 0, 0, 0.3);
  border-color: rgba(239, 125, 78, 0.3);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Project Card */
.project-card-premium {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  transition: all 0.3s ease;
}

.project-card-premium:hover {
  border-color: var(--vmi-orange);
  box-shadow: var(--shadow-md);
}

.backdrop-blur {
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* Subtle Backgrounds */
.bg-orange-subtle {
  background: rgba(239, 125, 78, 0.15);
}

.bg-blue-subtle {
  background: rgba(59, 130, 246, 0.15);
}

.bg-green-subtle {
  background: rgba(16, 185, 129, 0.15);
}

.bg-red-subtle {
  background: rgba(239, 68, 68, 0.15);
}

.bg-orange {
  background-color: var(--vmi-orange) !important;
}

.hover-text-white:hover {
  color: white !important;
}

/* Project Tabs Styling Override */
.nav-pills .nav-link {
  color: white !important;
}

.nav-pills .nav-link:hover,
.nav-pills .nav-link.active {
  color: black !important;
}

/* Pagination (moved from templates to global stylesheet) */
.pagination .page-item.active .page-link {
  background-color: #EF7D4E;
  border-color: #EF7D4E;
}
.pagination .page-link {
  color: #EF7D4E;
}
.pagination .page-link:hover {
  color: #d66a3d;
  background-color: #fff5f0;
  border-color: #EF7D4E;
}