/* Modern Color Scheme and Base Styles */
:root {
    --primary-color: #b30000;
    --primary-hover: #ff1a1a;
    --dark-bg: #121212;
    --card-bg: #1c1c1c;
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --border-color: #333333;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
}

body {
    background-color: var(--dark-bg);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
}

/* Navbar Styling */
.navbar {
    background-color: var(--primary-color) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 1rem 2rem;
}

.navbar-brand {
    color: var(--text-primary) !important;
    font-weight: 600;
    font-size: 1.5rem;
}

.nav-link {
    color: var(--text-primary) !important;
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    transition: all 0.3s ease;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

/* Card Styling */
.card, .card-header, .card-body {
    color: var(--text-primary) !important;
}

.card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    margin-bottom: 1.5rem;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.card-header {
    background-color: rgba(179, 0, 0, 0.1);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
}

.card-body {
    padding: 1.5rem;
    overflow: visible !important;
}

/* Button Styling */
.btn {
    padding: 0.5rem 1.5rem;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.3s ease;
}

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

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(179, 0, 0, 0.2);
}

.btn-secondary {
    background-color: var(--border-color);
    border: none;
}

.btn-secondary:hover {
    background-color: #444444;
}

/* Form Styling */
.form-control {
    background-color: #2a2a2a;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 6px;
    padding: 0.75rem 1rem;
}

.form-control:focus {
    background-color: #2a2a2a;
    border-color: var(--primary-color);
    color: var(--text-primary);
    box-shadow: 0 0 0 0.2rem rgba(179, 0, 0, 0.25);
}

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

/* Table Styling */
.table {
    color: var(--text-primary);
    background-color: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
}

.table thead th {
    background-color: rgba(179, 0, 0, 0.1);
    border-bottom: 2px solid var(--border-color);
    color: var(--text-primary);
    font-weight: 600;
}

.table td {
    border-color: var(--border-color);
    vertical-align: middle;
}

/* Alert Styling */
.alert {
    border-radius: 6px;
    border: none;
    padding: 1rem 1.5rem;
}

.alert-success {
    background-color: rgba(40, 167, 69, 0.1);
    color: #28a745;
}

.alert-danger {
    background-color: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

/* Badge Styling */
.badge {
    padding: 0.5em 1em;
    font-weight: 500;
    border-radius: 4px;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--dark-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-hover);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .navbar {
        padding: 0.5rem 1rem;
    }
    
    .card {
        margin-bottom: 1rem;
    }
    
    .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
}

/* Contrast-safe inputs
   Default: dark UI -> light text
   Light surfaces can opt-in via .bg-white or .form-control.bg-white */
.form-control,
.form-select {
    color: var(--text-primary) !important;
}

/* When explicitly using white backgrounds, switch to dark text */
.bg-white .form-control,
.bg-white .form-select,
.card.bg-white .form-control,
.card.bg-white .form-select,
.form-control.bg-white,
.form-select.bg-white {
    background-color: #fff !important;
    color: #000 !important;
}

/* List group items on dark background */
.list-group-item.bg-dark {
    color: var(--text-primary) !important;
}

/* Dropdowns: make dark menus readable */
.dropdown-menu.bg-dark,
.dropdown-menu.bg-dark .dropdown-item {
    color: #fff !important;
}

/* Placeholders should be visible on dark */
.form-control::placeholder {
    color: var(--text-secondary) !important;
}

/* Product image utility */
.product-img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    background: #222;
}

/* Marketplace filters: full width on small screens */
@media (max-width: 576px) {
    .mp-filters .form-control,
    .mp-filters .form-select,
    .mp-filters .btn {
        width: 100% !important;
    }
}

/* Responsive tables: enable horizontal scroll instead of overflowing */
.table-responsive {
    overflow-x: auto !important;
}

/* Fallback: make plain .table scrollable on small screens even without wrapper */
@media (max-width: 768px) {
  .table:not(.table-sm) {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }
}

.dropdown-menu {
    z-index: 2000 !important;
    min-width: 180px;
    left: auto !important;
    right: 0 !important;
    transform: translate3d(0, 0, 0) !important;
}

.dropdown,
.dropstart,
.dropend,
.dropup {
    position: static !important;
}

/* Active nav link and focus visibility */
.nav-link.active,
.nav-link[aria-current="page"],
.navbar-nav .nav-link.show {
  background-color: rgba(255, 255, 255, 0.12) !important;
  border-radius: 6px;
}

.btn:focus,
.btn:focus-visible,
.nav-link:focus,
.nav-link:focus-visible,
.form-select:focus {
  outline: none;
  box-shadow: 0 0 0 0.2rem rgba(179, 0, 0, 0.35) !important;
}

/* Utilities for consistent sizing used in marketplace */
.w-240 { width: 240px !important; }
.w-120 { width: 120px !important; }
.h-140 { height: 140px !important; }

/* Improve outline variants on dark */
.btn-outline-light {
  border-color: rgba(255,255,255,0.35) !important;
  color: #fff !important;
}
.btn-outline-light:hover {
  background-color: rgba(255,255,255,0.12) !important;
  color: #fff !important;
}

/* Additional utilities used across marketplace */
.w-80 { width: 80px !important; }
.h-320 { height: 320px !important; }
.mw-200 { max-width: 200px !important; }
