/* ===================================
   VARIABLES
   =================================== */
:root {
    /* Colors */
    --color-bg-primary: #0a0a0a;
    --color-bg-secondary: #1a1a1a;
    --color-bg-tertiary: #2a2a2a;
    --color-accent-gold: #d4af37;
    --color-accent-gold-hover: #f0c75e;
    --color-text-primary: #ffffff;
    --color-text-secondary: #b0b0b0;
    --color-text-muted: #808080;
    --color-success: #10b981;
    --color-error: #ef4444;
    --color-warning: #f59e0b;
    --color-info: #3b82f6;

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
    --shadow-gold: 0 0 20px rgba(212, 175, 55, 0.3);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 300ms ease;
    --transition-slow: 500ms ease;

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Directory Toggles - Premium Golden Style */
.directory-toggles {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 25px;
    padding: 8px;
    background: rgba(10, 10, 10, 0.4);
    border-radius: 35px;
    border: 2px solid rgba(212, 175, 55, 0.2);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    position: sticky;
    top: 90px;
    z-index: 90;
    background: var(--color-bg-primary);
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.toggle-btn {
    background: linear-gradient(135deg, rgba(26, 26, 37, 0.8) 0%, rgba(42, 42, 52, 0.8) 100%);
    border: 2px solid rgba(212, 175, 55, 0.4);
    color: var(--color-text-secondary);
    padding: 10px 24px;
    border-radius: 25px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    min-width: 220px;
    /* Equal width for symmetry */
    text-align: center;
}

.toggle-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.2), transparent);
    transition: left 0.5s;
}

.toggle-btn:hover::before {
    left: 100%;
}

.toggle-btn:hover {
    border-color: var(--color-accent-gold);
    color: var(--color-accent-gold);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.3);
}

.toggle-btn.active {
    background: linear-gradient(135deg, #d4af37 0%, #f0c75e 50%, #d4af37 100%);
    color: #000;
    font-weight: 700;
    border: 2px solid #f0d478;
    box-shadow:
        0 0 30px rgba(212, 175, 55, 0.6),
        0 4px 20px rgba(212, 175, 55, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.toggle-btn.active::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 18px;
    padding: 2px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.4), transparent, rgba(255, 255, 255, 0.4));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    pointer-events: none;
}

/* ===================================
   RESET & BASE STYLES
   =================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background-color: var(--color-bg-primary);
    color: var(--color-text-primary);
    line-height: 1.6;
    min-height: 100vh;
    /* Copy Protection Fallback */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Re-enable selection for inputs and selects */
input,
textarea,
select {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* ===================================
   LAYOUT
   =================================== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

/* ===================================
   HEADER
   =================================== */
.header {
    background-color: var(--color-bg-secondary);
    border-bottom: 1px solid var(--color-bg-tertiary);
    padding: 0.5rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.header .container {
    max-width: 100%;
    padding: 0 1rem;
}

.header-content {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: var(--spacing-md);
    min-height: 70px;
}

/* Centered Branding Text */
.header-center {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* Ensure it doesn't shrink or grow too much */
    flex: 0 0 auto;
}

.logo {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
}

.nav {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.brand-text-main {
    font-family: 'Times New Roman', Times, serif;
    color: var(--color-accent-gold);
    font-size: 2rem;
    line-height: 1;
    white-space: nowrap;
}

.brand-text-sub {
    font-family: var(--font-family);
    color: var(--color-accent-gold);
    font-size: 1rem;
    letter-spacing: 0.05rem;
    margin-top: 0.2rem;
    font-weight: 500;
}

@media (max-width: 1300px) {
    .header-center {
        display: none;
        /* Hide earlier to prevent overlap with logo/nav */
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-wrap: wrap;
        justify-content: center;
        gap: var(--spacing-sm);
    }

    .nav {
        width: 100%;
        justify-content: center;
        gap: var(--spacing-sm);
    }
}

.logo img {
    height: 65px;
    width: auto;
    display: block;
}

.nav {
    display: flex;
    gap: var(--spacing-sm);
    align-items: center;
    flex-shrink: 0;
}

.nav a {
    color: var(--color-text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition-fast);
    position: relative;
}

.nav a:hover {
    color: var(--color-accent-gold);
}

.nav a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--color-accent-gold);
    transition: width var(--transition-base);
}

.nav a:hover::after {
    width: 100%;
}

/* ===================================
   MAIN CONTENT
   =================================== */
.main-content {
    padding: var(--spacing-x5) 0;
    min-height: calc(100vh - 400px);
}

.section-title {
    font-size: 1.875rem;
    font-weight: 600;
    margin-bottom: var(--spacing-lg);
    color: var(--color-text-primary);
}

/* ===================================
   SEARCH & FILTERS (PREMIUM GOLD)
   =================================== */
.search-container {
    margin-bottom: var(--spacing-lg);

    /* 👈 Add these new lines */
    position: sticky;
    top: 145px;
    /* Placed below the directory buttons */
    z-index: 80;
    /* Keeps it above the table but below the buttons */
    background: var(--color-bg-primary);
    /* Prevents content from showing through */
    padding: 20px 0;
    /* Adds a little breathing room */
}

.search-input {
    width: 100%;
    padding: 1rem 1.5rem;
    background-color: rgba(26, 26, 26, 0.8);
    border: 1px solid var(--color-accent-gold);
    border-radius: 50px;
    color: var(--color-text-primary);
    font-size: 1rem;
    transition: all var(--transition-base);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.1);
}

