/* CRM-Wide Theme - Based on Beautiful Inventory Design */

/* ===== GLOBAL STYLES ===== */
:root {
    --primary-color: #007bff;
    --primary-dark: #0056b3;
    --primary-light: #e3f2fd;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --light-bg: #f8f9fa;
    --border-color: #e9ecef;
    --text-dark: #495057;
    --text-muted: #6c757d;
    --shadow-light: 0 2px 8px rgba(0,0,0,0.05);
    --shadow-medium: 0 4px 15px rgba(0,0,0,0.1);
    --shadow-heavy: 0 8px 25px rgba(0,123,255,0.2);
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Global body styles */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

/* Login page specific styles */
body:not(.has-subscription) .login-outer {
    height: 100vh;
    width: 100vw;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(-45deg, #0d6efd0d, #0099ff0d, #0d6efd1a, #0099ff1a);
    background-size: 400% 400%;
    animation: gradient 15s ease infinite;
    overflow: hidden;
}

/* Only apply overflow hidden to login page */
body:not(.has-subscription) .login-outer ~ * {
    overflow: hidden;
}

/* Allow scrolling on other pages */
body.has-subscription {
    overflow: auto;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
    margin: auto;
}

.login-card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    padding: 30px;
    width: 100%;
}

.brand-logo {
    text-align: center;
    margin-bottom: 30px;
}

.brand-logo i {
    font-size: 48px;
    color: #007bff;
    margin-bottom: 10px;
}

.brand-logo h1 {
    font-size: 24px;
    color: #333;
    margin: 0;
}

.login-card .input-group {
    margin-bottom: 20px;
}

.login-card .input-group-text {
    background: transparent;
    border-right: none;
    padding: 12px 15px;
}

.login-card .form-control {
    border-left: none;
    padding: 12px 15px;
}

.login-card .btn {
    width: 100%;
    padding: 12px;
    margin-top: 10px;
}

.login-footer {
    text-align: center;
    margin-top: 20px;
}

.login-footer a {
    color: #007bff;
    text-decoration: none;
}

.login-footer a:hover {
    text-decoration: underline;
}

@keyframes gradient {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* ===== PAGE CONTAINERS ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

.page-header {
    background: linear-gradient(135deg, var(--light-bg) 0%, #e9ecef 100%);
    border-radius: var(--border-radius);
    padding: 30px;
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-light);
}

.page-header h1, .page-header h2 {
    color: var(--text-dark);
    font-weight: 700;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.page-header p {
    color: var(--text-muted);
    margin-bottom: 0;
    font-size: 1.1rem;
}

/* ===== CARDS ===== */
.card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    transition: var(--transition);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-medium);
    transform: translateY(-2px);
}

.card-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 20px 25px;
    border-bottom: none;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-body {
    padding: 25px;
}

.card-footer {
    background: var(--light-bg);
    border-top: 1px solid var(--border-color);
    padding: 20px 25px;
}

/* Force all text and icons in card headers to be white */
.card-header, .card-header *, .card-header::before, .card-header::after {
    color: #fff !important;
}

/* Card header text color */
.card-header h5 {
    color: #ffffff !important;
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.card-header h5 i {
    color: #ffffff !important;
    margin-right: 0.5rem;
}

/* ===== FORMS ===== */
.form-control, .form-select, .form-check-input {
    border-radius: var(--border-radius-sm);
    border: 2px solid var(--border-color);
    transition: var(--transition);
    padding: 12px 15px;
    font-size: 0.95rem;
}

.form-control:focus, .form-select:focus, .form-check-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.15);
    transform: translateY(-1px);
}

.form-label {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-size: 0.9rem;
}

.form-text {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 5px;
}

/* ===== BUTTONS ===== */
.btn {
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: var(--transition);
    border: none;
    padding: 12px 24px;
    font-size: 0.95rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--primary-dark), #004085);
    transform: translateY(-2px);
    box-shadow: var(--shadow-heavy);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color), #20c997);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: linear-gradient(135deg, #20c997, #17a2b8);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(40, 167, 69, 0.4);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning-color), #fd7e14);
    color: #212529;
}

