/* ===== 1. CORE VARIABLES ===== */
:root {
    --primary: #28a745;
    --primary-dark: #1e7e34;
    --primary-light: #48c774;
    --dark: #212529;
    --light: #f8f9fa;
    --gray: #6c757d;
    --border: #e9ecef;
    --shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.08);
    --transition: all 0.3s ease;
}

/* ===== 2. BASE & TYPOGRAPHY ===== */
fw-bold {
    font-weight: 700 !important;
}

/* ===== 2. BASE & TYPOGRAPHY ===== */
body {
    font-family: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;      /* Standard clean enterprise default size */
    font-weight: 400;     /* Gotham Book / Regular */
    line-height: 1.6;
    letter-spacing: -0.01em; /* Gives Gotham that clean, compact look */
    color: var(--dark);
    background: var(--light);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== PAGE LOADER OVERLAY ===== */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #212529; /* Deep theme backdrop */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.page-loader.fade-out {
    opacity: 0;
    visibility: hidden;
}

/* ===== CORE LAYOUT VERTICAL CENTERING ===== */
.loader-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px; /* Generates perfect breathing space between logo ring and text */
}

.loader-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 140px;
    height: 140px;
}

.loader-symbol {
    width: 65px;
    height: 65px;
    object-fit: contain;
    z-index: 2;
    animation: symbolPulse 2s infinite ease-in-out;
}

.loader-ring {
    position: absolute;
    width: 115px;
    height: 115px;
    border: 3.5px solid transparent;
    /* Captures the dual green accents from your style variables */
    border-top-color: #28a745;    
    border-bottom-color: #48c774; 
    border-radius: 50%;
    z-index: 1;
    animation: loaderSpin 1.1s linear infinite;
}

/* ===== THE GRADIENT LOADING TEXT ===== */
.loader-text {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    padding-left: 0.25em; /* Offsets letter-spacing to guarantee absolute centering */
    
    /* Matches the smooth blue-to-green gradient profile in OneFlow-symbol.png */
    background: linear-gradient(135deg, #4ba3e3 0%, #3ca9d5 40%, #68cc66 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    
    /* Soft glowing breathing effect synced with the symbol */
    animation: textPulse 2s infinite ease-in-out;
}

/* ===== ANIMATION TIMELINE SCHEDULING ===== */
@keyframes loaderSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes symbolPulse {
    0%, 100% { transform: scale(0.92); opacity: 0.85; }
    50% { transform: scale(1.05); opacity: 1; }
}

@keyframes textPulse {
    0%, 100% { opacity: 0.75; filter: drop-shadow(0 0 2px rgba(75, 163, 227, 0.1)); }
    50% { opacity: 1; filter: drop-shadow(0 0 8px rgba(104, 204, 102, 0.3)); }
}

h1, .h1,
h2, .h2,
h3, .h3,
h4, .h4,
h5, .h5,
h6, .h6 {
    font-weight: 700; /* Headers look much cleaner with Gotham Bold (700) instead of Medium (600) */
    color: var(--dark);
    letter-spacing: -0.02em;
}

a {
    text-decoration: none;
    color: var(--dark);
    transition: var(--transition);
}

a:hover {
    color: var(--primary); /* Fixed: Changed from background fallback to light color flip */
}

/* ===== 3. BUTTONS ===== */
.btn-primary {
    background: var(--primary);
    border: none;
    transition: var(--transition);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

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

.btn-success:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 0.25rem 0.5rem rgba(40, 167, 69, 0.3);
}

/* ===== 4. FORM CONTROLS ===== */
.form-control,
.form-select {
    border-radius: 8px;
    border: 1px solid var(--border);
    padding: 0.625rem 0.75rem;
    transition: var(--transition);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.15);
}

.form-control.is-invalid,
.form-select.is-invalid {
    border-color: #dc3545;
}

.form-label {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--dark);
}

.form-text {
    font-size: 0.75rem;
    margin-top: 0.25rem;
    color: var(--gray);
}

.required:after {
    content: " *";
    color: #dc3545;
    font-weight: bold;
}

/* ===== 5. CARDS ===== */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.75rem 1.5rem rgba(0, 0, 0, 0.1);
}

/* ===== 6. SELECT2 STYLES ===== */
.select2-container--bootstrap-5 .select2-selection--single {
    height: calc(2.75rem + 2px);
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    line-height: 1.5;
    padding-left: 0;
    color: var(--dark);
}

.select2-container--bootstrap-5 .select2-selection--single .select2-selection__arrow {
    height: 100%;
    right: 10px;
}

.select2-container--bootstrap-5 .select2-dropdown {
    border-radius: 8px;
    border-color: var(--border);
}

.select2-container--bootstrap-5 .select2-results__option--highlighted {
    background: var(--primary);
}

