/* Custom CSS Variables */
:root {
  --primary: #3b82f6;
  --primary-foreground: #ffffff;
  --background: #ffffff;
  --foreground: #1a1a1a;
  --muted: #f5f5f5;
  --muted-foreground: #737373;
  --border: #e5e5e5;
  --navbar-bg: #1e293b;
  --navbar-foreground: #f8fafc;
  --warning: #eab308;
  --destructive: #ef4444;
}

[data-theme="dark"] {
  --primary: #3b82f6;
  --primary-foreground: #ffffff;
  --background: #1a1a2e;
  --foreground: #e2e8f0;
  --muted: #16213e;
  --muted-foreground: #94a3b8;
  --border: #334155;
  --navbar-bg: #0f172a;
  --navbar-foreground: #e2e8f0;
  --warning: #eab308;
  --destructive: #ef4444;
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--muted);
  color: var(--foreground);
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

/* Navbar Styles */
.navbar-custom {
  background-color: rgb(247, 249, 250) !important;
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  min-height: 80px;
}

.navbar-toggler:focus,
.navbar-toggler:active {
  outline: none !important;
  box-shadow: none !important;
}

.navbar-custom .navbar-brand {
  color: rgb(87, 87, 87) !important;
  font-weight: bold;
  font-size: 1.25rem;
}

.navbar-custom .navbar-brand .logo-x {
  color: var(--primary);
}

.navbar-custom .nav-link {
  color: rgb(87, 87, 87) !important;
  padding: 0.5rem 1rem !important;
  border-radius: 0.375rem;
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  letter-spacing: 0.3px;
}

.navbar-custom .nav-link:hover,
.navbar-custom .nav-link.active {
  background-color: rgba(255, 255, 255, 0.1);
}

.navbar-custom .nav-link.active {
  background-color: var(--primary);
  color: var(--primary-foreground) !important;
}

/* Navbar text color (black in light, white in dark) */
.nav-text {
  color: rgb(87, 87, 87) !important;
  font-weight: 700 !important;
  font-size: 1rem !important;
}

/* Dark mode navbar overrides */
[data-theme="dark"] .navbar-custom {
  background-color: var(--navbar-bg) !important;
}

[data-theme="dark"] .navbar-custom .navbar-brand {
  color: var(--navbar-foreground) !important;
}

[data-theme="dark"] .navbar-custom .nav-link {
  color: var(--navbar-foreground) !important;
}

[data-theme="dark"] .navbar-custom .nav-link.active {
  color: var(--primary-foreground) !important;
}

[data-theme="dark"] .navbar-custom .nav-text {
  color: var(--navbar-foreground) !important;
}

/* Dark mode form controls */
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
  background-color: var(--muted);
  border-color: var(--border);
  color: var(--foreground);
}

[data-theme="dark"] .form-control::placeholder {
  color: var(--muted-foreground);
}

/* Dark mode breadcrumb */
[data-theme="dark"] .breadcrumb-item a {
  color: var(--primary);
}

[data-theme="dark"] .breadcrumb-item.active {
  color: var(--muted-foreground);
}

/* Dark mode price badge */
[data-theme="dark"] .price-badge {
  background-color: #1a3a2a;
  color: #4ade80;
}

/* Dark mode card header */
[data-theme="dark"] .card-header {
  background-color: var(--muted) !important;
  border-color: var(--border) !important;
}

/* Dark mode table text - white on dark background */
[data-theme="dark"] .table-custom,
[data-theme="dark"] .table-custom td,
[data-theme="dark"] .table-custom th,
[data-theme="dark"] .table-custom tbody tr td,
[data-theme="dark"] .table-custom thead tr th,
[data-theme="dark"] table.table-custom td,
[data-theme="dark"] table.table-custom th {
  --bs-table-color: #e2e8f0 !important;
  --bs-table-bg: var(--background);
  --bs-table-hover-bg: var(--muted);
  --bs-table-hover-color: #e2e8f0;
  color: #e2e8f0 !important;
}

[data-theme="dark"] .table {
  --bs-table-color: #e2e8f0;
  --bs-table-bg: var(--background);
  color: #e2e8f0;
}

[data-theme="dark"] .table-custom tbody tr:hover td {
  color: #e2e8f0 !important;
}

[data-theme="dark"] .indicator-plus,
[data-theme="dark"] .indicator-minus {
  color: #94a3b8 !important;
}

[data-theme="dark"] .price-badge {
  background-color: #1a3a2a;
  color: #4ade80 !important;
}

/* Dark mode card content text */
[data-theme="dark"] .card-body,
[data-theme="dark"] .card-body ol,
[data-theme="dark"] .card-body li,
[data-theme="dark"] .card-body p,
[data-theme="dark"] .card-body h5,
[data-theme="dark"] .card-body h6,
[data-theme="dark"] .card-footer,
[data-theme="dark"] .card-header h5 {
  color: #e2e8f0 !important;
}

