:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --secondary-color: #475569;
    --bg-color: #f1f5f9;
    --sidebar-bg: #ffffff;
    --sidebar-color: #64748b;
    --sidebar-hover: #4f46e5;
    --card-bg: rgba(255, 255, 255, 0.85);
    --text-color: #0f172a;
    --border-color: #e2e8f0;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --font-family: 'Inter', sans-serif;
    --glass-border: rgba(255, 255, 255, 0.5);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-family);
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--sidebar-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1001;
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.05);
    left: 0;
    top: 0;
}

.sidebar .brand {
    padding: 20px;
    font-size: 22px;
    font-weight: 700;
    color: var(--text-color);
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    letter-spacing: 0.5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar .brand img {
    max-height: 40px;
    max-width: 100%;
    object-fit: contain;
}

.sidebar-close {
    display: none;
    cursor: pointer;
    font-size: 20px;
    color: var(--secondary-color);
}

.sidebar .nav-links {
    list-style: none;
    padding: 20px 0;
    flex: 1;
    overflow-y: auto;
}

.sidebar .nav-links li a {
    display: flex;
    align-items: center;
    padding: 14px 24px;
    color: var(--sidebar-color);
    text-decoration: none;
    font-size: 15px;
    transition: all 0.2s ease;
    border-left: 4px solid transparent;
}

.sidebar .nav-links li a:hover, .sidebar .nav-links li a.active {
    background-color: #f8fafc;
    color: var(--primary-color);
    border-left-color: var(--primary-color);
}

.sidebar .nav-links li a i {
    margin-right: 15px;
    font-size: 18px;
    width: 20px;
    text-align: center;
}

.sidebar .user-info {
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar .user-info span {
    font-size: 14px;
    color: var(--text-color);
    font-weight: 500;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.topbar {
    height: 70px;
    background-color: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    box-shadow: var(--shadow-sm);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.sidebar-toggle {
    display: flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    color: var(--text-color);
    margin-right: 15px;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    transition: all 0.2s;
}

.sidebar-toggle:hover {
    background-color: rgba(0,0,0,0.05);
    color: var(--primary-color);
}

.topbar-left {
    display: flex;
    align-items: center;
}

.topbar .page-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-color);
}

.content-body {
    padding: 30px;
    flex: 1;
}

/* Glassmorphism Cards */
.card {
    background-color: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    padding: 24px;
    margin-bottom: 24px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover {
    box-shadow: var(--shadow-lg);
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}
.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}
.table th, .table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}
.table th {
    background-color: rgba(248, 250, 252, 0.5);
    font-weight: 600;
    color: var(--secondary-color);
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
}
.table tr {
    transition: background-color 0.2s ease;
}
.table tr:hover td {
    background-color: rgba(241, 245, 249, 0.5);
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
    box-shadow: var(--shadow-sm);
}

.btn-primary {
    background-color: var(--primary-color);
    color: #fff;
}
.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-danger {
    background-color: var(--danger-color);
    color: #fff;
}
.btn-danger:hover {
    background-color: #dc2626;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 6px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}
.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 14px;
    color: var(--secondary-color);
}
.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: all 0.3s;
    background-color: #fff;
}
.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Grid Layout */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}
.grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 24px;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
    white-space: nowrap;
}
.badge-success { background: rgba(16, 185, 129, 0.1); color: var(--success-color); }
.badge-warning { background: rgba(245, 158, 11, 0.1); color: var(--warning-color); }
.badge-danger { background: rgba(239, 68, 68, 0.1); color: var(--danger-color); }
.badge-info { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }

/* Dashboard Cards */
.dash-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 30px;
}
.dash-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    padding: 24px;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.3s ease;
}
.dash-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}
.dash-card-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}
.dash-card-info {
    flex: 1;
    min-width: 0;
}
.dash-card-info h3 {
    font-size: 24px;
    margin-top: 5px;
    font-weight: 700;
    color: var(--text-color);
    word-wrap: break-word;
    word-break: break-all;
    line-height: 1.2;
}
.dash-card-info p {
    color: var(--secondary-color);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* DataTables Overrides */
.dataTables_wrapper .dataTables_filter input {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
    outline: none;
    transition: all 0.3s;
}
.dataTables_wrapper .dataTables_filter input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current, 
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: var(--primary-color) !important;
    color: white !important;
    border: none !important;
    border-radius: 6px !important;
}

/* Sidebar Toggle Classes */
body.sidebar-collapsed .sidebar {
    transform: translateX(-100%) !important;
}

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

/* Mobile & Tablet Responsiveness */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    body.sidebar-active .sidebar {
        transform: translateX(0) !important;
    }

    .main-content {
        margin-left: 0 !important;
    }
    
    .sidebar-close {
        display: block;
    }
    
    .grid-2, .grid-3 {
        grid-template-columns: 1fr;
    }
    
    .content-body {
        padding: 15px;
    }
    
    .topbar {
        padding: 10px 15px;
        min-height: 70px;
        height: auto;
        flex-wrap: wrap;
        gap: 10px;
    }
}

@media (max-width: 768px) {
    /* DataTables Mobile Fixes */
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter {
        text-align: left !important;
        float: none !important;
        margin-bottom: 15px;
    }
    .dataTables_wrapper .dataTables_filter input {
        margin-left: 0;
        display: block;
        width: 100%;
        margin-top: 8px;
        box-sizing: border-box;
    }
    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate {
        text-align: left !important;
        float: none !important;
        margin-top: 15px;
        display: block;
    }
    
    /* Ensure action buttons in tables don't wrap terribly */
    .table td .btn {
        margin-bottom: 5px;
    }
}

/* Custom Sliding Switch for Discount Toggle */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 22px;
}

.switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  -webkit-transition: .3s;
  transition: .3s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  -webkit-transition: .3s;
  transition: .3s;
}

input:checked + .slider {
  background-color: var(--primary-color);
}

input:focus + .slider {
  box-shadow: 0 0 1px var(--primary-color);
}

input:checked + .slider:before {
  -webkit-transform: translateX(22px);
  -ms-transform: translateX(22px);
  transform: translateX(22px);
}

/* Rounded sliders */
.slider.round {
  border-radius: 22px;
}

.slider.round:before {
  border-radius: 50%;
}