.btn-warning:hover:not(:disabled) {
    background: linear-gradient(135deg, #fd7e14, #e55a00);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 193, 7, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color), #c82333);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: linear-gradient(135deg, #c82333, #a71e2a);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(220, 53, 69, 0.4);
}

.btn-outline-primary {
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-heavy);
}

.btn:disabled {
    background: var(--secondary-color);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ===== TABLES ===== */
.table {
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    box-shadow: var(--shadow-light);
}

/* Table styles */
.table {
    width: 100%;
    margin-bottom: 1rem;
    background-color: transparent;
    border-collapse: separate;
    border-spacing: 0;
}

/* Header styling */
.table thead th {
    background-color: #0d6efd;
    color: #ffffff !important;
    font-weight: 600;
    padding: 1rem;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    vertical-align: middle;
}

.table thead th:last-child {
    border-right: none;
}

/* Body styling */
.table tbody td {
    padding: 1rem;
    vertical-align: middle;
    border-right: 1px solid #dee2e6;
    border-bottom: 1px solid #dee2e6;
}

.table tbody td:last-child {
    border-right: none;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* Hover effect */
.table tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.05);
}

/* Status badge styling */
.table .badge {
    padding: 0.5rem 0.75rem;
    font-weight: 500;
}

/* Action button styling */
.table .btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.875rem;
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background-color: var(--primary-light);
    transform: scale(1.01);
}

.table tbody td {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    color: #222 !important;
}

/* ===== NAVIGATION ===== */
.navbar {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    box-shadow: var(--shadow-medium);
    padding: 15px 0;
}

.navbar-brand {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: white !important;
}

.navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.9) !important;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 10px 20px;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
    margin: 0 5px;
}

.navbar-nav .nav-link:hover {
    color: white !important;
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.navbar-nav .nav-link.active {
    background: var(--primary-color);
    color: white !important;
}

/* Ensure navbar user email is readable in both themes */
.navbar-user-email {
    color: #222 !important;
}
body.dark-theme .navbar-user-email {
    color: #fff !important;
}

/* User Account Dropdown Styles */
.navbar .dropdown-toggle span,
.crm-mobile-header .dropdown-toggle span {
    /* Removed text-transform: lowercase to allow proper name capitalization */
}

/* Ensure email is lowercase in all contexts */
.user-email,
[data-user-email] {
    text-transform: lowercase !important;
}

/* Allow names to display with proper capitalization */
.dropdown-toggle span {
    /* Removed text-transform: lowercase to allow proper name capitalization */
}

/* Sidebar styles - Fixed width to prevent squeezing */
.sidebar {
    width: 250px !important;
    min-width: 250px !important;
    max-width: 250px !important;
    min-height: calc(100vh - 44px);
    background: #181c22;
    border-right: 1px solid #23272f;
    padding: 20px 0;
    transition: all 0.3s ease;
    position: sticky;
    top: 44px;
    height: calc(100vh - 44px);
    overflow-y: auto;
    z-index: 1000;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
}

#subscription-message {
    width: 250px;
    min-height: calc(100vh - 44px);
    background: #181c22;
    border-right: 1px solid #23272f;
    padding: 20px;
    position: sticky;
    top: 44px;
    height: calc(100vh - 44px);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    z-index: 1000;
}

#subscription-message h5 {
    color: #fff;
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

#subscription-message p {
    color: #adb5bd;
    margin-bottom: 1.5rem;
}

.subscription-message-mobile {
    background: #181c22;
    border-bottom: 1px solid #23272f;
    padding: 20px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 200px;
}

