html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #FFD700;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 200px;  /* Increased margin to prevent footer overlap */
}

/* GEKO Theme Colors */
.bg-geko {
  background-color: #000000 !important;
}

.bg-geko-yellow {
  background-color: #FFD700 !important;
}

.text-geko {
  color: #000000 !important;
}

.text-geko-yellow {
  color: #FFD700 !important;
}

/* Navigation customizations */
.navbar-dark .navbar-brand:hover,
.navbar-dark .navbar-brand:focus {
  color: #FFD700;
}

.navbar-dark .navbar-nav .nav-link:hover,
.navbar-dark .navbar-nav .nav-link:focus {
  color: #FFD700;
}

/* Button customizations */
.btn-primary {
  background-color: #FFD700;
  border-color: #FFD700;
  color: #000000;
}

.btn-primary:hover {
  background-color: #FFC107;
  border-color: #FFC107;
  color: #000000;
}

.btn-outline-primary {
  color: #FFD700;
  border-color: #FFD700;
}

.btn-outline-primary:hover {
  background-color: #FFD700;
  border-color: #FFD700;
  color: #000000;
}

/* Footer improvements - Fixed positioning issue */
.footer {
  position: relative; /* Changed from absolute to relative */
  width: 100%;
  white-space: nowrap;
  line-height: 60px;
  margin-top: 3rem; /* Added top margin for spacing */
}

.footer.bg-geko {
  color: #ffffff;
}

.social-links a {
  font-size: 1.2rem;
  transition: color 0.3s ease;
}

.social-links a:hover {
  color: #FFD700 !important;
}

/* ==============================
   TABLE STYLING - WHITE BACKGROUND
   HIGHEST PRIORITY OVERRIDES
   ============================== */

/* Override all table backgrounds to white with dark text - Maximum specificity */
table.table,
.table,
table.table-hover,
.table-hover,
table.table-striped,
.table-striped,
table.table-bordered,
.table-bordered,
table.table-responsive table,
.table-responsive .table {
  background-color: white !important;
  color: #000000 !important;
}

/* All table cells and headers - white background */
table.table th,
table.table td,
.table th,
.table td,
table.table-hover th,
table.table-hover td,
.table-hover th,
.table-hover td,
table.table-striped th,
table.table-striped td,
.table-striped th,
.table-striped td,
.table-responsive table th,
.table-responsive table td,
.table-responsive .table th,
.table-responsive .table td {
  background-color: white !important;
  color: #000000 !important;
  border-color: #dee2e6 !important;
}

/* Override Bootstrap's table-dark class completely */
table.table .table-dark,
.table .table-dark,
table.table thead.table-dark,
.table thead.table-dark,
table.table thead.table-dark th,
.table thead.table-dark th,
table.table .table-dark th,
.table .table-dark th,
table.table .table-dark td,
.table .table-dark td,
.table-dark th,
.table-dark td,
thead.table-dark th,
thead.table-dark td {
  background-color: #f8f9fa !important;
  color: #000000 !important;
  border-color: #dee2e6 !important;
}

/* Override table-hover to keep white background */
table.table-hover tbody tr:hover,
.table-hover tbody tr:hover,
table.table tbody tr:hover,
.table tbody tr:hover,
.table-responsive table tbody tr:hover,
.table-responsive .table tbody tr:hover {
  background-color: #f8f9fa !important;
  color: #000000 !important;
}

/* Override table-hover cells specifically */
table.table-hover tbody tr:hover th,
table.table-hover tbody tr:hover td,
.table-hover tbody tr:hover th,
.table-hover tbody tr:hover td {
  background-color: #f8f9fa !important;
  color: #000000 !important;
}

/* Ensure table striped also maintains white backgrounds */
table.table-striped tbody tr:nth-of-type(odd),
.table-striped tbody tr:nth-of-type(odd) {
  background-color: #f8f9fa !important;
  color: #000000 !important;
}

table.table-striped tbody tr:nth-of-type(even),
.table-striped tbody tr:nth-of-type(even) {
  background-color: white !important;
  color: #000000 !important;
}

/* Override striped table cells specifically */
table.table-striped tbody tr:nth-of-type(odd) th,
table.table-striped tbody tr:nth-of-type(odd) td,
.table-striped tbody tr:nth-of-type(odd) th,
.table-striped tbody tr:nth-of-type(odd) td {
  background-color: #f8f9fa !important;
  color: #000000 !important;
}

