* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 14px;
  height: 100%;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

body {
  background-color: #000000;
  color: #ffffff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  margin: 0;
  min-height: 100vh;
  height: 100%;
  width: 100%;
  overflow-x: hidden;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Global Modal */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 10px;
  box-sizing: border-box;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background-color: #1a1a1a;
  border: 2px solid #0066ff;
  border-radius: 8px;
  padding: 15px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  overflow-x: auto;
  position: relative;
  width: 100%;
  margin: auto;
  box-sizing: border-box;
}

@media (min-width: 768px) {
  .modal-content {
    max-width: 1400px;
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  border-bottom: 1px solid #0066ff;
  padding-bottom: 15px;
}

.modal-title {
  color: #00cc66;
  font-size: 28px;
  font-weight: 700;
  margin: 0;
  letter-spacing: 0.5px;
}

.modal-close {
  background: none;
  border: none;
  color: #0066ff;
  font-size: 32px;
  cursor: pointer;
  transition: color 0.2s;
  padding: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  color: #00cc66;
}

.modal-body {
  color: #ffffff;
  overflow-x: auto;
}

.modal-table {
  width: 100%;
  margin-top: 20px;
}

/* Table minimum width for horizontal scrolling on all devices */
.modal-body .paginated-table {
  min-width: 900px;
}

/* Desktop table expanded width */
@media (min-width: 769px) {
  .modal-body .paginated-table {
    min-width: 1200px;
  }
}

/* Buttons */
.btn {
  border: none;
  border-radius: 6px;
  padding: 10px 20px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 600;
}

.btn-primary {
  background-color: #0066ff;
  color: #ffffff;
}

.btn-primary:hover {
  background-color: #0052cc;
  transform: translateY(-2px);
}

.btn-secondary {
  background-color: #00cc66;
  color: #000000;
}

.btn-secondary:hover {
  background-color: #00b359;
}

.btn-danger {
  background-color: #ff3333;
  color: #ffffff;
}

.btn-danger:hover {
  background-color: #cc0000;
}

/* Forms */
.form-control, .form-select {
  background-color: #1a1a1a;
  border: 2px solid #0066ff;
  color: #ffffff;
  padding: 10px;
  border-radius: 6px;
}

.form-control:focus, .form-select:focus {
  background-color: #1a1a1a;
  border-color: #00cc66;
  color: #ffffff;
  box-shadow: 0 0 0 0.2rem rgba(0, 204, 102, 0.25);
}

.form-label {
  color: #ffffff;
  font-weight: 600;
  margin-bottom: 8px;
}

/* Alerts */
.alert {
  border-radius: 6px;
  padding: 15px;
  margin-bottom: 20px;
  border-left: 4px solid;
}

.alert-success {
  background-color: #1a3d1a;
  color: #00ff66;
  border-left-color: #00cc66;
}

.alert-danger {
  background-color: #3d1a1a;
  color: #ff6666;
  border-left-color: #ff3333;
}

.alert-info {
  background-color: #1a2d3d;
  color: #66ccff;
  border-left-color: #0066ff;
}

/* Cards */
.card {
  background-color: #1a1a1a;
  border: 2px solid #0066ff;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}

.card-title {
  color: #00cc66;
  font-weight: 600;
  margin-bottom: 15px;
  font-size: 18px;
}

/* Links */
a {
  color: #0066ff;
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: #00cc66;
  text-decoration: underline;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 15px;
}

th {
  background-color: #0066ff;
  color: #ffffff;
  padding: 12px;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid #00cc66;
}

td {
  padding: 12px;
  border-bottom: 1px solid #333333;
  color: #ffffff;
}

tr:hover {
  background-color: #1a1a1a;
}

/* Nav */
nav {
  background-color: #000000;
  border-bottom: 2px solid #0066ff;
}

nav a {
  color: #ffffff;
  padding: 10px 15px;
  display: inline-block;
  transition: all 0.2s ease;
}

nav a:hover {
  color: #00cc66;
  background-color: #1a1a1a;
}

/* Input focus states */
input:focus, textarea:focus, select:focus {
  outline: none;
}

/* Spacing helpers */
.mt-20 {
  margin-top: 20px;
}

.mb-20 {
  margin-bottom: 20px;
}

.p-20 {
  padding: 20px;
}

/* Mobile Responsive Tables */
@media (max-width: 768px), (max-height: 500px) {
  /* Show mobile hamburger menu button */
  #mobileMenuToggle {
    display: block !important;
  }

  /* Hide desktop menu on mobile, show as vertical stack */
  nav #navMenu {
    position: fixed;
    top: 90px;
    left: 0;
    width: 100%;
    background-color: #1a1a1a;
    flex-direction: column !important;
    display: none !important;
    z-index: 999;
    border-bottom: 1px solid #0066ff;
  }

  nav #navMenu.active {
    display: flex !important;
  }

  nav #navMenu a,
  nav #navMenu button {
    width: 100%;
    text-align: left;
    border-right: none !important;
    border-bottom: 1px solid #333 !important;
    padding: 12px 20px !important;
  }

  /* Horizontal scroll for tables on mobile */
  table {
    font-size: 12px !important;
  }

  table th, table td {
    padding: 8px 10px !important;
  }

  .paginated-table {
    font-size: 12px !important;
  }

  .paginated-table th {
    font-size: 11px !important;
    padding: 6px 8px !important;
  }

  .paginated-table td {
    padding: 6px 8px !important;
  }

  /* Container scroll for tables */
  table.paginated-table {
    width: 100%;
    overflow-x: auto;
    display: block;
  }

  /* Button sizing for mobile */
  .btn {
    font-size: 11px !important;
    padding: 6px 10px !important;
    margin: 2px !important;
  }

  /* Card padding for mobile */
  .card {
    padding: 12px !important;
  }

  .card-title {
    font-size: 13px !important;


  /* Form inputs mobile */
  input, textarea, select {
    font-size: 14px !important;
    padding: 8px !important;
  }

  /* Drilldown filter controls on mobile */
  #drilldownFilters {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
    padding: 10px !important;
    margin-bottom: 15px !important;
    align-items: stretch !important;
  }

  #drilldownFilters > div {
    flex: 0 1 calc(50% - 5px) !important;
    min-width: 60px !important;
  }

  #drilldownFilters > button {
    flex: 0 1 calc(50% - 5px) !important;
    min-width: 60px !important;
  }

  #drilldownFilters > span {
    flex: 0 1 calc(50% - 5px) !important;
    min-width: 60px !important;
  }

  #drilldownStatusFilter,
  #drilldownSearchBox {
    width: 100% !important;
  }

  #columnToggleBtn {
    width: 100% !important;
  }

  /* Status modal display */
  .status-modal.show {
    display: flex !important;
  }

  .status-modal > div {
    width: 90% !important;
    max-width: 90% !important;
    min-width: 250px !important;
    padding: 20px !important;
  }

  /* Modal adjustments for mobile */
  .modal-overlay {
    padding: 5px !important;
  }

  .modal-content {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 85vh !important;
    padding: 12px !important;
    margin: 0 auto !important;
  }

  .modal-header {
    margin-bottom: 10px !important;
    padding-bottom: 8px !important;
  }

  .modal-title {
    font-size: 16px !important;
  }

  .modal-close {
    font-size: 20px !important;
  }

  .modal-body table {
    width: 100%;
    font-size: 11px;
    table-layout: auto;
    min-width: auto;
  }

  .modal-body table th,
  .modal-body table td {
    padding: 8px !important;
    font-size: 11px !important;
  }

  h1 {
    font-size: 20px !important;
  }

  h2 {
    font-size: 18px !important;
  }

  h3 {
    font-size: 16px !important;
  }

  /* Status modal mobile centering */
  .status-modal {
    display: flex !important;
  }

  .status-modal div:first-child {
    width: 95% !important;
    max-width: 95% !important;
    padding: 20px !important;
  }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