/* ===== 7. SIDEBAR ===== */
.sidebar {
    width: 250px;
    position: fixed;
    top: 56px;
    bottom: 0;
    left: 0;
    background: #fff;
    border-right: 1px solid var(--border);
    transition: var(--transition);
    z-index: 1000;
    overflow-y: auto;
}

.sidebar.collapsed {
    width: 70px;
}

.sidebar.collapsed .nav-link span {
    display: none;
}

.sidebar.collapsed + .content-wrapper {
    margin-left: 70px;
}

.sidebar .nav-link {
    color: var(--dark);
    padding: 12px 20px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar .nav-link:hover {
    background: var(--light);
    color: var(--primary);
}

.sidebar .nav-link.active {
    background: var(--primary);
    color: #fff;
}

.sidebar .nav-link i {
    width: 20px;
    text-align: center;
}

/* ===== 8. CONTENT WRAPPER ===== */
.content-wrapper {
    margin-left: 250px;
    margin-top: 56px;
    padding: 20px;
    transition: var(--transition);
    min-height: calc(100vh - 56px);
}

/* ===== 9. STAT CARDS ===== */
.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

/* Soft Badges */
.badge.bg-primary-soft {
    background: rgba(40, 167, 69, 0.1);
    color: var(--primary);
}

/* ===== 10. LOGIN PAGE ===== */
.login-section {
    background: linear-gradient(135deg, var(--dark) 0%, #1a251a 100%);
    min-height: 100vh;
}

.login-card {
    transition: var(--transition);
}

.login-card:hover {
    transform: translateY(-3px);
}

/* ===== 11. ALERTS ===== */
/* ===== 11. ALERTS ===== */
/* Added mapping for Django's specific message tags to Bootstrap colors */
.alert-error { background-color: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-success { background-color: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-warning { background-color: #fff3cd; color: #856404; border: 1px solid #ffeeba; }
.alert-info { background-color: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

.alert {
    border-radius: 12px;
}

/* ===== 12. TABLES ===== */
.table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.table-hover tbody tr:hover {
    background-color: var(--light);
    cursor: pointer;
}

.table-footer {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* ===== 13. ACTION BUTTONS ===== */
.action-buttons {
    display: flex;
    gap: 6px;
}

.action-buttons .btn-sm {
    padding: 4px 8px;
}

/* ===== 14. ICONS ===== */
.product-icon-sm,
.store-icon-sm,
.vendor-icon-sm,
.category-icon-sm {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
}

/* ===== 15. EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 60px 24px;
}

.empty-state i {
    font-size: 64px;
    color: var(--gray);
}

/* ===== 16. BREADCRUMB ===== */
.breadcrumb-item a {
    color: var(--primary);
    text-decoration: none;
}

.breadcrumb-item a:hover {
    text-decoration: underline;
}

/* ===== 17. RESPONSIVE ===== */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
        width: 250px !important;
        z-index: 1050;
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .content-wrapper {
        margin-left: 0 !important;
        padding: 16px;
    }
    
    .sidebar.collapsed + .content-wrapper {
        margin-left: 0 !important;
    }
    
    .navbar {
        left: 0 !important;
    }
}

@media (max-width: 768px) {
    .container-fluid {
        padding: 1rem;
    }
    
    .card {
        padding: 1rem !important;
    }
    
    .d-flex.justify-content-between {
        flex-direction: column;
        gap: 1rem;
    }
    
    .d-flex.justify-content-between .btn {
        width: 100%;
    }
    
    .row.g-4 {
        --bs-gutter-y: 1rem;
    }
    
    .table-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-control {
        width: 100%;
    }
    
    .action-buttons {
        flex-direction: column;
        gap: 4px;
    }
    
    .form-label {
        font-size: 0.8rem;
    }
    
    .form-control,
    .form-select {
        font-size: 0.9rem;
        padding: 0.5rem 0.75rem;
    }
}

@media (max-width: 576px) {
    .page-header {
        padding: 1rem;
    }
    
    .page-title {
        font-size: 1.5rem;
    }
    
    .card-footer .d-flex {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .card-footer .btn {
        width: 100%;
    }
}

/* ===== 18. PRINT STYLES ===== */
@media print {
    .sidebar,
    .navbar,
    .page-actions,
    .action-buttons {
        display: none !important;
    }
    
    .content-wrapper {
        margin-left: 0 !important;
        padding: 0 !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #ccc !important;
    }
}



.extra-small { font-size: 0.72rem; }
.bg-success-soft { background-color: rgba(25, 135, 84, 0.1); }

.select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__choice {
    background-color: #198754 !important;
    color: #ffffff !important; /* Forces the text color to stay white */
    border: none !important;
    border-radius: 20px;
    padding: 2px 10px;
    font-size: 0.8rem;
}

/* Ensures the dynamic 'X' (remove button) text also turns white */
.select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__choice__remove {
    color: #ffffff !important;
    opacity: 0.8;
}

.select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__choice__remove:hover {
    color: #ffffff !important;
    opacity: 1;
}