table.table-striped tbody tr:nth-of-type(even) th,
table.table-striped tbody tr:nth-of-type(even) td,
.table-striped tbody tr:nth-of-type(even) th,
.table-striped tbody tr:nth-of-type(even) td {
  background-color: white !important;
  color: #000000 !important;
}

/* Override any card backgrounds containing tables */
.card,
.card-body,
.card-header,
.card-footer {
  background-color: white !important;
  color: #000000 !important;
}

.card-header {
  border-bottom-color: #dee2e6 !important;
}

.card-footer {
  border-top-color: #dee2e6 !important;
}

/* Ensure links in tables are visible */
table.table a,
.table a {
  color: #0066cc !important;
}

table.table a:hover,
.table a:hover {
  color: #004499 !important;
}

/* Text colors for table elements */
table.table .text-muted,
.table .text-muted {
  color: #6c757d !important;
}

table.table .text-success,
.table .text-success {
  color: #198754 !important;
}

table.table .text-warning,
.table .text-warning {
  color: #fd7e14 !important;
}

table.table .text-danger,
.table .text-danger {
  color: #dc3545 !important;
}

table.table .text-info,
.table .text-info {
  color: #0dcaf0 !important;
}

/* Make sure badges remain visible in tables */
table.table .badge,
.table .badge {
  color: white !important;
}

table.table .badge.bg-warning,
.table .badge.bg-warning {
  color: #000000 !important;
}

/* Specific override for products table */
.products-table th,
.products-table td {
  background-color: white !important;
  color: #000000 !important;
}

.products-table thead.table-dark th {
  background-color: #f8f9fa !important;
  color: #000000 !important;
}

/* ==============================
   MOBILE OPTIMIZATION STYLES
   ============================== */

