/* Perfect Dashboard Layout - Exactly Like Reference Image */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #64748b;
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --info: #0891b2;
    --dark: #1e293b;
    --light: #f8fafc;
    --white: #ffffff;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --sidebar-width: 250px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f5f5f5;
    color: var(--gray-800);
    line-height: 1.5;
    font-size: 14px;
}

/* Main Layout Container */
.wrapper {
    display: flex;
    min-height: 100vh;
}

/* Perfect Sidebar - Left Side */
.sidebar {
    width: var(--sidebar-width);
    background: var(--white);
    border-right: 1px solid #e5e7eb;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 1000;
    overflow-y: auto;
    box-shadow: 2px 0 4px rgba(0,0,0,0.1);
}

.sidebar-header {
    padding: 20px 16px;
    border-bottom: 1px solid #e5e7eb;
    background: var(--white);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-900);
    text-decoration: none;
}

.sidebar-brand i {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
}

.brand-text {
    color: var(--gray-900);
    font-weight: 600;
}

.sidebar-body {
    padding: 16px 0;
}

.nav-section {
    margin: 20px 0 8px;
}

.nav-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #9ca3af;
    padding: 0 16px;
    margin-bottom: 8px;
}

.sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: #6b7280;
    text-decoration: none;
    transition: all 0.2s ease;
    border-radius: 0;
    border: none;
    position: relative;
    font-size: 14px;
    font-weight: 500;
}

.sidebar .nav-link:hover {
    background-color: #f3f4f6;
    color: var(--gray-900);
}

.sidebar .nav-link.active {
    background-color: #dbeafe;
    color: var(--primary);
    border-right: 3px solid var(--primary);
}

.sidebar .nav-link i {
    font-size: 16px;
    width: 18px;
    text-align: center;
    opacity: 0.8;
}

.sidebar .nav-link.active i {
    opacity: 1;
}

.sidebar .nav-link span {
    font-weight: 500;
}

/* Main Content Area - Right Side */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    background-color: #f5f5f5;
    display: flex;
    flex-direction: column;
}

/* Top Navigation Bar */
.navbar {
    background-color: var(--white) !important;
    border-bottom: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 12px 0;
    min-height: 60px;
}

.navbar .container-fluid {
    padding: 0 24px;
    max-width: none;
}

/* Content Header */
.content-header {
    background: var(--white);
    border-bottom: 1px solid #e5e7eb;
    padding: 24px 0;
}

.content-header .container-fluid {
    padding: 0 24px;
    max-width: none;
}

.content-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 4px;
}

.content-description {
    color: #6b7280;
    margin-bottom: 0;
    font-size: 14px;
}

/* Content Body - Where Cards Go */
.content-body {
    padding: 24px;
    flex: 1;
}

.content-body .container-fluid {
    padding: 0;
    max-width: none;
}

/* Cards */
.card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 24px;
    overflow: hidden;
    transition: all 0.2s ease;
    background: var(--white);
}

.card:hover {
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

.card-header {
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    padding: 16px 20px;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body {
    padding: 20px;
}

/* Forms */
.form-label {
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 6px;
    font-size: 14px;
}

.form-control, .form-select {
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
    transition: all 0.15s ease;
    background-color: var(--white);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    outline: none;
}

.form-control::placeholder {
    color: #9ca3af;
}

.input-group-text {
    background-color: #f9fafb;
    border: 1px solid #d1d5db;
    color: #6b7280;
    padding: 8px 12px;
}

/* Buttons */
.btn {
    border-radius: 6px;
    font-weight: 500;
    padding: 8px 16px;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    font-size: 14px;
    border: 1px solid transparent;
}

.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
    color: var(--white);
    transform: translateY(-1px);
}

.btn-success {
    background-color: var(--success);
    border-color: var(--success);
    color: var(--white);
}

.btn-success:hover {
    background-color: #047857;
    border-color: #047857;
    color: var(--white);
    transform: translateY(-1px);
}

.btn-outline-primary {
    border: 1px solid var(--primary);
    color: var(--primary);
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}

.btn-outline-danger {
    border: 1px solid var(--danger);
    color: var(--danger);
    background: transparent;
}

.btn-outline-danger:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: var(--white);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-lg {
    padding: 12px 20px;
    font-size: 16px;
}

/* Tables */
.table {
    background: var(--white);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid #e5e7eb;
}

.table thead th {
    background-color: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    font-weight: 600;
    color: var(--gray-700);
    padding: 12px 16px;
    font-size: 14px;
}

.table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: middle;
    font-size: 14px;
}