.subscription-message-mobile h5 {
    color: #fff;
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.subscription-message-mobile p {
    color: #adb5bd;
    margin-bottom: 1.5rem;
}

/* Hide sidebar completely when subscription message is shown */
body:not(.has-subscription) .sidebar {
    display: none !important;
}

/* Ensure main content doesn't squeeze sidebar - only apply to the main content container */
.content-container {
    margin-left: 0px !important;
    width: calc(100% - 0px) !important;
    max-width: calc(100% - 0px) !important;
    flex: 1 !important;
}

/* Prevent any responsive CSS from affecting sidebar width */
@media (min-width: 769px) {
    .sidebar {
        width: 250px !important;
        min-width: 250px !important;
        max-width: 250px !important;
        flex-shrink: 0 !important;
        flex-grow: 0 !important;
    }
    
    .content-container {
        margin-left: 0px !important;
        width: calc(100% - 0px) !important;
        max-width: calc(100% - 0px) !important;
    }
}

/* Hide widgets and cart for users without subscription */
body:not(.has-subscription) #floating-chat-widget,
body:not(.has-subscription) .cart-button,
body:not(.has-subscription) #quick-inquiry-fab {
    display: none !important;
}

/* Keep support widget visible for all users */
.support-widget {
    display: block !important;
}

/* Support Widget Position */
.support-widget {
    position: fixed;
    bottom: 20px;
    right: 120px;
    z-index: 1000;
}

/* Move support widget to far right ONLY on subscription page */
body:not(.has-subscription) .support-widget {
    right: 100px !important;
}

/* Keep normal positioning on other pages */
body.has-subscription .support-widget {
    right: 90px !important;
}

/* Ensure support widget is visible */
.support-widget {
    display: block !important;
}

/* Hide all other widgets on subscription page */
body:not(.has-subscription) #floating-chat-widget,
body:not(.has-subscription) #quick-inquiry-fab,
body:not(.has-subscription) .cart-button {
    display: none !important;
}

/* Subscription page specific styles */
body:not(.has-subscription) .content-container {
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
}

/* Ensure subscription message takes full width on mobile */
@media (max-width: 768px) {
    #subscription-message {
        width: 100%;
        position: relative;
        top: 0;
        min-height: 200px;
    }
    
    .subscription-message-mobile {
        width: 100%;
        min-height: 200px;
        padding: 20px;
        text-align: center;
    }
}

/* ===== SIDEBAR ===== */
.sidebar .nav-link {
    color: #adb5bd !important;
    padding: 15px 20px;
    border-radius: 0;
    border-left: 3px solid transparent;
    transition: var(--transition);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-size: 0.9rem;
    position: relative;
    z-index: 1;
    margin-bottom: 2px;
}

.sidebar .nav-link:hover {
    background: #23272f !important;
    border-left-color: var(--primary-color) !important;
    color: #ffffff !important;
}

.sidebar .nav-link.active {
    background: var(--primary-color) !important;
    color: white !important;
    border-left-color: white !important;
    position: relative;
    z-index: 2;
}

/* Force ALL text and icons to be visible on hover */
.sidebar .nav-link:hover * {
    color: #ffffff !important;
}

.sidebar .nav-link:hover span {
    color: #ffffff !important;
}

.sidebar .nav-link:hover i {
    color: #ffffff !important;
}

/* Force text visibility on all states */
.sidebar .nav-link span {
    color: inherit !important;
}

.sidebar .nav-link i {
    color: inherit !important;
}

/* Additional specificity to override any conflicting styles */
.sidebar .nav-link:hover span,
.sidebar .nav-link:hover i,
.sidebar .nav-link:hover strong,
.sidebar .nav-link:hover em,
.sidebar .nav-link:hover b {
    color: #ffffff !important;
}

/* ===== ALERTS ===== */
.alert {
    border-radius: var(--border-radius-sm);
    border: none;
    padding: 15px 20px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    box-shadow: var(--shadow-light);
}

