/* ============================================
    Garments Buying House - Old School Excel Design
    Pure White/Black Theme with Blue Accents
    ============================================ */

/* TailwindCSS Setup via CDN */
@tailwind base;
@tailwind components;
@tailwind utilities;

/* Base Styles - Old School Excel Look */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 13px;
    color: #333;
    background: #f5f5f5;
    overflow-x: hidden;
}

/* Remove all border-radius */
*,
*::before,
*::after {
    border-radius: 0 !important;
}

/* Sidebar - Traditional Excel Style */
.sidebar {
    width: 260px;
    background: #fff;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    border-right: 1px solid #ccc;
    z-index: 100;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: left 0.3s ease;
}

.sidebar-menu {
    padding: 0;
    background: #fff;
    overflow-y: auto;
    flex: 1;
}

.sidebar-menu::-webkit-scrollbar {
    width: 6px;
}

.sidebar-menu::-webkit-scrollbar-track {
    background: #f0f0f0;
}

.sidebar-menu::-webkit-scrollbar-thumb {
    background: #ccc;
}

.sidebar-menu::-webkit-scrollbar-thumb:hover {
    background: #999;
}

.sidebar-header {
    background: #2c5aa0;
    color: white;
    padding: 12px 15px;
    font-weight: 600;
    font-size: 14px;
    border-bottom: 1px solid #1e4a7f;
}

.sidebar-header span {
    font-size: 11px;
    font-weight: 400;
    opacity: 0.8;
}

/* Menu Styles - Excel Tree Menu */
.sidebar-menu {
    padding: 0;
    background: #fff;
}

.menu-section {
    border-bottom: 1px solid #e0e0e0;
}

.menu-section-title {
    background: #f0f0f0;
    padding: 8px 15px;
    font-size: 11px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    border-bottom: 1px solid #e0e0e0;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    color: #333;
    text-decoration: none;
    font-size: 13px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.2s;
}

.menu-item:hover {
    background: #e8f0fe;
}

.menu-item.active {
    background: #2c5aa0;
    color: white;
}

.menu-item i {
    width: 18px;
    height: 18px;
    margin-right: 10px;
}

.menu-item .badge {
    margin-left: auto;
    background: #d32f2f;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
}

/* Accordion Submenu */
.menu-item.has-submenu::after {
    content: '▶';
    margin-left: auto;
    font-size: 10px;
    transition: transform 0.2s;
}

.menu-item.has-submenu.expanded::after {
    transform: rotate(90deg);
}

.submenu {
    display: none;
    background: #fafafa;
    border-left: 3px solid #2c5aa0;
    margin-left: 20px;
}

.submenu.show {
    display: block;
}

.submenu .menu-item {
    padding: 8px 15px 8px 25px;
    font-size: 12px;
}

/* Main Content - Fluid Width */
.main-content {
    margin-left: 260px;
    min-height: 100vh;
    width: calc(100% - 260px);
    transition: margin-left 0.3s ease, width 0.3s ease;
}

/* Responsive - Sidebar Toggle - Mobile only (below 1100px) */
@media (max-width: 1100px) {
    .sidebar {
        left: -260px;
        z-index: 200;
        transition: left 0.3s ease;
    }

    .sidebar.active {
        left: 0;
    }

    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .main-content.sidebar-active {
        margin-left: 0;
        width: 100%;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 150;
    }

    .sidebar-overlay.active {
        display: block;
    }

    /* All components full width on mobile/tablet */
    .page-content,
    .card,
    .chart-card,
    .stats-grid,
    .dataTables_wrapper {
        width: 100% !important;
        max-width: 100% !important;
    }
}

/* All layout components responsive */
@media (max-width: 1100px) {
    .stats-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 12px;
    }

    .charts-row {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }

    .grid-2,
    .grid-3,
    .grid-4,
    .grid-5 {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 15px;
    }
}

/* Topbar - Excel Style */
.topbar {
    background: #fff;
    border-bottom: 1px solid #ccc;
    padding: 8px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.search-box {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid #ccc;
    padding: 5px 10px;
    width: 280px;
}

.search-box input {
    border: none;
    outline: none;
    width: 100%;
    font-size: 13px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.topbar-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 1px solid #ccc;
    background: #fff;
    color: #333;
}

.topbar-btn:hover {
    background: #e8f0fe;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px;
    border: 1px solid #ccc;
    background: #fff;
    cursor: pointer;
}

.user-avatar {
    width: 28px;
    height: 28px;
    background: #2c5aa0;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 11px;
}

.user-info .user-name {
    font-weight: 600;
    font-size: 12px;
}

.user-info .user-role {
    font-size: 10px;
    color: #666;
}

/* Page Content */
.page-content {
    padding: 20px 25px;
    max-width: 100% !important;
    width: 100%;
}

/* Page Header - Flex with justify-between */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

/* Stats Cards - Excel Table Style */
.stats-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
    width: 100%;
}

