@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-main: #0b0f19;
    --bg-card: rgba(17, 24, 39, 0.7);
    --bg-sidebar: #0f1322;
    --border-color: rgba(255, 255, 255, 0.08);
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --accent-blue: #3b82f6;
    --accent-cyan: #06b6d4;
    --accent-purple: #8b5cf6;
    --accent-gradient: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
    --accent-gradient-purple: linear-gradient(135deg, #b176ff 0%, #8b5cf6 100%);
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    background-image: 
        radial-gradient(at 10% 20%, rgba(139, 92, 246, 0.1) 0px, transparent 50%),
        radial-gradient(at 90% 80%, rgba(6, 182, 212, 0.1) 0px, transparent 50%);
    background-attachment: fixed;
}

/* Glassmorphism Styles */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.glass-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.45);
}

/* Sidebar Styling */
.sidebar {
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    min-height: 100vh;
    width: 260px;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    transition: all 0.3s ease;
}
.sidebar-brand {
    padding: 24px;
    font-weight: 800;
    font-size: 22px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    border-bottom: 1px solid var(--border-color);
}
.sidebar-menu {
    padding: 20px 10px;
    list-style: none;
    margin: 0;
    height: calc(100vh - 100px);
    overflow-y: auto;
}
.sidebar-menu::-webkit-scrollbar {
    width: 4px;
}
.sidebar-menu::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
.sidebar-item a {
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    margin-bottom: 4px;
}
.sidebar-item a i {
    width: 24px;
    font-size: 18px;
    margin-right: 12px;
    transition: transform 0.2s ease;
}
.sidebar-item a:hover, .sidebar-item.active a {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}
.sidebar-item.active a {
    border-left: 4px solid #06b6d4;
    background: rgba(6, 182, 212, 0.1);
}
.sidebar-item a:hover i {
    transform: scale(1.15);
}

.sidebar-category {
    font-size: 11px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.3);
    font-weight: 700;
    padding: 15px 16px 5px 16px;
    letter-spacing: 1px;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: color 0.2s ease;
}
.sidebar-category:hover {
    color: #06b6d4;
}
.sidebar-category .toggle-icon {
    transition: transform 0.2s ease;
    font-size: 10px;
}
.sidebar-category.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

/* Main Content area */
.main-wrapper {
    margin-left: 260px;
    padding: 25px;
    min-height: 100vh;
    transition: all 0.3s ease;
}

/* Top Navbar context area */
.top-nav {
    background: rgba(15, 19, 34, 0.85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 25px;
    margin-bottom: 30px;
    border-radius: 16px;
}

/* Context selector styling */
.context-select {
    background-color: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    border-radius: 8px !important;
    font-weight: 500;
    padding: 6px 12px;
}
.context-select option {
    background-color: var(--bg-sidebar);
    color: var(--text-primary);
}

/* Table Enhancements */
.custom-table {
    border-collapse: separate;
    border-spacing: 0 8px;
    color: #1e293b;
}
.custom-table thead th {
    background-color: transparent;
    border: none;
    color: #475569; /* Darker slate for header labels */
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 15px;
}
.custom-table tbody tr {
    background-color: rgba(255, 255, 255, 0.02);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease, background-color 0.2s ease;
}
.custom-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.05);
    transform: scale(1.005);
}
.custom-table tbody td {
    padding: 15px;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    color: #1e293b !important; /* Force dark slate color for standard table cell text */
}
.custom-table tbody td .text-white,
.custom-table tbody td.text-white {
    color: #1e293b !important; /* Force dark slate color for text-white spans */
}
.custom-table tbody td .text-secondary,
.custom-table tbody td.text-secondary {
    color: #475569 !important; /* Darker slate for small sub-texts */
}
.custom-table tbody td .text-cyan,
.custom-table tbody td .text-info,
.custom-table tbody td strong.text-cyan {
    color: #0284c7 !important; /* Dark sky blue for SKU links/references */
}
.custom-table tbody td .text-warning {
    color: #b45309 !important; /* Dark amber for MRP details */
}
.custom-table tbody td .text-success {
    color: #15803d !important; /* Dark green for Net/Grand Totals */
}
.custom-table tbody td .text-danger {
    color: #b91c1c !important; /* Dark red for discounts */
}
.custom-table tbody td:first-child {
    border-left: 1px solid var(--border-color);
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
}
.custom-table tbody td:last-child {
    border-right: 1px solid var(--border-color);
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
}

/* Beautiful Inputs */
.form-control, .form-select {
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 10px;
    padding: 10px 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-control:focus, .form-select:focus {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.2);
}
.form-label {
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 6px;
    font-size: 14px;
}