.search-input:focus {
    outline: none;
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.3);
    background-color: rgba(26, 26, 26, 1);
}

.search-input::placeholder {
    color: var(--color-text-muted);
}

.filters-container {
    display: flex;
    flex-wrap: nowrap;
    /* FORCE SINGLE ROW */
    overflow-x: auto;
    /* Enable horizontal scroll if needed */
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);

    position: sticky;
    top: 240px;
    /* Placed below the search bar */
    z-index: 70;
    /* Below the search bar but above the table list */
    background: var(--color-bg-primary);
    /* Keeps content from showing through */
    padding: 8px 0;

    /* Hide Scrollbar for cleaner look */
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE/Edge */
}

/* Hide scrollbar for Chrome/Safari/Opera */
.filters-container::-webkit-scrollbar {
    display: none;
}

.filter-select {
    width: auto;
    /* Auto-fit width */
    min-width: 150px;
    /* Minimum width to prevent being too small */
    padding: 0.8rem 1.2rem;
    background-color: rgba(26, 26, 26, 0.8);
    border: 1px solid var(--color-accent-gold);
    border-radius: 15px;
    color: var(--color-text-primary);
    font-size: 0.95rem;
    cursor: pointer;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0px;
}

.result-count {
    color: var(--color-text-secondary);
    font-size: 0.95rem;
    border-spacing: 0;
    white-space: normal;
}

/* Filter Actions - Merged with Table */
.filter-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.2rem 1.5rem;
    background-color: rgba(26, 26, 26, 0.6);
    border: 2px solid var(--color-accent-gold);
    border-bottom: none;
    /* Keeps it merged with the table */
    border-radius: 15px 15px 0 0;
    /* Matches the curve of the table */
    backdrop-filter: blur(10px);
    margin-bottom: 0;
    /* Add these two lines to match the table width */
    width: calc(100vw - 40px);
    margin-left: calc(50% - (100vw - 40px) / 2);
}

/* Merged Search Container */
.search-container.merged {
    margin-bottom: 0;
    border-radius: 20px 20px 0 0;
    border: 2px solid var(--color-accent-gold);
    border-bottom: 1px solid rgba(212, 175, 55, 0.1);
    background-color: rgba(26, 26, 26, 0.6);
    padding: 1.5rem;
    backdrop-filter: blur(10px);
    /* 👈 ADD THESE TWO LINES */
    width: calc(100vw - 40px);
    margin-left: calc(50% - (100vw - 40px) / 2);
}

.search-container.merged .search-input {
    background-color: rgba(10, 10, 10, 0.6);
    box-shadow: none;
    border: 1px solid rgba(212, 175, 55, 0.3);
}

.search-container.merged .search-input:focus {
    border-color: var(--color-accent-gold);
    background-color: rgba(10, 10, 10, 0.8);
}

/* Table Container with Merged Header */
.table-container.merged {
    border-top: none;
    border-radius: 0 0 20px 20px;
    margin-top: 0;
    /* 👈 ADD THESE TWO LINES */
    width: calc(100vw - 40px);
    margin-left: calc(50% - (100vw - 40px) / 2);
}

/* ===================================
   TABLE (PREMIUM GOLD)
   =================================== */
.table-container {
    background-color: rgba(26, 26, 26, 0.6);
    border-radius: 20px;
    overflow-y: auto;
    overflow-x: auto;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    max-height: 500px;
    position: relative;
    border: 2px solid var(--color-accent-gold);
    backdrop-filter: blur(10px);
    margin-top: 0;
    /* Add these two lines */
    width: calc(100vw - 40px);
    margin-left: calc(50% - (100vw - 40px) / 2);
}

/* 👈 This closing brace was missing! */

/* --- Add this for Tight & Compact Columns --- */
.business-table th:nth-child(1),
.business-table td:nth-child(1),
.business-table th:nth-child(3),
.business-table td:nth-child(3),
.business-table th:nth-child(8),
.business-table td:nth-child(8),
.business-table th:nth-child(9),
.business-table td:nth-child(9) {
    width: 1%;
    white-space: nowrap;
    padding-left: 15px;
    padding-right: 15px;
}

/* Set specific width for Business ID */
.business-table th:nth-child(1) {
    width: 85px;
}