.stat-card {
    flex: 1 1 auto;
    min-width: 150px;
    background: #fff;
    border: 1px solid #ccc;
    padding: 12px;
}

.stat-card {
    flex: 1;
    background: #fff;
    border: 1px solid #ccc;
    padding: 12px;
}

.stat-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.stat-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-label {
    font-size: 11px;
    color: #666;
    font-weight: 600;
    text-transform: uppercase;
}

.stat-value {
    font-size: 22px;
    font-weight: 700;
    color: #333;
}

.stat-change {
    font-size: 10px;
    padding: 2px 6px;
}

.stat-change.positive {
    background: #c8e6c9;
    color: #2e7d32;
}

.stat-change.negative {
    background: #ffcdd2;
    color: #c62828;
}

/* Cards - Excel Style */
.card {
    background: #fff;
    border: 1px solid #ccc;
    margin-bottom: 15px;
}

.card-header {
    padding: 10px 15px;
    border-bottom: 1px solid #ccc;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.card-body {
    padding: 15px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
    border: 1px solid #ccc;
    background: #fff;
    color: #333;
    text-decoration: none;
}

.btn:hover {
    background: #e8f0fe;
}

.btn-primary {
    background: #2c5aa0;
    color: white;
    border-color: #1e4a7f;
}

.btn-primary:hover {
    background: #1e4a7f;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 11px;
}

.btn-outline {
    background: #fff;
    color: #333;
    border: 1px solid #ccc;
}

.btn-outline:hover {
    background: #f0f0f0;
}

.btn-success {
    background: #2e7d32;
    color: white;
    border-color: #1b5e20;
}

.btn-success:hover {
    background: #1b5e20;
}

.btn-warning {
    background: #e65100;
    color: white;
    border-color: #bf360c;
}

.btn-warning:hover {
    background: #bf360c;
}

/* Tables - Excel Style */
.table-container {
    overflow-x: auto;
    width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

thead {
    background: #f0f0f0;
}

th {
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border: 1px solid #ccc;
    background: #f0f0f0;
    white-space: nowrap;
    font-size: 12px;
}

td {
    padding: 12px 15px;
    border: 1px solid #ccc;
    background: #fff;
    font-size: 13px;
}

tbody tr:hover {
    background: #e8f0fe;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 500;
}

.status-badge.warning {
    background: #fff3e0;
    color: #e65100;
}

.status-badge.danger {
    background: #ffcdd2;
    color: #c62828;
}

.status-badge.info {
    background: #bbdefb;
    color: #1565c0;
}

.status-badge.active,
.status-badge.completed {
    background: #c8e6c9;
    color: #2e7d32;
}

.status-badge.pending,
.status-badge.processing {
    background: #fff3e0;
    color: #e65100;
}

.status-badge.inactive,
.status-badge.cancelled {
    background: #ffcdd2;
    color: #c62828;
}

.status-badge.delayed {
    background: #ffcdd2;
    color: #c62828;
}

.status-badge.shipped {
    background: #c8e6c9;
    color: #2e7d32;
}

.status-badge.production {
    background: #bbdefb;
    color: #1565c0;
}

.status-badge.sample {
    background: #e1bee7;
    color: #6a1b9a;
}

/* Priority Badges */
.priority-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 500;
}

.priority-badge.high {
    background: #ffcdd2;
    color: #c62828;
}

.priority-badge.medium {
    background: #fff3e0;
    color: #e65100;
}

.priority-badge.low {
    background: #c8e6c9;
    color: #2e7d32;
}

/* Warning Panel */
.warning-panel {
    background: #fff3e0;
    border: 1px solid #ffb74d;
    padding: 12px;
}

.warning-title {
    font-weight: 600;
    color: #e65100;
    margin-bottom: 8px;
}

.warning-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.warning-list li {
    padding: 4px 0;
    font-size: 12px;
}

/* Action Buttons */
.action-btns {
    display: flex;
    gap: 4px;
}

