/**
 * Transport Invoice Management System - Fresh Professional Design
 * Unique Professional Blue Theme
 */

/* ==================== Root Variables ==================== */
:root {
    /* Professional Blue Color Palette - Based on the image */
    --primary-color: #2a3b7a; /* Deep Navy Blue from table header */
    --primary-dark: #1a2035; /* Dark blue/grey from sidebar */
    --primary-light: #4a64b2; /* Lighter blue from active menu */
    --primary-accent: #3b82f6; /* Bright accent blue */
    
    /* Secondary Colors */
    --secondary-color: #ffffff;
    --accent-color: #4a64b2; /* Blue from active menu */
    --accent-light: #6b82c2;
    --accent-dark: #2a3b7a;
    --accent-green: #10b981; /* Emerald Green */
    --accent-red: #ef4444; /* Red */
    --accent-orange: #f59e0b; /* Amber */
    
    /* Tertiary Colors */
    --success-color: #10b981; /* Emerald Green */
    --warning-color: #f59e0b; /* Amber */
    --danger-color: #ef4444; /* Red */
    --info-color: #06b6d4; /* Cyan */
    
    /* Background Colors */
    --bg-primary: #f8f9fa; /* Light grey from main content */
    --bg-secondary: #e9ecef;
    --bg-sidebar: #1a2035; /* Dark blue/grey from sidebar */
    --bg-card: #ffffff;
    --bg-hover: #f1f5f9;
    
    /* Text Colors */
    --text-primary: #2c3e50; /* Dark grey/black from text */
    --text-secondary: #6c757d;
    --text-light: #f8fafc;
    --text-muted: #adb5bd;
    
    /* Border Colors */
    --border-color: #dee2e6;
    --border-light: #e9ecef;
    --border-dark: #ced4da;
    
    /* Spacing */
    --sidebar-width: 260px;
    --header-height: 64px;
    --footer-height: 56px;
    
    /* Transitions */
    --transition-speed: 0.3s;
    --transition-smooth: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

/* ==================== Base Styles ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    background: #f8f9fa;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color var(--transition-speed);
}

a:hover {
    color: var(--accent-color);
}

/* ==================== Login Page ==================== */
.login-page {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
    margin: 0 auto;
}

.login-box {
    background: var(--secondary-color);
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    padding: 40px 30px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h2 {
    color: var(--primary-color);
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 5px;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

.login-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
}

/* ==================== Layout Wrapper ==================== */
.wrapper {
    min-height: 100vh;
    width: 100%;
    overflow-x: hidden;
}

/* ==================== Sidebar ==================== */
.sidebar {
    width: var(--sidebar-width);
    background: #1a2035;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform var(--transition-smooth);
    z-index: 1000;
    box-shadow: var(--shadow-xl);
    transform: translateX(0);
    display: block;
}

.sidebar * {
    box-sizing: border-box;
}

.sidebar-brand-text {
    font-size: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: white !important;
}

.sidebar-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    background: #1a2035;
}

.sidebar-brand {
    color: white !important;
    text-decoration: none !important;
}

.sidebar-brand .sidebar-logo-icon {
    color: var(--accent-color) !important;
}

.sidebar-header .border-secondary {
    border-color: rgba(255, 255, 255, 0.1) !important;
}

.sidebar-menu {
    padding: 1rem 0;
}

.menu-header {
    color: rgba(255, 255, 255, 0.5) !important;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 1rem 0 0.5rem 1rem;
    padding: 0 1rem;
}

/* Fix for sidebar menu items with Bootstrap classes */
.sidebar-menu .menu-item .text-white {
    color: rgba(255, 255, 255, 0.7) !important;
}

.sidebar-menu .menu-item .text-white-50 {
    color: rgba(255, 255, 255, 0.5) !important;
}

.sidebar-menu .menu-item.active .text-white {
    color: white !important;
}

.sidebar-menu .menu-item.active .text-white-50 {
    color: rgba(255, 255, 255, 0.8) !important;
}

.sidebar-menu .menu-item a {
    transition: all var(--transition-smooth);
    border-radius: 8px;
    margin: 4px 12px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: rgba(255, 255, 255, 0.7) !important;
    text-decoration: none !important;
}

.sidebar-menu .menu-item a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--accent-color);
    transform: scaleY(0);
    transition: transform var(--transition-smooth);
}

