/* ========================================
   KAR Dashboard - Modern UI/UX Styles
   ======================================== */

/* Root Variables */
:root {
    --primary-color: #D32F2F;
    --secondary-color: #6C757D;
    --success-color: #1cc88a;
    --info-color: #36b9cc;
    --warning-color: #f6c23e;
    --danger-color: #e74a3b;
    --light-color: #f8f9fc;
    --dark-color: #1a1a1a;
    --sidebar-width: 250px;
    --sidebar-collapsed-width: 80px;
    --topbar-height: 60px;
}

/* Global Dashboard Styles */
body.dashboard {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fc;
    overflow-x: hidden;
}

/* Sidebar Styles */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #1a1a1a 0%, #000000 100%);
    z-index: 1000;
    transition: all 0.3s ease;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

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

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.8);
    padding: 1rem 1.5rem;
    margin: 0.25rem 0.5rem;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    font-size: 0.95rem;
}

.sidebar .nav-link i {
    margin-right: 0.75rem;
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.sidebar .nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    transform: translateX(5px);
}

.sidebar .nav-link.active {
    background: rgba(211, 47, 47, 0.9);
    color: #fff;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

/* Main Content Area */
main.col-md-9 {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    padding: 2rem;
    transition: all 0.3s ease;
}

/* Page Header */
.page-header {
    background: linear-gradient(135deg, #D32F2F 0%, #1a1a1a 100%);
    color: white;
    padding: 2rem;
    border-radius: 1rem;
    margin-bottom: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.page-header h1 {
    font-weight: 600;
    margin: 0;
}

/* Modern Cards */
.card {
    border: none;
    border-radius: 1rem;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 2rem 0 rgba(58, 59, 69, 0.25);
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 1.25rem 1.5rem;
    font-weight: 600;
}

.card-body {
    padding: 1.5rem;
}

/* Statistics Cards */
.border-left-primary {
    border-left: 0.35rem solid var(--primary-color) !important;
}

.border-left-success {
    border-left: 0.35rem solid var(--success-color) !important;
}

.border-left-info {
    border-left: 0.35rem solid var(--info-color) !important;
}

.border-left-warning {
    border-left: 0.35rem solid var(--warning-color) !important;
}

.border-left-danger {
    border-left: 0.35rem solid var(--danger-color) !important;
}

/* Tables */
.table {
    color: #5a5c69;
}

.table thead {
    background-color: #f8f9fc;
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table-hover tbody tr:hover {
    background-color: rgba(211, 47, 47, 0.05);
    cursor: pointer;
}

.table td {
    vertical-align: middle;
    padding: 1rem;
}

/* Buttons */
.btn {
    border-radius: 0.5rem;
    padding: 0.5rem 1.25rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-primary {
    background: linear-gradient(135deg, #D32F2F 0%, #B71C1C 100%);
}

.btn-success {
    background: linear-gradient(135deg, #1cc88a 0%, #17a673 100%);
}

.btn-warning {
    background: linear-gradient(135deg, #f6c23e 0%, #dda20a 100%);
}

.btn-danger {
    background: linear-gradient(135deg, #e74a3b 0%, #be2617 100%);
}

.btn-info {
    background: linear-gradient(135deg, #36b9cc 0%, #258391 100%);
}

/* Badges */
.badge {
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    font-weight: 500;
    font-size: 0.75rem;
}

/* Alerts */
.alert {
    border: none;
    border-radius: 0.75rem;
    padding: 1rem 1.5rem;
    box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.1);
}

.alert i {
    margin-right: 0.5rem;
}

/* Form Controls */
.form-control,
.form-select {
    border-radius: 0.5rem;
    border: 1px solid #d1d3e2;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(211, 47, 47, 0.25);
}

.form-label {
    font-weight: 600;
    color: #5a5c69;
    margin-bottom: 0.5rem;
}

/* Breadcrumb */
.breadcrumb {
    background-color: transparent;
    padding: 0;
    margin-bottom: 1rem;
}

.breadcrumb-item+.breadcrumb-item::before {
    content: "›";
    font-size: 1.2rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state i {
    font-size: 4rem;
    color: #d1d3e2;
    margin-bottom: 1rem;
}

.empty-state p {
    color: #858796;
    font-size: 1.1rem;
}

/* Loading Spinner */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* When mobile menu is open, spinner must be below menu */
body.mmenu-open .spinner-overlay {
    z-index: 1 !important;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease;
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        width: var(--sidebar-width);
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    /* When mobile menu is open, sidebar overlay must be below menu */
    body.mmenu-open .sidebar-overlay {
        z-index: 1 !important;
    }

    .sidebar-overlay.show {
        display: block;
        opacity: 1;
    }

    main.col-md-9 {
        margin-left: 0;
        width: 100%;
        padding: 1rem;
        /* Adjust padding for mobile */
    }

    .page-header h1 {
        font-size: 1.5rem;
    }

    .card {
        margin-bottom: 1rem;
    }
}

/* Utility Classes */
.text-xs {
    font-size: 0.7rem;
}

.text-sm {
    font-size: 0.875rem;
}

.font-weight-bold {
    font-weight: 700;
}

.shadow-sm {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
}

.shadow {
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15) !important;
}

.shadow-lg {
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175) !important;
}

/* Border Utilities */
.border-bottom {
    border-bottom: 1px solid #e3e6f0 !important;
}

/* Spacing Utilities */
.mb-4 {
    margin-bottom: 1.5rem !important;
}

.mt-4 {
    margin-top: 1.5rem !important;
}

.py-2 {
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
}

.py-3 {
    padding-top: 1rem !important;
    padding-bottom: 1rem !important;
}

/* Print Styles */
@media print {

    .sidebar,
    .btn-toolbar,
    .alert {
        display: none !important;
    }

    main.col-md-9 {
        margin-left: 0;
        width: 100%;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}