.action-btn {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 1px solid #ccc;
    background: #fff;
    color: #666;
    font-size: 12px;
}

.action-btn:hover {
    background: #e8f0fe;
    color: #2c5aa0;
}

/* ERP module workspaces */
.module-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
}

.module-search {
    min-width: 280px;
    flex: 1;
}

.module-layout {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 15px;
    align-items: start;
}

.module-side-nav {
    background: #fff;
    border: 1px solid #ccc;
    position: sticky;
    top: 72px;
}

.module-side-title {
    padding: 9px 12px;
    background: #f0f0f0;
    border-bottom: 1px solid #ccc;
    font-size: 12px;
    font-weight: 700;
}

.module-nav-item {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    border: 0;
    border-bottom: 1px solid #e0e0e0;
    background: #fff;
    color: #333;
    cursor: pointer;
    text-align: left;
    font-size: 12px;
}

.module-nav-item:hover {
    background: #e8f0fe;
}

.module-nav-item.active {
    background: #2c5aa0;
    color: #fff;
}

.module-nav-count {
    font-size: 10px;
    padding: 1px 5px;
    background: #eceff1;
    color: #333;
}

.module-nav-item.active .module-nav-count {
    background: rgba(255,255,255,0.22);
    color: #fff;
}

.module-panel {
    background: #fff;
    border: 1px solid #ccc;
    margin-bottom: 15px;
}

.module-panel-header {
    padding: 10px 12px;
    background: #f5f5f5;
    border-bottom: 1px solid #ccc;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.module-panel-title {
    font-size: 14px;
    font-weight: 700;
}

.module-panel-body {
    padding: 12px;
}

.mini-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
    gap: 8px;
}

.mini-kpi {
    border: 1px solid #d6d6d6;
    background: #fff;
    padding: 8px;
}

.mini-kpi-label {
    font-size: 10px;
    color: #666;
    text-transform: uppercase;
    font-weight: 700;
}

.mini-kpi-value {
    font-size: 16px;
    font-weight: 800;
    margin-top: 3px;
}

.warning-list {
    display: grid;
    gap: 6px;
}

.warning-item {
    border: 1px solid #ffcc80;
    background: #fff8e1;
    color: #8a4b00;
    padding: 7px 9px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.field-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 10px 12px;
}

.field-read {
    border: 1px solid #e0e0e0;
    background: #fafafa;
    padding: 8px;
    min-height: 49px;
}

.field-read label {
    display: block;
    font-size: 10px;
    color: #666;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 3px;
}

.field-read span {
    display: block;
    font-size: 12px;
    color: #222;
    font-weight: 600;
}

.matrix-table input {
    width: 72px;
    padding: 4px;
    border: 1px solid #ccc;
    font-size: 12px;
    text-align: right;
}

.module-note {
    border-left: 3px solid #2c5aa0;
    background: #f8fbff;
    padding: 8px 10px;
    font-size: 12px;
    color: #333;
}

@media (max-width: 1100px) {
    .module-layout {
        grid-template-columns: 1fr;
    }

    .module-side-nav {
        position: static;
    }
}

/* Forms */
.form-group {
    margin-bottom: 15px;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.form-input,
.form-select {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #ccc;
    font-size: 13px;
    background: #fff;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: #2c5aa0;
    box-shadow: 0 0 0 2px rgba(44, 90, 160, 0.1);
}

/* Modal - Excel Style */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #fff;
    border: 2px solid #2c5aa0;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 10px 15px;
    border-bottom: 1px solid #ccc;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 14px;
    font-weight: 600;
}

.modal-close {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    background: none;
    color: #666;
}

.modal-close:hover {
    color: #c62828;
}

.modal-body {
    padding: 15px;
}

.modal-footer {
    padding: 10px 15px;
    border-top: 1px solid #ccc;
    background: #f5f5f5;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* Charts Container */
.charts-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 15px;
    width: 100%;
}

.chart-card {
    background: #fff;
    border: 1px solid #ccc;
    padding: 15px;
    min-width: 0;
}

.chart-container {
    height: 250px;
    position: relative;
    width: 100%;
}

.chart-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
}

.chart-container {
    height: 250px;
    position: relative;
}

/* Progress Bar */
.progress-bar {
    height: 16px;
    background: #e0e0e0;
    border: 1px solid #ccc;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #2c5aa0;
}

.progress-fill.green {
    background: #2e7d32;
}