.sidebar-menu .menu-item a:hover {
    background: rgba(59, 130, 246, 0.15);
    transform: translateX(4px);
    color: white !important;
}

.sidebar-menu .menu-item a i {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.7);
    transition: color var(--transition-smooth);
}

.sidebar-menu .menu-item a:hover i {
    color: white !important;
}

.sidebar-menu .menu-item a span {
    color: rgba(255, 255, 255, 0.8) !important;
    transition: color var(--transition-smooth);
}

.sidebar-menu .menu-item a:hover span {
    color: white !important;
}

.sidebar-menu .menu-item a:hover::before {
    transform: scaleY(1);
}

.sidebar-menu .menu-item.active a {
    background: linear-gradient(90deg, #2a3b7a 0%, #4a64b2 100%);
    box-shadow: 0 4px 12px rgba(42, 59, 122, 0.4);
    color: white !important;
}

.sidebar-menu .menu-item.active a i {
    color: white !important;
}

.sidebar-menu .menu-item.active a span {
    color: white !important;
}

.sidebar-menu .menu-item.active a::before {
    transform: scaleY(1);
}

/* Only keep minimal custom CSS, use Bootstrap utilities */
.sidebar-toggle {
    color: var(--primary-color);
    font-size: 28px;
    padding: 8px;
    border: none;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(13, 71, 161, 0.1) 100%);
    cursor: pointer;
    transition: all var(--transition-smooth);
    border-radius: 8px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none !important;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(4px);
    z-index: 999;
    transition: opacity var(--transition-smooth);
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

.sidebar-toggle:hover {
    color: var(--accent-color);
    transform: scale(1.1) rotate(5deg);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(13, 71, 161, 0.2) 100%);
    box-shadow: var(--shadow-md);
}

/* ==================== Main Content ==================== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: calc(100% - var(--sidebar-width));
    transition: margin-left var(--transition-smooth);
    background: #f8f9fa;
}

/* ==================== Top Header ==================== */
.top-header {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    height: var(--header-height);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 999;
    width: 100%;
    box-shadow: var(--shadow-sm);
    padding: 0 2rem;
}

.top-header::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-color) 0%, var(--primary-color) 50%, var(--accent-color) 100%);
    opacity: 0;
    transition: opacity var(--transition-smooth);
}

.top-header:hover::before {
    opacity: 1;
}

/* ==================== Page Content ==================== */
.page-content {
    flex: 1;
    padding: 2rem;
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==================== Main Footer ==================== */
.main-footer {
    background: #2a3b7a;
    height: var(--footer-height);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-top: auto;
}

.main-footer p {
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
}

.main-footer .text-muted {
    color: rgba(255, 255, 255, 0.7) !important;
}

.footer-content p {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ==================== Cards ==================== */
.card {
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
    width: 100%;
    background: var(--bg-card);
    transition: all var(--transition-smooth);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card-header {
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem;
    font-weight: 600;
    color: var(--primary-color);
    position: relative;
}

.card-header::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--accent-color) 0%, var(--primary-color) 100%);
}

.card-body {
    padding: 1.75rem;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

/* ==================== Dashboard Stats ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
    width: 100%;
}

/* Remove when fully migrated to Bootstrap grid */
.stats-grid.hidden {
    display: none;
}

/* Stat card body content */
.stat-card .card-body h6 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card .card-body h3 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

@media (max-width: 991.98px) {
    .stat-card .card-body h3 {
        font-size: 1.4rem !important;
    }
}

/* ==================== Stat Card ==================== */
.stat-card {
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-smooth);
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 16px;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 120px;
    height: 120px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, transparent 100%);
    border-radius: 0 16px 0 100%;
    pointer-events: none;
}

.stat-card::after {
    content: '';
    position: absolute;
    bottom: -20px;
    right: -20px;
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.05) 0%, transparent 100%);
    border-radius: 50%;
    pointer-events: none;
}