/* Buttons Gradient */
.btn-primary-gradient {
    background: var(--accent-gradient);
    border: none;
    color: #fff;
    font-weight: 600;
    border-radius: 10px;
    padding: 10px 20px;
    transition: opacity 0.2s;
}
.btn-primary-gradient:hover {
    opacity: 0.9;
    color: #fff;
}
.btn-purple-gradient {
    background: var(--accent-gradient-purple);
    border: none;
    color: #fff;
    font-weight: 600;
    border-radius: 10px;
    padding: 10px 20px;
    transition: opacity 0.2s;
}
.btn-purple-gradient:hover {
    opacity: 0.9;
    color: #fff;
}

.btn-secondary-custom {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 10px;
}
.btn-secondary-custom:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* Widgets */
.metric-card {
    padding: 24px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.metric-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}
.icon-cyan {
    background: rgba(6, 182, 212, 0.1);
    color: var(--accent-cyan);
}
.icon-purple {
    background: rgba(139, 92, 246, 0.1);
    color: var(--accent-purple);
}
.icon-blue {
    background: rgba(59, 128, 246, 0.1);
    color: var(--accent-blue);
}

/* Calendar styling for Beat schedule */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}
.calendar-day-header {
    text-align: center;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 10px 0;
    font-size: 13px;
    text-transform: uppercase;
}
.calendar-day-cell {
    min-height: 110px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: background 0.2s;
}
.calendar-day-cell:hover {
    background: rgba(255, 255, 255, 0.04);
}
.calendar-day-num {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-secondary);
}
.calendar-day-today {
    border-color: var(--accent-cyan);
    background: rgba(6, 182, 212, 0.05);
}
.calendar-day-today .calendar-day-num {
    color: var(--accent-cyan);
}
.calendar-event {
    background: rgba(6, 182, 212, 0.15);
    border-left: 3px solid var(--accent-cyan);
    font-size: 11px;
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.calendar-event-rep {
    background: rgba(139, 92, 246, 0.15);
    border-left: 3px solid var(--accent-purple);
}

/* Responsive elements */
.menu-toggle {
    display: none;
    font-size: 24px;
    color: var(--text-primary);
    cursor: pointer;
}

@media (max-width: 991px) {
    .sidebar {
        left: -260px;
    }
    .sidebar.active {
        left: 0;
    }
    .main-wrapper {
        margin-left: 0;
    }
    .menu-toggle {
        display: block;
    }
}

/* Quick responsive fixes */
.billing-table-container {
    overflow-x: auto;
}
.billing-table {
    min-width: 1000px;
}
.modal-content {
    background-color: #0f1322 !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    border-radius: 16px !important;
}
.modal-header {
    border-bottom: 1px solid var(--border-color) !important;
}
.modal-footer {
    border-top: 1px solid var(--border-color) !important;
}
.page-item.active .page-link {
    background: var(--accent-gradient) !important;
    border-color: transparent !important;
}
.page-link {
    background-color: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
}
.page-link:hover {
    background-color: rgba(255, 255, 255, 0.06) !important;
}
.badge-active {
    background-color: rgba(16, 185, 129, 0.15) !important;
    color: #10b981 !important;
}
.badge-inactive {
    background-color: rgba(239, 68, 68, 0.15) !important;
    color: #ef4444 !important;
}
.badge-info-custom {
    background-color: rgba(59, 130, 246, 0.15) !important;
    color: #3b82f6 !important;
}
.form-check-input {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
}
.form-check-input:checked {
    background-color: var(--accent-cyan);
    border-color: var(--accent-cyan);
}
.round-off-box {
    border-top: 2px dashed var(--border-color);
    padding-top: 15px;
    margin-top: 15px;
}

/* Ensure all inputs and selectors have solid light background and dark text for legibility */
.form-control, .form-select,
.form-control[readonly],
.form-control:focus, .form-select:focus {
    background-color: #ffffff !important;
    color: #0f172a !important;
}

/* Maintain dark switcher style in top nav header with white background and dark text */
.context-select, .context-select option {
    background-color: #ffffff !important;
    color: #0f172a !important;
    border: 1px solid #cbd5e1 !important;
}

/* Override utility text classes on inputs/selects to ensure they stay dark */
input.text-white, 
.form-control.text-white,
input.text-secondary,
.form-control.text-secondary {
    color: #0f172a !important;
}

/* Custom highlight for Grand Total input (remain green/success but dark green for contrast) */
input#grandTotal {
    color: #15803d !important;
    font-weight: 700 !important;
}

/* Ensure secondary text in dark glassmorphism containers and list elements is high contrast and legible */
.glass-card .text-secondary,
.list-group-item .text-secondary,
.billing-table-container .text-secondary {
    color: #94a3b8 !important; /* Brighter cool gray for optimal readability */
}

/* Override Bootstrap bg-secondary to use a premium dark slate color instead of default flat gray */
.bg-secondary {
    background-color: rgba(30, 41, 59, 0.85) !important;
}