.progress-fill.orange {
    background: #e65100;
}

.progress-fill.red {
    background: #c62828;
}

/* ========================================
   DataTables - Clean Professional Excel Style
   ======================================== */

/* Main wrapper - use flexbox for proper layout */
.dataTables_wrapper {
    padding: 0 !important;
    font-size: 13px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    overflow-x: auto;
}

/* Control Panel - Top bar with all controls */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dt-buttons {
    background: #fff;
    padding: 10px 15px !important;
    border: 1px solid #ccc;
    border-bottom: none;
    margin: 0 !important;
}

/* Buttons on LEFT */
.dataTables_wrapper .dt-buttons {
    display: inline-flex !important;
    order: 1;
    flex-wrap: wrap;
    gap: 5px;
}

/* Length dropdown in MIDDLE */
.dataTables_wrapper .dataTables_length {
    display: inline-block;
    order: 2;
    vertical-align: middle;
}

div.dt-container div.dt-layout-row {
    overflow: hidden;
    overflow-x: auto;
}

/* Search on RIGHT */
.dataTables_wrapper .dataTables_filter {
    display: flex !important;
    justify-content: flex-end;
    order: 3;
    margin-left: auto !important;
    float: none !important;
}

/* Clearfix for wrapper */
.dataTables_wrapper::after {
    content: "";
    display: table;
    clear: both;
}

/* Length dropdown styling */
.dataTables_length {
    min-width: 180px;
    padding: 10px 15px !important;
}