.stat-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-xl);
    border-color: var(--accent-color);
}

.stat-card .card-body {
    position: relative;
    z-index: 1;
    padding: 1.75rem;
}

.stat-card .rounded-circle {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-bottom: 1rem;
    transition: all var(--transition-smooth);
    position: relative;
    z-index: 2;
}

.stat-card:hover .rounded-circle {
    transform: scale(1.1) rotate(5deg);
}

.stat-card h6 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    z-index: 2;
}

.stat-card h3 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0;
    position: relative;
    z-index: 2;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ==================== Tables ==================== */
.table-responsive {
    border-radius: 12px;
    overflow: hidden;
    width: 100%;
    box-shadow: var(--shadow-sm);
}

.table {
    margin-bottom: 0;
    width: 100%;
    background: white;
}

.table thead th {
    background: #2a3b7a;
    border-bottom: none;
    font-weight: 600;
    color: white;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 16px;
}

.table tbody tr {
    transition: all var(--transition-smooth);
    border-bottom: 1px solid var(--border-light);
}

.table tbody tr:hover {
    background: var(--bg-hover);
    transform: scale(1.01);
}

.table td {
    vertical-align: middle;
    padding: 16px;
    border: none;
}

.table td {
    vertical-align: middle;
}

/* Ensure action buttons in table cells are properly aligned */
.table td .d-flex {
    align-items: center;
}

.table td .badge {
    display: inline-block;
}

/* ==================== Buttons ==================== */
.btn {
    border-radius: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition-smooth);
    border: none;
    box-shadow: var(--shadow-sm);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-dark) 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--accent-dark) 0%, var(--primary-color) 100%);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
    color: white;
}

.download-csv{
    background: var(--primary-color) !important;
}

.download-csv:hover {
    background: var(--accent-green) !important;
    border-color: var(--accent-green) !important;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color) 0%, #dc2626 100%);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning-color) 0%, #d97706 100%);
    color: white;
}

.btn-info {
    background: linear-gradient(135deg, var(--info-color) 0%, #0891b2 100%);
    color: white;
}

.btn-primary {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-success {
    background: var(--accent-green);
    border-color: var(--accent-green);
}

.btn-danger {
    background: var(--accent-red);
    border-color: var(--accent-red);
}

.btn-warning {
    background: var(--accent-orange);
    border-color: var(--accent-orange);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

.btn-link {
    color: var(--primary-color);
    text-decoration: none;
}

.btn-link:hover {
    color: var(--accent-color);
}

/* ==================== Forms ==================== */
.form-label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 13px;
    margin-bottom: 0.5rem;
    letter-spacing: 0.3px;
}

.form-control,
.form-select {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 14px;
    width: 100%;
    transition: all var(--transition-smooth);
    background: white;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    outline: none;
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(26, 58, 92, 0.25);
}

.form-control::placeholder {
    color: var(--text-muted);
}

/* ==================== Badges ==================== */
.badge {
    font-size: 11px;
    font-weight: 500;
    padding: 5px 10px;
    border-radius: 4px;
}

.badge-primary {
    background: var(--primary-color);
}

.badge-success {
    background: var(--accent-green);
}

.badge-warning {
    background: var(--accent-orange);
}

.badge-danger {
    background: var(--accent-red);
}

.badge-info {
    background: var(--accent-color);
}

.badge-secondary {
    background: var(--text-secondary);
}

/* ==================== Alerts ==================== */
.alert {
    border-radius: 4px;
    border: none;
    font-size: 14px;
}

.alert-success {
    background: rgba(39, 174, 96, 0.1);
    color: var(--accent-green);
}

.alert-danger {
    background: rgba(231, 76, 60, 0.1);
    color: var(--accent-red);
}

.alert-warning {
    background: rgba(243, 156, 18, 0.1);
    color: var(--accent-orange);
}

.alert-info {
    background: rgba(52, 152, 219, 0.1);
    color: var(--accent-color);
}

/* ==================== Status Colors ==================== */
.badge.status-draft {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%) !important;
    color: white !important;
    padding: 0.5rem 1rem !important;
    font-weight: 600 !important;
    border-radius: 6px !important;
    display: inline-block !important;
}

.badge.status-pending {
    background: linear-gradient(135deg, var(--warning-color) 0%, #d97706 100%) !important;
    color: white !important;
    padding: 0.5rem 1rem !important;
    font-weight: 600 !important;
    border-radius: 6px !important;
    display: inline-block !important;
}

.badge.status-sent {
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-dark) 100%) !important;
    color: white !important;
    padding: 0.5rem 1rem !important;
    font-weight: 600 !important;
    border-radius: 6px !important;
    display: inline-block !important;
}

