:root {
    --rh-bg-dark: #0d0d0d;
    --rh-bg-card: #161616;
    --rh-bg-card-hover: #1a1a1a;
    --rh-border: #2a2a2a;
    --rh-text: #e5e5e5;
    --rh-text-muted: #888;
    --rh-green: #4a7c23;
    --rh-green-bright: #5c9e1a;
    --rh-fde: #b8a990;
    --rh-orange: #e85d04;
    --rh-red: #dc2626;
}

* {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
    background-color: var(--rh-bg-dark);
    color: var(--rh-text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, h4, h5, .display-1, .display-2, .display-3, .display-4, .brand-text {
    font-family: 'Bebas Neue', sans-serif;
    letter-spacing: 0.5px;
}

/* Navbar */
.navbar {
    background: linear-gradient(180deg, #1a1a1a 0%, #0d0d0d 100%);
    border-bottom: 1px solid var(--rh-border);
    padding: 0.75rem 0;
}

.navbar-brand {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.75rem;
    color: var(--rh-green-bright) !important;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar-brand .brand-icon {
    width: 32px;
    height: 32px;
    background: var(--rh-green);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-link {
    color: var(--rh-text) !important;
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    padding: 0.5rem 1rem !important;
    transition: color 0.2s;
}

.nav-link:hover {
    color: var(--rh-green-bright) !important;
}

/* Search bar */
.search-bar {
    background: var(--rh-bg-card);
    border: 1px solid var(--rh-border);
    border-radius: 6px;
    overflow: hidden;
    display: flex;
}

.search-bar input {
    background: transparent;
    border: none;
    color: var(--rh-text);
    padding: 0.5rem 1rem;
    outline: none;
}

.search-bar input::placeholder {
    color: var(--rh-text-muted);
}

.search-bar button {
    background: var(--rh-green);
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    transition: background 0.2s;
}

.search-bar button:hover {
    background: var(--rh-green-bright);
}

/* Navbar toggler for dark theme */
.navbar-toggler {
    border-color: var(--rh-border);
    padding: 0.4rem 0.6rem;
}

.navbar-toggler:focus {
    box-shadow: none;
    outline: none;
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(76, 175, 80, 1)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Mobile navbar styles */
@media (max-width: 991.98px) {
    .navbar-collapse {
        padding: 1rem 0;
        border-top: 1px solid var(--rh-border);
        margin-top: 0.75rem;
    }

    .navbar-nav {
        text-align: center;
        margin-left: 0 !important;
    }

    .navbar-nav .nav-item {
        padding: 0.5rem 0;
    }

    .navbar-nav .nav-link {
        display: inline-block;
        font-size: 1rem;
    }

    .search-bar {
        width: 100%;
        margin-top: 1rem;
    }

    .search-bar input {
        flex: 1;
        min-width: 0;
    }
}

/* Buttons */
.btn-tactical {
    background: var(--rh-green);
    border: none;
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    padding: 0.6rem 1.25rem;
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-tactical:hover {
    background: var(--rh-green-bright);
    color: white;
    transform: translateY(-1px);
}

.btn-tactical-outline {
    background: transparent;
    border: 2px solid var(--rh-green);
    color: var(--rh-green-bright);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    padding: 0.5rem 1.25rem;
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-tactical-outline:hover {
    background: var(--rh-green);
    color: white;
}

.btn-fde {
    background: var(--rh-fde);
    border: none;
    color: #1a1a1a;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
}

.btn-fde:hover {
    background: #c9bca8;
    color: #1a1a1a;
}

/* Cards */
.card {
    background: var(--rh-bg-card);
    border: 1px solid var(--rh-border);
    border-radius: 8px;
}

.card-header {
    background: rgba(255,255,255,0.03);
    border-bottom: 1px solid var(--rh-border);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
}

.deal-card {
    transition: all 0.25s ease;
    border: 1px solid var(--rh-border);
}

.deal-card:hover {
    border-color: var(--rh-green);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.4);
}

/* Price styling */
.price-per-round {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 2rem;
    color: var(--rh-green-bright);
    line-height: 1;
}

.price-per-round-sm {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.5rem;
    color: var(--rh-green-bright);
}

.price-total {
    color: var(--rh-text);
    font-weight: 600;
}

/* Badges */
.badge-retailer {
    background: var(--rh-bg-dark);
    color: var(--rh-text);
    border: 1px solid var(--rh-border);
    font-weight: 500;
    font-size: 0.75rem;
    padding: 0.35rem 0.6rem;
}

.badge-caliber {
    background: var(--rh-green);
    color: white;
    font-weight: 600;
    font-size: 0.7rem;
    padding: 0.35rem 0.6rem;
    text-transform: uppercase;
}

.badge-stock {
    background: #166534;
    color: #4ade80;
    font-weight: 600;
    font-size: 0.7rem;
    padding: 0.35rem 0.6rem;
}

.badge-casing {
    background: rgba(184, 169, 144, 0.2);
    color: var(--rh-fde);
    font-weight: 500;
    font-size: 0.7rem;
    padding: 0.35rem 0.6rem;
}

.badge-sale {
    background: var(--rh-red);
    color: white;
    font-weight: 700;
}

/* Firearm deal score pills (see score_firearm_deals command) */
.score-pill {
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.7rem;
    letter-spacing: 0.5px;
    padding: 0.25rem 0.5rem;
    line-height: 1;
}
.score-pill .score-num {
    font-size: 0.85rem;
}
.score-pill.score-hot {
    background: var(--rh-red);
    color: #fff;
}
.score-pill.score-good {
    background: var(--rh-green);
    color: #fff;
}
.score-pill.score-lg {
    font-size: 0.85rem;
    padding: 0.4rem 0.75rem;
}
.score-pill.score-lg .score-num {
    font-size: 1.1rem;
}
.score-reason {
    font-size: 0.7rem;
    line-height: 1.3;
}
.score-reason.good { color: #86c35d; }
.score-reason.bad { color: var(--rh-orange); }

/* Hot deals / deal of the day */
.kind-tag {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    border: 1px solid var(--rh-border);
    color: var(--rh-text-muted);
}
.kind-tag.ammo { color: var(--rh-fde); border-color: rgba(184,169,144,0.4); }
.kind-tag.firearm { color: #86c35d; border-color: rgba(74,124,35,0.6); }
.hot-img {
    height: 130px;
    background: #fff;
    border-radius: 6px;
    overflow: hidden;
}
.hot-img img { width: 100%; height: 100%; object-fit: contain; }
.hot-card { transition: transform 0.15s, border-color 0.15s; }
.hot-card:hover { transform: translateY(-2px); border-color: var(--rh-green); }
.dotd-card {
    border: 2px solid var(--rh-fde);
    background: linear-gradient(135deg, rgba(184,169,144,0.08) 0%, var(--rh-bg-card) 60%);
    overflow: hidden;
}
.dotd-img {
    position: relative;
    background: #fff;
    min-height: 220px;
}
.dotd-img a { display: block; height: 100%; }
.dotd-img img { width: 100%; height: 100%; min-height: 220px; max-height: 320px; object-fit: contain; padding: 1rem; }
.dotd-kind { position: absolute; top: 10px; left: 10px; background: var(--rh-bg-dark); z-index: 1; }
.hot-tabs .btn { border-radius: 4px; }
.hot-tabs .btn.active { background: var(--rh-green); color: #fff; border-color: var(--rh-green); }

.badge-limit {
    background: var(--rh-orange);
    color: white;
    font-weight: 600;
}

.badge-reman {
    background: #854d0e;
    color: #fbbf24;
    font-weight: 600;
}

/* Coupon badge */
.coupon-tag {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    color: white;
    font-weight: 700;
    font-size: 0.8rem;
    padding: 0.4rem 0.75rem;
    border-radius: 4px;
    font-family: 'Inter', sans-serif;
}

/* Caliber pills */
.caliber-pill {
    background: var(--rh-bg-card);
    border: 1px solid var(--rh-border);
    color: var(--rh-text);
    padding: 0.75rem 1rem;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.caliber-pill:hover {
    background: var(--rh-green);
    border-color: var(--rh-green);
    color: white;
    transform: translateY(-2px);
}

.caliber-pill:hover .caliber-icon {
    color: white;
}

.caliber-pill:hover .caliber-category {
    color: rgba(255, 255, 255, 0.7);
}

.caliber-pill .caliber-icon {
    width: 24px;
    height: 40px;
    flex-shrink: 0;
    color: var(--rh-fde);
    transition: color 0.2s;
}

.caliber-pill .caliber-icon svg {
    width: 100%;
    height: 100%;
}

.caliber-pill .caliber-info {
    flex: 1;
    min-width: 0;
}

.caliber-pill .caliber-name {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.25rem;
    display: block;
    line-height: 1.1;
}

.caliber-pill .caliber-category {
    font-size: 0.7rem;
    color: var(--rh-text-muted);
    text-transform: uppercase;
    transition: color 0.2s;
}

/* Form controls */
.form-control, .form-select {
    background: var(--rh-bg-dark);
    border: 1px solid var(--rh-border);
    color: var(--rh-text);
    border-radius: 4px;
}

.form-control:focus, .form-select:focus {
    background: var(--rh-bg-dark);
    border-color: var(--rh-green);
    color: var(--rh-text);
    box-shadow: 0 0 0 2px rgba(74, 124, 35, 0.25);
}

.form-label {
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--rh-text-muted);
    letter-spacing: 0.5px;
}

.form-check-input:checked {
    background-color: var(--rh-green);
    border-color: var(--rh-green);
}

/* Filter sidebar */
.filter-sidebar {
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 2rem);
    display: flex;
    flex-direction: column;
}

.filter-card {
    background: var(--rh-bg-card);
    border: 1px solid var(--rh-border);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 2rem);
    overflow: hidden;
}

.filter-header {
    background: var(--rh-green);
    color: white;
    padding: 1rem;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.25rem;
    letter-spacing: 1px;
    border-radius: 7px 7px 0 0;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.filter-toggle-icon {
    transition: transform 0.3s ease;
}

.filter-header[aria-expanded="false"] .filter-toggle-icon {
    transform: rotate(-90deg);
}

.filter-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    min-height: 0;
}

.filter-body::-webkit-scrollbar {
    width: 6px;
}

.filter-body::-webkit-scrollbar-track {
    background: var(--rh-bg-dark);
}

.filter-body::-webkit-scrollbar-thumb {
    background: var(--rh-border);
    border-radius: 3px;
}

.filter-body::-webkit-scrollbar-thumb:hover {
    background: var(--rh-text-muted);
}

.filter-footer {
    flex-shrink: 0;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--rh-border);
    background: var(--rh-bg-card);
    text-align: center;
}

.filter-footer a:hover {
    color: var(--rh-red) !important;
}

/* Footer */
footer {
    background: #0a0a0a;
    border-top: 1px solid var(--rh-border);
    margin-top: auto;
    padding: 3rem 0 1.5rem;
}

footer h5, footer h6 {
    color: var(--rh-text);
    font-family: 'Bebas Neue', sans-serif;
    letter-spacing: 1px;
}

footer a {
    color: var(--rh-text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

footer a:hover {
    color: var(--rh-green-bright);
}

/* Stats */
.stat-box {
    text-align: center;
    padding: 1rem;
}

.stat-number {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 2.5rem;
    color: var(--rh-green-bright);
    line-height: 1;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--rh-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Table styling */
.table {
    color: var(--rh-text);
}

.table th {
    border-color: var(--rh-border);
    color: var(--rh-text-muted);
    text-transform: uppercase;
    font-size: 0.75rem;
    font-weight: 600;
}

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

/* Alert boxes */
.alert-tactical {
    background: rgba(74, 124, 35, 0.15);
    border: 1px solid var(--rh-green);
    color: var(--rh-green-bright);
    border-radius: 6px;
}

/* Pagination */
.pagination .page-link {
    background: var(--rh-bg-card);
    border-color: var(--rh-border);
    color: var(--rh-text);
}

.pagination .page-link:hover {
    background: var(--rh-green);
    border-color: var(--rh-green);
    color: white;
}

.pagination .page-item.active .page-link {
    background: var(--rh-green);
    border-color: var(--rh-green);
}

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

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

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

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

/* Utility */
.text-green { color: var(--rh-green-bright) !important; }
.text-fde { color: var(--rh-fde) !important; }
.bg-dark-card { background: var(--rh-bg-card) !important; }

/* Product image placeholder */
.product-img-placeholder {
    background: linear-gradient(135deg, #1a1a1a 0%, #252525 100%);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--rh-text-muted);
}