.alert-success {
    background: linear-gradient(135deg, var(--success-color), #20c997);
    color: white;
}

.alert-warning {
    background: linear-gradient(135deg, var(--warning-color), #fd7e14);
    color: #212529;
}

.alert-danger {
    background: linear-gradient(135deg, var(--danger-color), #c82333);
    color: white;
}

.alert-info {
    background: linear-gradient(135deg, #17a2b8, #138496);
    color: white;
}

/* ===== MODALS ===== */
.modal-content {
    border-radius: var(--border-radius);
    border: none;
    box-shadow: var(--shadow-heavy);
}

.modal-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border-bottom: none;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    padding: 20px 25px;
}

.modal-title {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    background: var(--light-bg);
    border-top: 1px solid var(--border-color);
    padding: 20px 25px;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
}

/* ===== DASHBOARD CARDS ===== */
.dashboard-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 25px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-light);
    transition: var(--transition);
    text-align: center;
    margin-bottom: 20px;
    min-height: 220px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-heavy);
}

.dashboard-card .icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.dashboard-card .number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 10px;
}

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

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.animate-fade-in-up {
    animation: fadeInUp 0.6s ease forwards;
}

.animate-slide-in-left {
    animation: slideInLeft 0.6s ease forwards;
}

.animate-pulse {
    animation: pulse 2s infinite;
}

/* ===== UTILITY CLASSES ===== */
.gradient-bg {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
}

.text-gradient {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.shadow-custom {
    box-shadow: var(--shadow-medium);
}

.border-custom {
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .page-header {
        padding: 20px;
        margin-bottom: 20px;
    }
    
    .card-body {
        padding: 20px;
    }
    
    .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
    
    .table thead th,
    .table tbody td {
        padding: 10px 15px;
        font-size: 0.9rem;
    }
    
    .dashboard-card {
        padding: 20px;
    }
    
    .dashboard-card .icon {
        font-size: 2.5rem;
    }
    
    .dashboard-card .number {
        font-size: 2rem;
    }
}

@media (max-width: 576px) {
    .container {
        padding: 0 10px;
    }
    
    .page-header {
        padding: 15px;
    }
    
    .card-body {
        padding: 15px;
    }
    
    .btn {
        width: 100%;
        margin-bottom: 10px;
    }
    
    .table-responsive {
        font-size: 0.85rem;
    }
}

/* ===== LOADING STATES ===== */
.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--primary-color);
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== PRINT STYLES ===== */
@media print {
    .btn, .navbar, .sidebar, .modal {
        display: none !important;
    }
    
    .card {
        border: 1px solid #000;
        box-shadow: none;
    }
    
    .table {
        border: 1px solid #000;
    }
    
    .table thead th {
        background: #f0f0f0 !important;
        color: #000 !important;
    }
}