.badge.status-partially_paid {
    background: linear-gradient(135deg, #9b59b6 0%, #7c3aed 100%) !important;
    color: white !important;
    padding: 0.5rem 1rem !important;
    font-weight: 600 !important;
    border-radius: 6px !important;
    display: inline-block !important;
}

.badge.status-paid {
    background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%) !important;
    color: white !important;
    padding: 0.5rem 1rem !important;
    font-weight: 600 !important;
    border-radius: 6px !important;
    display: inline-block !important;
}

.badge.status-overdue {
    background: linear-gradient(135deg, var(--danger-color) 0%, #dc2626 100%) !important;
    color: white !important;
    padding: 0.5rem 1rem !important;
    font-weight: 600 !important;
    border-radius: 6px !important;
    display: inline-block !important;
}

.badge.status-cancelled {
    background: linear-gradient(135deg, #34495e 0%, #1e293b 100%) !important;
    color: white !important;
    padding: 0.5rem 1rem !important;
    font-weight: 600 !important;
    border-radius: 6px !important;
    display: inline-block !important;
}

.badge.status-edit {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%) !important;
    color: white !important;
    padding: 0.5rem 1rem !important;
    font-weight: 600 !important;
    border-radius: 6px !important;
    display: inline-block !important;
}

/* ==================== Action Buttons ==================== */
.action-buttons {
    display: flex !important;
    gap: 8px !important;
    flex-wrap: wrap !important;
    width: 100% !important;
}

/* Bootstrap button overrides for action buttons */
.action-btn-view {
    background: var(--accent-color) !important;
    color: white !important;
    border: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.action-btn-view:hover {
    background: var(--accent-dark) !important;
    color: white !important;
}

.action-btn-edit {
    background: var(--warning-color) !important;
    color: white !important;
    border: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.action-btn-edit:hover {
    background: #d97706 !important;
    color: white !important;
}

.action-btn-delete {
    background: var(--danger-color) !important;
    color: white !important;
    border: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.action-btn-delete:hover {
    background: #dc2626 !important;
    color: white !important;
}

.action-btn-print {
    background: var(--primary-color) !important;
    color: white !important;
    border: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.action-btn-print:hover {
    background: var(--primary-dark) !important;
    color: white !important;
}

/* ==================== Pagination ==================== */
.pagination {
    margin-bottom: 0;
}

.page-link {
    color: var(--primary-color);
    border-color: var(--border-color);
}

.page-link:hover {
    background: var(--bg-light);
    color: var(--primary-color);
}

.page-item.active .page-link {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

/* ==================== Modal ==================== */
.modal-content {
    border-radius: 6px;
    border: none;
}

.modal-header {
    background: var(--bg-light);
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    color: var(--primary-color);
    font-weight: 600;
}

.modal-footer {
    border-top: 1px solid var(--border-color);
}

/* ==================== Responsive Design ==================== */
/* Bootstrap Breakpoints: xs (<576px), sm (≥576px), md (≥768px), lg (≥992px), xl (≥1200px), xxl (≥1400px) */

/* Large devices (desktops, less than 992px) */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%) !important;
    }

    .sidebar.active {
        transform: translateX(0) !important;
    }

    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .stat-card {
        padding: 1.5rem;
    }

    .stat-card .card-body {
        padding: 1rem;
    }
}

/* Large devices and up (desktops, 992px and up) */
@media (min-width: 992px) {
    .sidebar {
        transform: translateX(0) !important;
    }

    .main-content {
        margin-left: var(--sidebar-width) !important;
        width: calc(100% - var(--sidebar-width)) !important;
    }
}

/* Medium devices (tablets, less than 768px) */
@media (max-width: 767.98px) {
    .sidebar {
        width: 280px;
    }

    .stat-card {
        padding: 1.25rem;
    }

    .stat-card .card-body {
        padding: 1.25rem;
    }

    .stat-card .rounded-circle {
        width: 45px;
        height: 45px;
        font-size: 1.25rem;
        margin-bottom: 0.75rem;
    }

    .stat-card h3 {
        font-size: 1.5rem;
    }

    .stat-card h6 {
        font-size: 0.875rem;
    }

    .table-responsive {
        border: 1px solid var(--border-color);
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 12px;
    }

    .table-responsive::-webkit-scrollbar {
        height: 6px;
    }

    .table-responsive::-webkit-scrollbar-track {
        background: var(--bg-secondary);
        border-radius: 3px;
    }

    .table-responsive::-webkit-scrollbar-thumb {
        background: var(--accent-color);
        border-radius: 3px;
    }

    .table-responsive::-webkit-scrollbar-thumb:hover {
        background: var(--accent-dark);
    }

    .d-flex.justify-content-between {
        flex-direction: row;
        gap: 0.75rem;
    }

    .d-flex.justify-content-between .btn {
        width: auto;
    }

    .d-flex.justify-content-between #sidebarToggle{
        width: 50px !important;
    }

    .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .action-buttons {
        flex-wrap: wrap;
        justify-content: center;
    }

    .action-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }

    .card {
        margin-bottom: 1rem;
    }

    .card-header {
        padding: 1rem;
    }

    .card-body {
        padding: 1.25rem;
    }

    .invoice-grid {
        grid-template-columns: 1fr;
    }

    .lr-grid {
        grid-template-columns: 1fr;
    }

    .totals-table {
        max-width: 100%;
    }

    .invoice-totals {
        width: 100%;
        margin-left: 0;
    }

    .modal-dialog {
        margin: 0.625rem;
    }

    .modal-content {
        border-radius: 0.75rem;
    }

    .quick-actions {
        flex-direction: column;
    }

    .quick-actions .btn {
        width: 100%;
    }
}

/* Quick Reports section styling */
.card .card-body .btn-success {
    background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%) !important;
    border: none !important;
    color: white !important;
    min-height: 60px;
    transition: all var(--transition-smooth);
}