.table tbody tr:hover {
    background-color: #f9fafb;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* Badges */
.badge {
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.bg-success {
    background-color: var(--success) !important;
}

.bg-primary {
    background-color: var(--primary) !important;
}

.bg-warning {
    background-color: var(--warning) !important;
}

.bg-secondary {
    background-color: var(--gray-500) !important;
}

.bg-light {
    background-color: #f9fafb !important;
    color: var(--gray-700) !important;
    border: 1px solid #e5e7eb;
}

/* Alerts */
.alert {
    border: 1px solid;
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 20px;
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
    border-color: #a7f3d0;
}

/* Breadcrumb */
.breadcrumb {
    background: none;
    padding: 0;
    margin: 0;
    font-size: 14px;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "/";
    color: #9ca3af;
    margin: 0 8px;
}

.breadcrumb-item a {
    color: var(--primary);
    text-decoration: none;
}

.breadcrumb-item.active {
    color: #6b7280;
}

/* Avatar */
.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--gray-100);
    color: var(--gray-600);
}

/* Dropdown */
.dropdown-menu {
    border: 1px solid #e5e7eb;
    box-shadow: 0 10px 15px rgba(0,0,0,0.1);
    border-radius: 6px;
    padding: 8px 0;
}

.dropdown-item {
    padding: 8px 16px;
    font-size: 14px;
    color: var(--gray-700);
}

.dropdown-item:hover {
    background-color: #f9fafb;
    color: var(--gray-900);
}

/* Grid System - Perfect Layout */
.row {
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
}

.col-lg-4, .col-lg-8, .col-md-6, .col-md-4 {
    padding-left: 12px !important;
    padding-right: 12px !important;
}

/* Responsive */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        width: 100%;
    }
    
    .content-body {
        padding: 16px;
    }
    
    .btn-close-sidebar {
        display: block;
    }
}

.btn-close-sidebar {
    background: none;
    border: none;
    color: var(--gray-500);
    font-size: 18px;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
    display: none;
}

.btn-close-sidebar:hover {
    background-color: var(--gray-100);
    color: var(--gray-700);
}

/* Login Page */
body.login-page {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-card {
    background: var(--white);
    border-radius: 8px;
    box-shadow: 0 20px 25px rgba(0,0,0,0.1);
    padding: 40px;
    width: 100%;
    max-width: 400px;
}

.login-card h1 {
    text-align: center;
    margin-bottom: 24px;
    color: var(--gray-900);
    font-weight: 600;
}

/* Scrollbar */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: #f9fafb;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Image Previews */
img {
    border-radius: 6px;
}

.img-thumbnail {
    border: 1px solid #e5e7eb;
    padding: 4px;
    background-color: var(--white);
    border-radius: 6px;
}

/* List Groups */
.list-group-item {
    border: 1px solid #e5e7eb;
    padding: 12px 16px;
    font-size: 14px;
}

.list-group-item:first-child {
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
}

.list-group-item:last-child {
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
}

.list-group-flush .list-group-item {
    border-left: 0;
    border-right: 0;
    border-radius: 0;
}

/* Form Check */
.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.form-check-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.25);
}

/* Text Colors */
.text-primary {
    color: var(--primary) !important;
}

.text-success {
    color: var(--success) !important;
}

.text-warning {
    color: var(--warning) !important;
}

.text-danger {
    color: var(--danger) !important;
}

.text-muted {
    color: #9ca3af !important;
}

/* Utilities */
.fw-bold {
    font-weight: 600 !important;
}

.fs-4 {
    font-size: 18px !important;
}

.me-2 {
    margin-right: 8px !important;
}

.ms-2 {
    margin-left: 8px !important;
}

.mb-3 {
    margin-bottom: 16px !important;
}

.mt-3 {
    margin-top: 16px !important;
}

.py-4 {
    padding-top: 24px !important;
    padding-bottom: 24px !important;
}

.py-5 {
    padding-top: 48px !important;
    padding-bottom: 48px !important;
}

.d-flex {
    display: flex !important;
}

.align-items-center {
    align-items: center !important;
}

.justify-content-between {
    justify-content: space-between !important;
}

.text-center {
    text-align: center !important;
}

.d-grid {
    display: grid !important;
}

.gap-3 {
    gap: 16px !important;
}

/* Spinner */
.spinner-border-sm {
    width: 16px;
    height: 16px;
}

/* Display utilities */
.display-1 {
    font-size: 96px;
    font-weight: 300;
    line-height: 1.2;
}

.display-4 {
    font-size: 56px;
    font-weight: 300;
    line-height: 1.2;
}

/* Button Groups */
.btn-group .btn {
    margin-right: 0;
}

.btn-group .btn:not(:last-child) {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.btn-group .btn:not(:first-child) {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    margin-left: -1px;
}

/* Mobile Toggle */
#sidebarToggle {
    color: var(--gray-600);
    border: none;
    background: none;
    padding: 8px;
    border-radius: 6px;
}

#sidebarToggle:hover {
    background-color: var(--gray-100);
}

/* Perfect spacing for content */
.container-fluid {
    width: 100% !important;
    max-width: none !important;
}

/* Ensure proper layout flow */
.content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
}