/* Base mobile styles for better touch interaction */
@media (max-width: 767.98px) {
  /* Improve touch targets */
  .btn {
    min-height: 44px;
    padding: 0.5rem 1rem;
  }
  
  .nav-link {
    padding: 0.75rem 1rem;
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  
  /* Better form controls on mobile */
  .form-control, .form-select {
    min-height: 44px;
    font-size: 16px; /* Prevents zoom on iOS */
  }
  
  .form-floating > .form-control,
  .form-floating > .form-select {
    min-height: 58px;
  }
  
  /* Improved spacing for mobile */
  .container {
    padding-left: 15px;
    padding-right: 15px;
  }
  
  /* Card improvements for mobile */
  .card {
    margin-bottom: 1rem;
    border-radius: 8px;
  }
  
  .card-body {
    padding: 1rem;
  }
  
  .card-header {
    padding: 0.75rem 1rem;
  }
  
  /* Table responsive improvements */
  .table-responsive {
    border: none;
    font-size: 0.9rem;
  }
  
  .table td, .table th {
    padding: 0.5rem 0.25rem;
    vertical-align: middle;
  }
  
  /* Better dropdown menus on mobile */
  .dropdown-menu {
    border-radius: 8px;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  }
  
  .dropdown-item {
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
  }
}

/* Tablet and small desktop optimization */
@media (min-width: 768px) and (max-width: 1199.98px) {
  .container {
    max-width: 720px;
  }
  
  .table td, .table th {
    padding: 0.75rem 0.5rem;
  }
}

/* Mobile navigation improvements */
@media (max-width: 991.98px) {
  .navbar-toggler {
    border: none;
    padding: 0.5rem;
  }
  
  .navbar-toggler:focus {
    box-shadow: 0 0 0 0.25rem rgba(255, 215, 0, 0.25);
  }
  
  .navbar-collapse {
    margin-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 0.5rem;
  }
  
  .navbar-nav .nav-item {
    margin-bottom: 0.25rem;
  }
  
  .navbar-nav .dropdown-menu {
    background-color: rgba(0, 0, 0, 0.9);
    border: 1px solid rgba(255, 215, 0, 0.2);
    margin-left: 1rem;
  }
  
  .navbar-nav .dropdown-item {
    color: #ffffff;
  }
  
  .navbar-nav .dropdown-item:hover {
    background-color: rgba(255, 215, 0, 0.1);
    color: #FFD700;
  }
}

/* Mobile footer optimization */
@media (max-width: 767.98px) {
  body {
    margin-bottom: 250px; /* Increased margin for mobile footer */
  }
  
  .footer {
    white-space: normal;
    line-height: normal;
    padding: 1rem 0;
    position: relative; /* Ensure relative positioning on mobile too */
    margin-top: 2rem;
  }
  
  .footer .row {
    margin: 0;
  }
  
  .footer .col-md-6,
  .footer .col-md-3 {
    margin-bottom: 1rem;
    text-align: center;
  }
  
  .footer h5, .footer h6 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
  }
  
  .social-links {
    display: flex;
    justify-content: center;
    gap: 1rem;
  }
  
  .social-links a {
    font-size: 1.5rem;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* Mobile alert improvements */
@media (max-width: 767.98px) {
  .alert {
    margin-bottom: 1rem;
    border-radius: 8px;
    padding: 0.75rem 1rem;
  }
  
  .alert ul {
    margin-bottom: 0.5rem;
    padding-left: 1.25rem;
  }
  
  .alert li {
    margin-bottom: 0.25rem;
  }
}

/* Mobile pagination */
@media (max-width: 575.98px) {
  .pagination {
    justify-content: center;
  }
  
  .pagination .page-item .page-link {
    padding: 0.5rem 0.75rem;
    margin: 0 0.125rem;
  }
}

/* Mobile search and filter improvements */
@media (max-width: 767.98px) {
  .btn-group {
    width: 100%;
    display: flex;
  }
  
  .btn-group .btn {
    flex: 1;
  }
  
  .d-md-flex.justify-content-md-end {
    width: 100%;
  }
  
  .d-md-flex.justify-content-md-end .btn {
    flex: 1;
  }
}

/* Mobile modal improvements */
@media (max-width: 575.98px) {
  .modal-dialog {
    margin: 0.5rem;
  }
  
  .modal-content {
    border-radius: 8px;
  }
  
  .modal-header {
    padding: 1rem;
    border-bottom: 1px solid #dee2e6;
  }
  
  .modal-body {
    padding: 1rem;
  }
  
  .modal-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid #dee2e6;
  }
}

/* Mobile badge improvements */
@media (max-width: 767.98px) {
  .badge {
    font-size: 0.8rem;
    padding: 0.35em 0.65em;
  }
}

/* Mobile image improvements */
@media (max-width: 767.98px) {
  .img-thumbnail {
    max-width: 40px;
    max-height: 40px;
  }
  
  img {
    max-width: 100%;
    height: auto;
  }
}

/* Mobile utility classes */
@media (max-width: 575.98px) {
  .text-sm-center {
    text-align: center !important;
  }
  
  .mb-sm-3 {
    margin-bottom: 1rem !important;
  }
  
  .px-sm-2 {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
  }
}

/* Loading and animation improvements for mobile */
@media (prefers-reduced-motion: reduce) {
  .btn,
  .dropdown-item,
  .nav-link {
    transition: none;
  }
}

/* Dark mode support for mobile devices - Override to ensure white backgrounds */
@media (prefers-color-scheme: dark) {
  .form-control:not(.bg-geko):not(.bg-geko-yellow) {
    background-color: white !important;
    border-color: #495057;
    color: #000000 !important;
  }
  
  .card:not(.bg-geko):not(.bg-geko-yellow) {
    background-color: white !important;
    color: #000000 !important;
  }
  
  /* Override dark mode for tables specifically */
  table.table,
  .table,
  table.table th,
  table.table td,
  .table th,
  .table td {
    background-color: white !important;
    color: #000000 !important;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .btn-primary {
    border: 2px solid #000000;
  }
  
  .btn-outline-primary {
    border: 2px solid #FFD700;
  }
  
  .form-control {
    border: 2px solid #6c757d;
  }
}

/* Accessibility improvements for mobile */
.sr-only-mobile {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@media (max-width: 767.98px) {
  .sr-only-mobile {
    position: static !important;
    width: auto !important;
    height: auto !important;
    padding: initial !important;
    margin: initial !important;
    overflow: visible !important;
    clip: auto !important;
    white-space: normal !important;
    border: initial !important;
  }
}