.card .card-body .btn-success:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
}


    .search-form {
        flex-direction: column;
    }

    .search-form .form-control,
    .search-form .form-select,
    .search-form .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .top-header {
        padding: 0 1rem;
    }

    .header-right {
        gap: 0.75rem;
    }


/* Small devices (landscape phones, less than 576px) */
@media (max-width: 575.98px) {
    .stat-card {
        padding: 1rem;
    }

    .stat-card .card-body {
        padding: 1rem;
    }

    .stat-card .rounded-circle {
        width: 40px;
        height: 40px;
        font-size: 1.125rem;
        margin-bottom: 0.5rem;
    }

    .stat-card h3 {
        font-size: 1.25rem;
    }

    .stat-card h6 {
        font-size: 0.75rem;
    }

    .top-header {
        height: auto;
        flex-direction: column;
        gap: 0.75rem;
        padding: 0.75rem;
    }

    .header-right {
        width: 100%;
        justify-content: space-between;
    }

    .card {
        margin-bottom: 0.75rem;
    }

    .card-header {
        padding: 0.875rem;
    }

    .card-body {
        padding: 1rem;
    }

    .invoice-status {
        font-size: 0.625rem;
        padding: 0.25rem 0.5rem;
    }

    .action-btn {
        padding: 0.375rem 0.625rem;
        font-size: 0.75rem;
    }

    .badge {
        font-size: 0.625rem;
        padding: 0.25rem 0.5rem;
    }

    .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.6875rem;
    }

    .form-control,
    .form-select {
        font-size: 0.875rem;
        padding: 0.625rem 0.75rem;
    }

    .form-label {
        font-size: 0.75rem;
    }

    .pagination {
        flex-wrap: wrap;
    }

    .page-link {
        padding: 0.375rem 0.625rem;
        font-size: 0.75rem;
    }

    .sidebar-brand-text {
        font-size: 0.875rem;
    }

    .menu-item a {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }

    .menu-item a i {
        font-size: 1rem;
    }

    .menu-header {
        padding: 0.75rem 1rem 0.25rem;
        font-size: 0.625rem;
    }

    .user-name {
        font-size: 0.75rem;
    }

    .sidebar-toggle {
        font-size: 1.25rem;
    }

    .table thead th {
        padding: 0.75rem;
        font-size: 0.6875rem;
    }

    .table td {
        padding: 0.75rem;
        font-size: 0.8125rem;
    }
}