[data-theme="dark"] .card-body code {
  color: #93c5fd !important;
}

/* Dark mode text-muted override */
[data-theme="dark"] .text-muted {
  color: var(--muted-foreground) !important;
}

/* Dark mode label */
[data-theme="dark"] .form-label {
  color: var(--foreground);
}

/* Cart Badge */
.cart-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background-color: var(--destructive);
  color: white;
  font-size: 10px;
  font-weight: bold;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Dropdown Styles */
.dropdown-menu-custom {
  background-color: var(--background);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  min-width: 160px;
}

.dropdown-menu-custom .dropdown-item {
  color: var(--foreground);
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
}

.dropdown-menu-custom .dropdown-item:hover {
  background-color: var(--muted);
}

/* Card Styles */
.card-custom {
  background-color: var(--background);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Auth Pages */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background-color: var(--muted);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background-color: var(--background);
  border-radius: 0.5rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  padding: 2rem;
}

.auth-card h2 {
  text-align: center;
  margin-bottom: 1.5rem;
  color: var(--foreground);
}

/* Form Styles */
.form-control-custom {
  background-color: var(--background);
  border: 1px solid var(--border);
  color: var(--foreground);
  padding: 0.75rem 1rem;
  padding-left: 2.5rem;
  border-radius: 0.375rem;
}

.form-control-custom:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
  outline: none;
}

.form-control-custom::placeholder {
  color: var(--muted-foreground);
}

.input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-foreground);
}

/* Button Styles */
.btn-primary-custom {
  background-color: var(--primary);
  color: var(--primary-foreground);
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 0.375rem;
  font-weight: 500;
  width: 100%;
  transition: opacity 0.2s;
}

.btn-primary-custom:hover {
  opacity: 0.9;
  background-color: var(--primary);
  color: var(--primary-foreground);
}

.btn-warning-custom {
  background-color: var(--warning);
  color: #1a1a1a;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 0.375rem;
  font-weight: 500;
  width: 100%;
}

.btn-warning-custom:hover {
  opacity: 0.9;
  background-color: var(--warning);
}

/* Table Styles */
.table-custom {
  background-color: var(--background);
  border-radius: 0.5rem;
  overflow: hidden;
}

.table-custom thead {
  background-color: var(--muted);
}

.table-custom th {
  color: var(--foreground);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.table-custom td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
  color: var(--foreground);
}

.table-custom tbody tr:hover {
  background-color: var(--muted);
}

/* Search Filter Box */
.filter-box {
  background-color: var(--background);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 1rem;
  margin-bottom: 1rem;
}

.filter-box .form-control,
.filter-box .form-select {
  background-color: var(--background);
  border: 1px solid var(--border);
  color: var(--foreground);
  font-size: 0.875rem;
}

.filter-box .form-control:focus,
.filter-box .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* Modal Styles */
.modal-custom .modal-content {
  background-color: var(--background);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
}

.modal-custom .modal-header {
  border-bottom: 1px solid var(--border);
}

.modal-custom .modal-title {
  color: var(--foreground);
}

.modal-custom .modal-body {
  color: var(--foreground);
}

.secret-key-box {
  background-color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  padding: 0.75rem;
  font-family: monospace;
  font-size: 0.875rem;
  color: var(--primary);
  word-break: break-all;
}

/* Language Selector */
.lang-selector {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  background-color: var(--background);
  color: var(--muted-foreground);
  font-size: 0.875rem;
  cursor: pointer;
}

/* Captcha Box */
.captcha-box {
  background-color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  padding: 0.75rem 1rem;
  font-family: monospace;
  font-size: 1.25rem;
  letter-spacing: 0.25em;
  font-style: italic;
  user-select: none;
}

/* Price Badge */
.price-badge {
  background-color: #dcfce7;
  color: #166534;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
}

/* Status Badges */
.status-waiting {
  background-color: #fef3c7;
  color: #92400e;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.status-completed {
  background-color: #dcfce7;
  color: #166534;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--muted);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted-foreground);
}

/* Bulk action buttons (Add Selected to Cart / Fast Buy Selected) */
.bulk-action-btn {
  font-size: 0.925rem;
  padding: 6px 14px;
  white-space: nowrap;
  line-height: 1.3;
}