.dataTables_length label {
    font-weight: 600;
    font-size: 12px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dataTables_length select {
    padding: 6px 12px !important;
    border: 1px solid #999 !important;
    font-size: 12px !important;
    background: #fff !important;
    min-width: 70px;
    margin-left: 8px;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Search/Filter styling */
.dataTables_filter {
    min-width: 280px;
    float: right !important;
    padding: 10px 15px !important;
}

.dataTables_filter label {
    font-weight: 600;
    font-size: 12px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
    float: right;
}

.dataTables_filter input {
    padding: 6px 12px !important;
    border: 1px solid #999 !important;
    font-size: 12px !important;
    min-width: 200px;
    background: #fff !important;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
    float: right;
    margin-left: 8px;
}

/* Buttons styling */
.dt-buttons {
    display: inline-flex !important;
    gap: 6px !important;
    flex-wrap: wrap;
}

.dt-buttons .dt-button,
.dt-buttons button,
.dt-buttons .btn {
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    padding: 6px 12px !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    border: 1px solid #999 !important;
    background: #fff !important;
    color: #333 !important;
    cursor: pointer;
    border-radius: 0 !important;
    white-space: nowrap !important;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}

.dt-buttons .dt-button:hover,
.dt-buttons button:hover,
.dt-buttons .btn:hover {
    background: #e8f0fe !important;
    border-color: #2c5aa0 !important;
    color: #2c5aa0 !important;
}

/* Button icons using Font Awesome */
.dt-button.buttons-copy::before {
    content: "\f0c5";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 12px;
}

.dt-button.buttons-csv::before {
    content: "\f15c";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 12px;
}

.dt-button.buttons-excel::before {
    content: "\f1c3";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 12px;
}

.dt-button.buttons-pdf::before {
    content: "\f1c1";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 12px;
}

.dt-button.buttons-print::before {
    content: "\f02f";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 12px;
}

/* Info text */
.dataTables_info {
    padding: 12px 15px !important;
    font-size: 12px;
    color: #555;
    background: #f9f9f9;
    border: 1px solid #ccc;
    border-top: none;
    display: block;
    margin-top: -1px;
}

/* Pagination */
.dataTables_paginate {
    padding: 12px 15px !important;
    background: #fff;
    border: 1px solid #ccc;
    border-top: none;
    display: flex !important;
    justify-content: flex-end;
    gap: 4px;
    margin-top: -1px;
}

.dataTables_paginate .paginate_button {
    padding: 5px 10px !important;
    border: 1px solid #ccc !important;
    background: #fff !important;
    color: #333 !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    cursor: pointer;
    min-width: 32px;
    text-align: center;
}

.dataTables_paginate .paginate_button:hover {
    background: #e8f0fe !important;
    border-color: #2c5aa0 !important;
    color: #2c5aa0 !important;
}

.dataTables_paginate .paginate_button.current {
    background: #2c5aa0 !important;
    border-color: #2c5aa0 !important;
    color: #fff !important;
    font-weight: 600;
}

.dataTables_paginate .paginate_button.disabled {
    color: #999 !important;
    cursor: not-allowed;
    background: #f5f5f5 !important;
}

/* Table styling */
table.dataTable {
    border-collapse: collapse !important;
    width: 100% !important;
    border: 1px solid #ccc !important;
}

table.dataTable thead th {
    background: #f0f0f0 !important;
    border: 1px solid #ccc !important;
    border-bottom: 2px solid #2c5aa0 !important;
    padding: 14px 18px !important;
    font-weight: 600;
    font-size: 12px;
    color: #333;
}

table.dataTable thead th:first-child {
    border-left: none;
}

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

table.dataTable tbody td {
    border: 1px solid #ccc !important;
    padding: 12px 18px !important;
    font-size: 13px;
}

.dataTables_wrapper .dt-buttons .btn:hover,
.dataTables_wrapper .dt-buttons button:hover,
.dataTables_wrapper .dt-buttons a:hover,
.dataTables_wrapper .dt-buttons .dt-button:hover {
    background: linear-gradient(to bottom, #e8f0fe 0%, #d0e0f0 100%) !important;
    border-color: #2c5aa0 !important;
    color: #2c5aa0 !important;
    box-shadow: 0 2px 4px rgba(44, 90, 160, 0.2);
}

/* Font Awesome Icons for buttons */
.dt-button.buttons-copy::before {
    content: "\f0c5";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    margin-right: 6px;
    color: #2c5aa0;
}

.dt-button.buttons-csv::before {
    content: "\f15c";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    margin-right: 6px;
    color: #22c55e;
}

.dt-button.buttons-excel::before {
    content: "\f1c3";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    margin-right: 6px;
    color: #22c55e;
}

.dt-button.buttons-pdf::before {
    content: "\f1c1";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    margin-right: 6px;
    color: #ef4444;
}

.dt-button.buttons-print::before {
    content: "\f02f";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    margin-right: 6px;
    color: #666;
}

/* Add text labels */
.dt-button.buttons-copy span::after {
    content: " Copy";
}

.dt-button.buttons-csv span::after {
    content: " CSV";
}

.dt-button.buttons-excel span::after {
    content: " Excel";
}

.dt-button.buttons-pdf span::after {
    content: " PDF";
}

.dt-button.buttons-print span::after {
    content: " Print";
}

/* Legacy overrides removed - using new clean styling above */

/* File Upload */

.dataTables_filter input:focus {
    outline: none;
    border-color: #2c5aa0 !important;
    box-shadow: 0 0 0 2px rgba(44, 90, 160, 0.1);
}

.dataTables_info {
    padding: 10px 0;
    font-size: 12px;
    color: #666;
}

.dataTables_paginate {
    padding: 10px 0;
    display: flex;
    gap: 5px;
}

.dataTables_paginate .paginate_button {
    padding: 4px 10px;
    border: 1px solid #ccc;
    cursor: pointer;
    font-size: 12px;
    color: #333;
    background: #fff;
}

.dataTables_paginate .paginate_button:hover {
    background: #e8f0fe;
}

.dataTables_paginate .paginate_button.current {
    background: #2c5aa0;
    color: white;
    border-color: #2c5aa0;
}

.dataTables_paginate .paginate_button.disabled {
    color: #999;
    cursor: not-allowed;
}

/* DataTables Buttons */
.dt-buttons {
    margin-bottom: 10px;
}

.dt-buttons .btn {
    margin-right: 5px;
}

table.dataTable {
    border-collapse: collapse !important;
    width: 100% !important;
}

table.dataTable th,
table.dataTable td {
    border: 1px solid #ccc !important;
    padding: 12px 15px !important;
}

table.dataTable thead th {
    background: #f0f0f0 !important;
    border-bottom: 2px solid #2c5aa0 !important;
    font-weight: 600;
    font-size: 12px;
}

table.dataTable tbody tr:hover {
    background: #e8f0fe !important;
}

table.dataTable tbody td {
    font-size: 13px;
}

/* File Upload */
.file-upload {
    border: 2px dashed #ccc;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    background: #fafafa;
}

.file-upload:hover {
    border-color: #2c5aa0;
    background: #f0f5ff;
}

/* Grid layouts */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.grid-5 {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
}

/* Responsive */
@media (max-width: 1200px) {
    .grid-5 {
        grid-template-columns: repeat(3, 1fr);
    }

    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Responsive - Sidebar Toggle - Mobile only (below 1100px) */
@media (max-width: 1100px) {
    .sidebar {
        left: -260px;
        z-index: 200;
        transition: left 0.3s ease;
    }

    .sidebar.active {
        left: 0;
    }

    .main-content {
        margin-left: 0 !important;
    }

    .main-content.sidebar-active {
        margin-left: 0;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 150;
    }

    .sidebar-overlay.active {
        display: block;
    }
}

/* Table Responsive */
@media (max-width: 768px) {
    body {
        overflow-x: hidden;
    }

    .table-container {
        overflow-x: auto;
        width: 100%;
        -webkit-overflow-scrolling: touch;
    }

    table.dataTable {
        font-size: 11px;
        min-width: 600px;
        display: block;
    }

    table.dataTable thead th,
    table.dataTable tbody td {
        padding: 8px 10px !important;
        white-space: nowrap;
    }

    .dataTables_wrapper {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .dataTables_wrapper .dt-buttons {
        display: flex !important;
        flex-wrap: wrap;
        gap: 5px;
        justify-content: center;
    }

    .dataTables_wrapper .dataTables_filter {
        width: 100%;
        text-align: center;
    }

    .dataTables_wrapper .dataTables_filter input {
        width: 100% !important;
        min-width: 150px;
    }

    .dataTables_wrapper .dataTables_length {
        width: 100%;
        text-align: center;
    }

    .dataTables_info {
        width: 100%;
        text-align: center;
    }

    .dataTables_paginate {
        justify-content: center !important;
        width: 100%;
    }

    /* Stats Grid Responsive */
    .stats-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px;
    }

    .stat-card {
        min-width: unset;
        padding: 10px;
    }

    .stat-value {
        font-size: 18px;
    }

    /* Charts Responsive */
    .charts-row {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }

    .chart-card {
        padding: 10px;
        width: 100%;
    }

    .chart-container {
        height: 200px;
        width: 100%;
    }

    /* Cards and Grid Responsive */
    .card-body {
        padding: 10px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .page-header .btn {
        width: 100%;
        justify-content: center;
    }

    .grid-2,
    .grid-3,
    .grid-4,
    .grid-5 {
        grid-template-columns: 1fr !important;
    }

    /* Topbar Responsive */
    .topbar {
        padding: 8px 15px;
        flex-wrap: wrap;
        gap: 10px;
    }

    .search-box {
        width: 100%;
        order: 3;
    }

    .topbar-actions {
        gap: 5px;
    }

    .user-menu {
        padding: 5px 8px;
    }

    .user-info {
        display: none;
    }

    /* Modal Responsive */
    .modal-content {
        width: 95% !important;
        margin: 10px;
        max-height: 85vh;
    }

    .modal-body {
        padding: 10px;
    }

    .modal-footer {
        flex-direction: column;
        gap: 8px;
    }

    .modal-footer .btn {
        width: 100%;
        justify-content: center;
    }

    /* Form Responsive */
    .form-group {
        margin-bottom: 12px;
    }

    .form-label {
        font-size: 11px;
    }

    .form-input,
    .form-select {
        padding: 8px 10px;
        font-size: 12px;
    }

    /* Page Content Padding */
    .page-content {
        padding: 10px 15px;
        width: 100% !important;
    }

    .page-title {
        font-size: 18px;
    }

    /* Breadcrumb responsive */
    .page-breadcrumb {
        font-size: 11px;
    }

    /* Action buttons in table */
    .action-btns {
        display: flex;
        gap: 3px;
    }

    .action-btn {
        width: 28px;
        height: 28px;
    }

    /* Status badge responsive */
    .status-badge {
        font-size: 10px;
        padding: 2px 6px;
    }
}

@media (max-width: 480px) {
    body {
        overflow-x: hidden;
    }

    .main-content {
        width: 100% !important;
        overflow-x: hidden;
    }

    .stats-grid {
        grid-template-columns: 1fr !important;
    }

    .chart-container {
        height: 180px;
    }

    .page-title {
        font-size: 16px;
    }

    table.dataTable {
        font-size: 10px;
        min-width: 500px;
    }

    .page-content {
        overflow-x: hidden;
    }

    .topbar {
        flex-wrap: nowrap;
        overflow-x: auto;
    }

    .topbar-actions {
        flex-wrap: nowrap;
    }

    .search-box {
        min-width: 150px;
    }
}
