:root {
    --primary-color: #4e73df;
    --secondary-color: #858796;
    --success-color: #1cc88a;
    --info-color: #36b9cc;
    --warning-color: #f6c23e;
    --danger-color: #e74a3b;
    --light-color: #f8f9fc;
    --dark-color: #5a5c69;
    --sidebar-width: 250px;
    --header-height: 60px;
}

/* Wrapper */
.wrapper {
    display: flex;
    width: 100%;
    align-items: stretch;
}

/* Sidebar */
#sidebar {
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    background: var(--primary-color);
    color: #fff;
    transition: all 0.3s;
    min-height: 100vh;
}

#sidebar.active {
    margin-left: calc(-1 * var(--sidebar-width));
}

#sidebar .sidebar-header {
    padding: 20px;
    background: #4668c5;
}

#sidebar ul.components {
    padding: 20px 0;
    border-bottom: 1px solid #6482db;
}

#sidebar ul p {
    color: #fff;
    padding: 10px;
}

#sidebar ul li a {
    padding: 10px 20px;
    font-size: 1.1em;
    display: block;
    color: #fff;
    text-decoration: none;
    transition: all 0.3s;
}

#sidebar ul li a.dropdown-toggle {
    position: relative;
}

#sidebar ul li a.dropdown-toggle::after {
    content: "\F282";
    font-family: "bootstrap-icons";
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    transition: transform 0.3s;
}

#sidebar ul li a.dropdown-toggle.active::after {
    transform: translateY(-50%) rotate(90deg);
}

#sidebar ul.collapse {
    display: none;
}

#sidebar ul.collapse.show {
    display: block;
}

/* Hover effects */
#sidebar ul li a:hover {
    background: #6482db;
    padding-left: 25px;
}

/* Focus state for better accessibility */
#sidebar ul li a:focus {
    background: #6482db;
    outline: none;
}

#sidebar ul li.active > a {
    background: #6482db;
}

#sidebar ul ul a {
    font-size: 0.9em !important;
    padding-left: 40px !important;
    background: #4668c5;
}

/* Content */
#content {
    width: 100%;
    min-height: 100vh;
    transition: all 0.3s;
    background-color: var(--light-color);
}

/* Navbar */
.navbar {
    padding: 15px 10px;
    background: #fff !important;
    border: none;
    border-radius: 0;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
}

#sidebarCollapse {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

/* Cards */
.card {
    border: none;
    border-radius: 0.35rem;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
}

.card-header {
    background-color: #f8f9fc;
    border-bottom: 1px solid #e3e6f0;
}

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

/* Dashboard Stats Cards */
.stat-card {
    border-left: 4px solid;
    margin-bottom: 1.5rem;
}

.stat-card.primary {
    border-left-color: var(--primary-color);
}

.stat-card.success {
    border-left-color: var(--success-color);
}

.stat-card.info {
    border-left-color: var(--info-color);
}

.stat-card.warning {
    border-left-color: var(--warning-color);
}

.stat-card.danger {
    border-left-color: var(--danger-color);
}

.stat-card .stat-icon {
    font-size: 2rem;
    opacity: 0.3;
}

/* Tables */
.table {
    background-color: #fff;
}

.table thead th {
    border-top: none;
    background-color: #f8f9fc;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.table th {
    background-color: #f8f9fc;
    border-top: none;
}

/* Forms */
.form-control:focus {
    border-color: #bac8f3;
    box-shadow: 0 0 0 0.2rem rgba(78, 115, 223, 0.25);
}

.form-control {
    border-radius: 0.35rem;
}

label.required:after {
    content: " *";
    color: red;
}

/* Buttons */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: #2e59d9;
    border-color: #2653d4;
}

.btn {
    border-radius: 0.35rem;
}

.btn-icon-split {
    display: inline-flex;
    align-items: center;
}

.btn-icon-split .icon {
    padding: .375rem .75rem;
    background: rgba(0,0,0,.15);
}

/* Responsive */
@media (max-width: 768px) {
    #sidebar {
        margin-left: calc(-1 * var(--sidebar-width));
    }
    #sidebar.active {
        margin-left: 0;
    }
    #content {
        width: 100%;
    }
}

/* Utilities */
.shadow-sm {
    box-shadow: 0 0.125rem 0.25rem 0 rgba(58, 59, 69, 0.2) !important;
}

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

.text-primary {
    color: var(--primary-color) !important;
}

.nav-item .dropdown-toggle::after {
    display: none;
}

.nav-item .nav-link {
    position: relative;
    padding: 0.5rem 1rem;
    cursor: pointer;
}

#notification-count {
    position: absolute;
    top: 0;
    right: 0;
    transform: translate(25%, -25%) !important;
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
}

.dropdown-menu {
    position: absolute;
    z-index: 1000;
    display: none;
    min-width: 10rem;
    padding: 0.5rem 0;
    margin: 0;
    font-size: 1rem;
    color: #212529;
    text-align: left;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 0.25rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.175);
}

.dropdown-menu.show {
    display: block;
}

#notification-list {
    max-height: 300px;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.dropdown-item {
    display: block;
    width: 100%;
    padding: 0.5rem 1rem;
    clear: both;
    font-weight: 400;
    color: #212529;
    text-align: inherit;
    text-decoration: none;
    white-space: nowrap;
    background-color: transparent;
    border: 0;
}

.dropdown-item:hover,
.dropdown-item:focus {
    color: #1e2125;
    background-color: #f8f9fa;
    text-decoration: none;
}

/* Fix for profile and notification dropdowns */
.nav-item.dropdown .dropdown-menu {
    right: 0;
    left: auto;
}

/* Ensure dropdowns are clickable on mobile */
@media (max-width: 991.98px) {
    .navbar-nav .dropdown-menu {
        position: static;
        float: none;
    }
}

/* Profile dropdown specific styles */
.nav-item.dropdown .dropdown-menu {
    min-width: 200px;
}

/* Navbar Dropdowns */
.nav-item.dropdown {
    position: relative;
}

.nav-item .dropdown-menu {
    position: absolute;
    right: 0;
    left: auto;
    min-width: 200px;
    margin-top: 0.125rem;
}

.nav-item .dropdown-toggle {
    cursor: pointer;
}

.dropdown-menu.dropdown-menu-right {
    right: 0;
    left: auto;
}

/* Fix for profile and notification dropdowns on mobile */
@media (max-width: 991.98px) {
    .navbar-nav .dropdown-menu {
        position: absolute;
        float: none;
        background-color: #fff;
        border: 1px solid rgba(0,0,0,.15);
        border-radius: 0.25rem;
    }
    
    .nav-item .dropdown-menu {
        box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.175);
    }
}

/* Profile Dropdown Styles */
.nav-item .dropdown-menu {
    min-width: 240px;
    padding: 0.5rem 0;
}

.nav-item .dropdown-header {
    background-color: #f8f9fa;
    padding: 0.5rem 1rem;
    font-weight: 600;
    color: #4e73df;
}

.nav-item .dropdown-item {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.nav-item .dropdown-item i {
    width: 1rem;
    text-align: center;
}

.nav-item .dropdown-item:hover {
    background-color: #f8f9fa;
}

.nav-item .btn-link {
    text-decoration: none;
    padding: 0.5rem 0;
}

.nav-item .btn-link:hover {
    text-decoration: none;
}

/* Profile Picture in Navbar */
.nav-item .profile-picture {
    width: 32px;
    height: 32px;
    object-fit: cover;
}

/* Fix dropdown alignment on mobile */
@media (max-width: 991.98px) {
    .navbar-nav .dropdown-menu {
        position: absolute;
    }
}