/* Mobile navbar layout */
@media (max-width: 991.98px) {
  .navbar-toggler {
    font-weight: 900 !important;
    font-size: 1.5rem !important;
    padding-right: 3px !important;
    outline: none !important;
    box-shadow: none !important;
  }

  .navbar-toggler .bi-list {
    -webkit-text-stroke: 1px currentColor;
  }

  .navbar-custom .navbar-collapse {
    padding: 0.75rem 0;
  }

  /* Align all sections to the same left edge */
  .navbar-custom .navbar-collapse > .d-flex:first-child {
    order: 1;
    padding-left: 0 !important;
    margin-right: 0 !important;
  }

  .navbar-custom .navbar-collapse > .navbar-nav {
    order: 2;
    margin: 0.5rem 0 !important;
    padding-left: 0;
  }

  .navbar-custom .navbar-collapse > .navbar-nav .nav-link {
    padding-left: 0.5rem !important;
  }

  .navbar-custom .navbar-collapse > .d-flex:last-child {
    order: 3;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 0.75rem !important;
    padding-left: 0.5rem;
  }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .filter-box .row > div {
    margin-bottom: 0.5rem;
    flex: 0 0 100%;
    max-width: 100%;
  }

  /* Equal flex: label ~30%, input ~70% */
  .filter-box .d-flex.align-items-center {
    display: flex !important;
  }

  .filter-box .d-flex.align-items-center > label {
    min-width: 80px !important;
    flex: 0 0 80px;
  }

  .filter-box .d-flex.align-items-center > input,
  .filter-box .d-flex.align-items-center > select {
    flex: 1 1 0 !important;
  }

  .table-responsive {
    font-size: 0.8rem;
  }

  /* Shrink per-row Cart / Fast Buy action buttons on mobile */
  .lookup-action-btn {
    font-size: 9px !important;
    padding: 1px 5px !important;
    line-height: 1.4;
  }

  .lookup-action-btn i {
    font-size: 10px;
  }

  /* Bulk buttons stay inline, just slightly smaller */
  .bulk-action-btn {
    font-size: 0.845rem !important;
    padding: 5px 11px !important;
  }
}

/* Extra-small phones (≤ 480px) */
@media (max-width: 480px) {
  .lookup-action-btn {
    font-size: 8px !important;
    padding: 1px 4px !important;
  }

  .lookup-action-btn i {
    font-size: 9px;
  }

  .bulk-action-btn {
    font-size: 0.805rem !important;
    padding: 4px 9px !important;
  }
}

/* Theme Toggle Button */
.theme-toggle {
  background: none;
  border: none;
  color: var(--warning);
  padding: 0.5rem;
  cursor: pointer;
  border-radius: 0.375rem;
}

.theme-toggle:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Verify Page Dark Background */
.verify-bg {
  background-color: #1a1a2e;
  min-height: 100vh;
}

/* Balance display */
.balance-display {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--navbar-foreground);
  font-size: 0.875rem;
}

/* Link styles */
a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Checkbox custom */
.form-check-input:checked {
  background-color: var(--primary);
  border-color: var(--primary);
}

/* Plus/Minus indicators */
.indicator-plus {
  color: #22c55e;
  font-weight: bold;
}

.indicator-minus {
  color: var(--muted-foreground);
}

/* Pagination */
.pagination {
  gap: 0;
  margin: 0;
}
.pagination .page-link {
  border: 1px solid #dee2e6;
  border-radius: 0 !important;
  color: #0d6efd;
  background: #fff;
  padding: 6px 12px;
  font-size: 14px;
  line-height: 1.4;
  min-width: 38px;
  text-align: center;
  margin-left: -1px;
  transition: background .15s, color .15s;
}
.pagination .page-link:hover {
  background: #e9ecef;
  color: #0a58ca;
}
.pagination .page-item.active .page-link {
  background: #0d6efd;
  border-color: #0d6efd;
  color: #fff;
  z-index: 2;
}
.pagination .page-item.disabled .page-link {
  color: #adb5bd;
  background: #fff;
  pointer-events: none;
}
.pagination .page-item:first-child .page-link {
  border-top-left-radius: 4px !important;
  border-bottom-left-radius: 4px !important;
}
.pagination .page-item:last-child .page-link {
  border-top-right-radius: 4px !important;
  border-bottom-right-radius: 4px !important;
}
/* Mobile pagination */
@media (max-width: 575.98px) {
  .pagination .page-link {
    padding: 5px 8px;
    font-size: 12px;
    min-width: 30px;
  }
  .card-footer {
    flex-direction: column;
    align-items: center !important;
    gap: 8px;
  }
}
[data-theme="dark"] .pagination .page-link {
  background: var(--background);
  border-color: #374151;
  color: #60a5fa;
}
[data-theme="dark"] .pagination .page-link:hover {
  background: #374151;
}
[data-theme="dark"] .pagination .page-item.active .page-link {
  background: #0d6efd;
  border-color: #0d6efd;
  color: #fff;
}
[data-theme="dark"] .pagination .page-item.disabled .page-link {
  color: #4b5563;
  background: var(--background);
}