/* Make rows more compact */
.business-table td {
    padding: 0.5rem 0.8rem;
}

/* Custom Scrollbar for the table */
/* Premium Golden Scrollbar for the table */
.table-container::-webkit-scrollbar {
    width: 12px;
}

.table-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    margin: 10px 2px;
    border-radius: 10px;
}

.table-container::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #d4af37 0%, #f0c75e 50%, #d4af37 100%);
    border-radius: 10px;
    border: 3px solid transparent;
    background-clip: padding-box;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.3);
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #f0c75e 0%, #ffd700 50%, #f0c75e 100%);
}

.business-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    white-space: normal;
}

.business-table thead {
    background-color: rgba(10, 10, 10, 0.95);
    position: sticky;
    top: 0;
    z-index: 10;
}

.business-table th {
    padding: 1.2rem 1rem;
    text-align: center;
    font-weight: 600;
    color: var(--color-accent-gold);
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--color-accent-gold);
    white-space: nowrap;
}

.business-table td {
    padding: 0.3rem;
    text-align: center;
    border-bottom: 1px solid rgba(212, 175, 55, 0.1);
    color: var(--color-text-secondary);
    font-size: 0.95rem;
    vertical-align: middle;
}

.business-table tbody tr {
    transition: background-color var(--transition-fast);
}

.business-table tbody tr:hover {
    background-color: rgba(212, 175, 55, 0.08) !important;
}

.business-table a {
    color: var(--color-accent-gold);
    text-decoration: none;
    transition: color var(--transition-fast);
    border-bottom: 1px dotted var(--color-accent-gold);
}

.business-table a:hover {
    color: var(--color-accent-gold-hover);
    border-bottom-style: solid;

}

/* Specific styling for Offers Table */
.offers-table th:nth-child(2),
/* Date */
.offers-table td:nth-child(2) {
    width: 100px;
}

.offers-table th:nth-child(3),
/* Business ID */
.offers-table td:nth-child(3) {
    width: 120px;
}

.offers-table th:nth-child(5),
/* Contact */
.offers-table td:nth-child(5),
.offers-table th:nth-child(7),
/* Offer Days */
.offers-table td:nth-child(7) {
    width: 100px;
}

.offers-table th:nth-child(8),
/* Description */
.offers-table td:nth-child(8) {
    width: 300px;
    white-space: normal;
    /* Allow wrapping */
}

/* ===================================
   FOOTER
   =================================== */
.footer {
    background-color: var(--color-bg-secondary);
    border-top: 1px solid var(--color-bg-tertiary);
    padding: var(--spacing-sm) 0;
    text-align: center;
    width: 100%;
    margin-top: 5rem;
}

/* ===================================
   BUTTONS & MODAL
   =================================== */
.btn-view {
    background: linear-gradient(135deg, var(--color-accent-gold) 0%, #f0c75e 100%);
    color: #000;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: 0 2px 10px rgba(212, 175, 55, 0.3);
}

.btn-view:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.5);
}

/* Modal Styles - Premium Design */
.modal {
    display: flex;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal.show {
    visibility: visible;
    opacity: 1;
}

.modal-content {
    background: transparent;
    padding: var(--spacing-xl);
    border-radius: 1.5rem;
    box-shadow:
        0 8px 32px 0 rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(212, 175, 55, 0.3),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(212, 175, 55, 0.6);
    backdrop-filter: blur(10px);
    width: 95%;
    max-width: 1200px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 1.5rem;
    padding: 2px;
    background: linear-gradient(135deg,
            rgba(212, 175, 55, 0.6) 0%,
            rgba(212, 175, 55, 0.2) 50%,
            rgba(212, 175, 55, 0.6) 100%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    pointer-events: none;
    opacity: 0.8;
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    color: var(--color-text-secondary);
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    transition: color var(--transition-fast);
    z-index: 10;
}

.close-modal:hover {
    color: var(--color-accent-gold);
}

.modal-details-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-top: 1.5rem;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.detail-item label {
    color: var(--color-accent-gold);
    font-size: 0.85rem;
    margin-bottom: var(--spacing-sm);
    color: var(--color-text-primary);
    text-shadow: 0 2px 10px rgba(212, 175, 55, 0.3);
}

.span-1 {
    grid-column: span 1;
}

.span-2 {
    grid-column: span 2;
}

.span-3 {
    grid-column: span 3;
}

.span-4 {
    grid-column: span 4;
}

/* ===================================
   RESPONSIVE DESIGN
   =================================== */
@media (max-width: 768px) {
    .filters-container {
        grid-template-columns: 1fr;
    }

    .table-container {
        overflow-x: auto;
    }

    .modal-details-grid {
        grid-template-columns: 1fr;
    }

    .span-1,
    .span-2,
    .span-3,
    .span-4 {
        grid-column: span 1;
    }
}