/* --- DARK MODE OPTIMIZATION & COMPACTNESS --- */
body.dark-theme {
    background: #181c22;
    color: #f8f9fa;
}
body.dark-theme .page-header,
body.dark-theme .card,
body.dark-theme .modal-content {
    background: #23272f;
    color: #f8f9fa;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
body.dark-theme .card-header,
body.dark-theme .page-header,
body.dark-theme h1,
body.dark-theme h2,
body.dark-theme h3,
body.dark-theme h4,
body.dark-theme h5,
body.dark-theme h6 {
    color: #fff !important;
}
body.dark-theme .table thead th {
    background: linear-gradient(135deg, #007bff, #0056b3) !important;
    color: #fff !important;
}
body.dark-theme .form-control,
body.dark-theme .form-select {
    background: #23272f;
    color: #f8f9fa;
    border-color: #333a44;
}
body.dark-theme .form-control:focus,
body.dark-theme .form-select:focus {
    background: #23272f;
    color: #fff;
    border-color: #007bff;
}
body.dark-theme .btn,
body.dark-theme .btn-primary,
body.dark-theme .btn-outline-primary {
    color: #fff;
}
body.dark-theme .dashboard-card .label {
    color: #b0b8c1;
}
body.dark-theme .card-footer,
body.dark-theme .modal-footer {
    background: #181c22;
    color: #f8f9fa;
}
body.dark-theme .table tbody tr:hover {
    background: #23272f;
}
body.dark-theme .alert {
    color: #fff;
}

/* --- SHOP NAME ALWAYS BLUE --- */
.navbar-brand, .sidebar h4, .sidebar .shop-name, .crm-mobile-title {
    color: #007bff !important;
    font-weight: 700;
    letter-spacing: 1px;
}

/* --- REMOVE DOUBLE TOP BARS --- */
.navbar {
    box-shadow: none;
    border-bottom: 1px solid #23272f;
    background: #181c22;
}
body.dark-theme .navbar {
    background: #181c22;
    border-bottom: 1px solid #23272f;
}

/* --- COMPACTNESS: REDUCE SIZES --- */
:root {
    --border-radius: 10px;
    --border-radius-sm: 6px;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-light: 0 1px 4px rgba(0,0,0,0.04);
    --shadow-medium: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-heavy: 0 4px 16px rgba(0,123,255,0.15);
}
.container, .container-fluid {
    padding-left: 8px;
    padding-right: 8px;
}
.page-header {
    padding: 18px 18px 12px 18px;
    margin-bottom: 18px;
}
.card, .dashboard-card, .modal-content {
    border-radius: var(--border-radius);
    padding: 14px 14px 10px 14px;
    margin-bottom: 14px;
}
.card-header, .modal-header {
    padding: 12px 16px;
    font-size: 1.05rem;
}
.card-body, .modal-body {
    padding: 14px 14px 10px 14px;
}
.card-footer, .modal-footer {
    padding: 10px 14px;
}
.form-control, .form-select, .form-check-input {
    border-radius: var(--border-radius-sm);
    padding: 8px 10px;
    font-size: 0.93rem;
}
.btn, .btn-primary, .btn-outline-primary, .btn-success, .btn-danger, .btn-warning {
    padding: 8px 18px;
    font-size: 0.97rem;
    border-radius: var(--border-radius-sm);
}
.table thead th, .table tbody td {
    padding: 8px 10px;
    font-size: 0.97rem;
}
.dashboard-card .icon {
    font-size: 2.1rem;
    margin-bottom: 8px;
}
.dashboard-card .number {
    font-size: 1.5rem;
    margin-bottom: 6px;
}
.dashboard-card .label {
    font-size: 0.85rem;
}

/* --- TITLES ALWAYS WHITE IN DARK MODE --- */
body.dark-theme .text-gradient,
body.dark-theme .page-header h1,
body.dark-theme .page-header h2,
body.dark-theme .card-header,
body.dark-theme h1,
body.dark-theme h2,
body.dark-theme h3,
body.dark-theme h4,
body.dark-theme h5,
body.dark-theme h6 {
    color: #fff !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.12);
}

/* --- SIDEBAR SHOP NAME ALWAYS BLUE --- */
.sidebar h4, .sidebar .shop-name {
    color: #007bff !important;
}

/* --- REMOVE UNNECESSARY BORDERS/SHADOWS ON TOP --- */
body.dark-theme .sidebar {
    border-right: 1px solid #23272f;
    background: #181c22;
}
.sidebar {
    box-shadow: none;
    background: #181c22;
}

/* --- GENERAL FONT SIZE REDUCTION --- */
body, .container, .container-fluid, .card, .dashboard-card, .modal-content, .form-control, .form-select, .btn, .table, .sidebar, .navbar {
    font-size: 0.97rem;
}

/* --- ENSURE ALL TEXT IS READABLE IN DARK MODE --- */
body.dark-theme, body.dark-theme .form-label, body.dark-theme .form-text, body.dark-theme .label, body.dark-theme .sidebar .nav-link {
    color: #f8f9fa !important;
}
body.dark-theme .form-label, body.dark-theme .form-text {
    color: #b0b8c1 !important;
}

/* --- REMOVE DOUBLE BARS --- */
body.dark-theme .navbar, .navbar {
    border-top: none;
    border-bottom: 1px solid #23272f;
    box-shadow: none;
}

/* --- SHOP NAME IN NAVBAR ALWAYS BLUE --- */
.navbar-brand, .crm-mobile-title {
    color: #007bff !important;
}

/* --- DASHBOARD CARDS DARK MODE FIX --- */
body.dark-theme .dashboard-card {
    background: #23272f !important;
    color: #fff !important;
    border: 1px solid #23272f;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
body.dark-theme .dashboard-card .icon,
body.dark-theme .dashboard-card .number,
body.dark-theme .dashboard-card .label,
body.dark-theme .dashboard-card h3,
body.dark-theme .dashboard-card h5,
body.dark-theme .dashboard-card p,
body.dark-theme .dashboard-card a {
    color: #fff !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.12);
}
body.dark-theme .dashboard-card .label {
    color: #b0b8c1 !important;
}
body.dark-theme .dashboard-card .btn,
body.dark-theme .dashboard-card .btn-outline-primary {
    color: #fff !important;
    border-color: #007bff;
}
body.dark-theme .dashboard-card .btn-outline-primary:hover {
    background: #007bff;
    color: #fff !important;
}

/* === ENHANCED DARK MODE TEXT READABILITY === */

/* Override any conflicting white text rules with better contrast colors */
body.dark-theme .form-label, 
body.dark-theme .form-text, 
body.dark-theme .label, 
body.dark-theme .sidebar .nav-link {
    color: #dee2e6 !important; /* Light gray instead of pure white */
}

body.dark-theme .form-label, 
body.dark-theme .form-text {
    color: #adb5bd !important; /* Muted gray for labels */
}

/* Ensure all headings use proper contrast */
body.dark-theme h1,
body.dark-theme h2,
body.dark-theme h3,
body.dark-theme h4,
body.dark-theme h5,
body.dark-theme h6 {
    color: #f8f9fa !important; /* Off-white for better readability */
}

/* Dashboard cards with better text contrast */
body.dark-theme .dashboard-card {
    background: #2d3238 !important; /* Slightly lighter background */
    color: #e9ecef !important; /* Light gray text */
    border: 1px solid #495057 !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

body.dark-theme .dashboard-card .icon,
body.dark-theme .dashboard-card .number,
body.dark-theme .dashboard-card h3,
body.dark-theme .dashboard-card h5,
body.dark-theme .dashboard-card p,
body.dark-theme .dashboard-card a {
    color: #e9ecef !important; /* Light gray instead of pure white */
    text-shadow: none !important; /* Remove text shadows */
}

body.dark-theme .dashboard-card .label {
    color: #adb5bd !important; /* Muted gray for labels */
}

/* Table headers with proper contrast */
body.dark-theme .table thead th {
    background: linear-gradient(135deg, #007bff, #0056b3) !important;
    color: #ffffff !important; /* Keep white for blue background */
}

/* Form controls with better contrast */
body.dark-theme .form-control,
body.dark-theme .form-select {
    background: #2d3238 !important; /* Slightly lighter background */
    color: #e9ecef !important; /* Light gray text */
    border-color: #495057 !important;
}

body.dark-theme .form-control:focus,
body.dark-theme .form-select:focus {
    background: #2d3238 !important;
    color: #f8f9fa !important; /* Brighter text on focus */
    border-color: #007bff !important;
}

/* Card backgrounds and text */
body.dark-theme .page-header,
body.dark-theme .card,
body.dark-theme .modal-content {
    background: #2d3238 !important; /* Slightly lighter than before */
    color: #e9ecef !important; /* Light gray text */
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

body.dark-theme .card-header,
body.dark-theme .page-header {
    background: #343a40 !important; /* Darker header */
    color: #f8f9fa !important; /* Off-white for headers */
}

/* Button text with proper contrast */
body.dark-theme .btn,
body.dark-theme .btn-primary,
body.dark-theme .btn-outline-primary {
    color: #ffffff !important; /* Keep white for buttons */
}

/* Alert text */
body.dark-theme .alert {
    color: #e9ecef !important; /* Light gray for alert text */
}

/* Card footer */
body.dark-theme .card-footer,
body.dark-theme .modal-footer {
    background: #343a40 !important; /* Darker footer */
    color: #e9ecef !important; /* Light gray text */
}

/* Table hover with better contrast */
body.dark-theme .table tbody tr:hover {
    background: #343a40 !important; /* Slightly lighter hover */
}

/* Remove any problematic text shadows */
body.dark-theme * {
    text-shadow: none !important;
}

/* Ensure all text elements have proper contrast */
body.dark-theme p,
body.dark-theme span,
body.dark-theme div:not(.card):not(.modal-content):not(.dropdown-menu) {
    color: #e9ecef !important;
}

/* Links with better visibility */
body.dark-theme a {
    color: #6ea8fe !important; /* Light blue for links */
}

body.dark-theme a:hover {
    color: #9ec5fe !important; /* Lighter blue on hover */
}

/* Muted text with proper hierarchy */
body.dark-theme .text-muted {
    color: #adb5bd !important; /* Light gray for muted text */
}

/* Table header text color: dark in light mode, white in dark mode (force at end for specificity) */
.table thead th {
    color: #222 !important;
}
body.dark-theme .table thead th {
    color: #fff !important;
}

/* Mobile header bar background fix */
.crm-mobile-header {
    background: #f8f9fa !important;
    border-bottom: 1px solid #e9ecef !important;
}
body.dark-theme .crm-mobile-header {
    background: #181c22 !important;
    border-bottom: 1px solid #23272f !important;
}

/* Table body text color: dark in light mode, white in dark mode (force at end for specificity) */
.table tbody td {
    color: #222 !important;
}
body.dark-theme .table tbody td {
    color: #fff !important;
}

/* Force all table body text to black in light mode for maximum contrast */
body:not(.dark-theme) .table tbody td {
    color: #111 !important;
} 

/* Mobile Header Styles */
.crm-mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 15px !important;
}

.crm-mobile-header .theme-toggle,
.crm-mobile-header .dropdown-toggle {
    padding: 4px 8px;
    font-size: 0.9rem;
    color: #adb5bd;
    border-color: #23272f;
}

.crm-mobile-header .theme-toggle:hover,
.crm-mobile-header .dropdown-toggle:hover {
    color: #fff;
    border-color: #495057;
    background-color: #23272f;
}

.crm-mobile-header .dropdown-menu {
    background: #181c22;
    border-color: #23272f;
    margin-top: 8px;
}

.crm-mobile-header .dropdown-item {
    color: #adb5bd;
}

.crm-mobile-header .dropdown-item:hover {
    color: #fff;
    background-color: #23272f;
}

.crm-mobile-header .dropdown-divider {
    border-color: #23272f;
} 

/* Assigned Tickets Header */
.card-header {
    background-color: #0d6efd;
    padding: 1rem;
}

.card-header h5,
.card-header h5 i,
.card-header .mb-0 {
    color: #ffffff !important;
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

/* Table styles */
.dashboard-ticket-list-table {
    margin: 0;
}

.dashboard-ticket-list-table .table {
    margin-bottom: 0;
}

.dashboard-ticket-list-table .table th,
.dashboard-ticket-list-table .table td {
    padding: 1rem;
    border-right: 1px solid #dee2e6;
    vertical-align: middle;
}

.dashboard-ticket-list-table .table th {
    background-color: #0d6efd;
    color: #ffffff !important;
    font-weight: 600;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.dashboard-ticket-list-table .table th:last-child,
.dashboard-ticket-list-table .table td:last-child {
    border-right: none;
}

.dashboard-ticket-list-table .table td {
    border-bottom: 1px solid #dee2e6;
}

.dashboard-ticket-list-table .table tr:last-child td {
    border-bottom: none;
}

/* Ticket ID styling */
.ticket-id-link {
    color: #0d6efd;
    text-decoration: none;
    font-weight: 500;
}

.ticket-id-link:hover {
    text-decoration: underline;
    color: #0b5ed7;
} 

/* Card header styles */
.card-header.bg-primary {
    background-color: #0d6efd !important;
    padding: 1rem;
}

.card-header.bg-primary h5.mb-0,
.card-header.bg-primary h5.mb-0 i {
    color: #ffffff !important;
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

/* Table styles */
.table-responsive.dashboard-ticket-list-table {
    border: 1px solid #000000;
    border-radius: 4px;
    overflow: hidden;
}

.table-responsive.dashboard-ticket-list-table .table {
    margin-bottom: 0;
    border-collapse: collapse;
    width: 100%;
}

/* Remove outer border */
.table-responsive.dashboard-ticket-list-table {
    border: none;
}

/* Column dividers */
.table-responsive.dashboard-ticket-list-table .table td,
.table-responsive.dashboard-ticket-list-table .table th {
    border-right: 1px solid #000;
    padding: 1rem;
    vertical-align: middle;
}

/* Headers */
.table-responsive.dashboard-ticket-list-table .table th {
    color: #000000 !important;
    background-color: #f8f9fa !important;
    font-weight: 600;
}

/* Remove right border from last column */
.table-responsive.dashboard-ticket-list-table .table td:last-child,
.table-responsive.dashboard-ticket-list-table .table th:last-child {
    border-right: none;
}

/* Column widths */
.table-responsive.dashboard-ticket-list-table .table th:nth-child(1),
.table-responsive.dashboard-ticket-list-table .table td:nth-child(1) {
    width: 8%;
}

.table-responsive.dashboard-ticket-list-table .table th:nth-child(2),
.table-responsive.dashboard-ticket-list-table .table td:nth-child(2) {
    width: 20%;
}

.table-responsive.dashboard-ticket-list-table .table th:nth-child(3),
.table-responsive.dashboard-ticket-list-table .table td:nth-child(3) {
    width: 30%;
}

.table-responsive.dashboard-ticket-list-table .table th:nth-child(4),
.table-responsive.dashboard-ticket-list-table .table td:nth-child(4) {
    width: 15%;
}

.table-responsive.dashboard-ticket-list-table .table th:nth-child(5),
.table-responsive.dashboard-ticket-list-table .table td:nth-child(5) {
    width: 12%;
}

.table-responsive.dashboard-ticket-list-table .table th:nth-child(6),
.table-responsive.dashboard-ticket-list-table .table td:nth-child(6) {
    width: 15%;
}

/* Header styling */
.table-responsive.dashboard-ticket-list-table .table thead th {
    color: #000000 !important;
    background-color: #f8f9fa !important;
    border-bottom: 2px solid #000000;
    padding: 1rem;
    font-weight: 600;
    vertical-align: middle;
}

/* Cell styling */
.table-responsive.dashboard-ticket-list-table .table tbody td {
    padding: 1rem;
    vertical-align: middle;
    border-bottom: 1px solid #dee2e6;
}

/* Last row styling */
.table-responsive.dashboard-ticket-list-table .table tbody tr:last-child td {
    border-bottom: none;
}

/* Ticket ID link styling */
.ticket-id-link {
    color: #0d6efd;
    text-decoration: none;
    font-weight: 500;
}

.ticket-id-link:hover {
    text-decoration: underline;
    color: #0b5ed7;
}

/* Status badge styling */
.badge.rounded-pill {
    padding: 0.5em 0.8em;
    font-weight: 500;
}

.badge.rounded-pill.bg-success-light {
    background-color: #d1e7dd !important;
    color: #0f5132 !important;
}

/* View button styling */
.btn-sm.btn-primary {
    padding: 0.4rem 0.8rem;
    font-size: 0.875rem;
} 