/* Extra small devices (portrait phones, less than 480px) */
@media (max-width: 479.98px) {
    .login-box {
        padding: 1.25rem 0.75rem;
    }

    .login-header h2 {
        font-size: 1.25rem;
    }

    .stat-card {
        padding: 0.875rem;
    }

    .stat-card .card-body {
        padding: 0.875rem;
    }

    .stat-card .rounded-circle {
        width: 35px;
        height: 35px;
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }

    .stat-card h3 {
        font-size: 1.125rem;
    }

    .stat-card h6 {
        font-size: 0.6875rem;
    }

    .card-title {
        font-size: 1rem;
    }

    .h3 {
        font-size: 1.125rem;
    }

    .h1 {
        font-size: 1.5rem;
    }

    .action-buttons {
        gap: 0.25rem;
    }

    .action-btn {
        padding: 0.3125rem 0.5rem;
        font-size: 0.6875rem;
    }

    .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8125rem;
    }

    .form-control,
    .form-select {
        padding: 0.5rem 0.625rem;
        font-size: 0.8125rem;
    }

    .modal-dialog {
        margin: 0.3125rem;
    }

    .modal-body {
        padding: 0.9375rem;
    }

    .modal-header,
    .modal-footer {
        padding: 0.625rem 0.9375rem;
    }

    .table thead th {
        padding: 0.5rem;
        font-size: 0.625rem;
    }

    .table td {
        padding: 0.5rem;
        font-size: 0.75rem;
    }
}

/* Ensure 100% width for all responsive elements */
@media (max-width: 767.98px) {
    .container-fluid,
    .container {
        width: 100%;
        max-width: 100%;
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .row {
        margin-left: -0.5rem;
        margin-right: -0.5rem;
    }

    .col,
    .col-1,
    .col-2,
    .col-3,
    .col-4,
    .col-5,
    .col-6,
    .col-7,
    .col-8,
    .col-9,
    .col-10,
    .col-11,
    .col-12 {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
}

/* ==================== Invoice Preview Styles ==================== */
.invoice-preview {
    background: white;
    padding: 40px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-bottom: 20px;
}

.invoice-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--primary-color);
}

.invoice-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-color);
}

.invoice-meta {
    text-align: right;
}

.invoice-number {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.invoice-details {
    margin-bottom: 30px;
}

.invoice-details h4 {
    color: var(--primary-color);
    font-size: 14px;
    margin-bottom: 10px;
}

.invoice-table {
    margin-bottom: 30px;
}

.invoice-table th {
    background: var(--primary-color);
    color: white;
    font-weight: 500;
}

.invoice-table td {
    border-color: var(--border-color);
}

.invoice-totals {
    width: 300px;
    margin-left: auto;
}

.invoice-totals tr td:last-child {
    text-align: right;
    font-weight: 600;
}

.invoice-footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.invoice-terms {
    font-size: 12px;
    color: var(--text-secondary);
}

.invoice-signature {
    text-align: right;
    margin-top: 30px;
}

.signature-line {
    border-top: 1px solid var(--text-primary);
    padding-top: 10px;
    display: inline-block;
    min-width: 200px;
}

/* ==================== Print Styles ==================== */
@media print {
    .sidebar,
    .top-header,
    .main-footer,
    .no-print {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .page-content {
        padding: 0;
    }
    
    .invoice-preview {
        border: none;
        padding: 0;
    }
    
    body {
        background: white;
    }
}
