: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;
    --bg-color: #f8f9fc;
    --card-bg: #ffffff;
    --text-color: #5a5c69;
    --sidebar-width: 250px;
    --sidebar-bg: #4e73df;
    --sidebar-text: #ffffff;
    --transition-speed: 0.3s;
}

[data-bs-theme="dark"] {
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --text-color: #e0e0e0;
    --sidebar-bg: #2c2c2c;
    --sidebar-text: #e0e0e0;
    --light-color: #2c2c2c;
    --dark-color: #f8f9fc;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Nunito', sans-serif;
    transition: background-color var(--transition-speed), color var(--transition-speed);
    overflow-x: hidden;
}

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

#sidebar {
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    transition: all var(--transition-speed);
    min-height: 100vh;
}

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

#sidebar .sidebar-header {
    padding: 20px;
    background: rgba(0, 0, 0, 0.1);
}

#sidebar ul.components {
    padding: 20px 0;
}

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

#sidebar ul li a {
    padding: 15px 20px;
    font-size: 1.1em;
    display: block;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: 0.2s;
}

#sidebar ul li a:hover {
    background: rgba(255, 255, 255, 0.1);
}

#sidebar ul li.active > a {
    background: rgba(255, 255, 255, 0.2);
}

#content {
    width: 100%;
    padding: 20px;
    min-height: 100vh;
    transition: all var(--transition-speed);
    animation: fadeIn 0.5s ease-out;
}

/* Cards */
.card {
    background-color: var(--card-bg);
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
    margin-bottom: 1.5rem;
}

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

.card-header {
    background-color: rgba(0, 0, 0, 0.03);
    border-bottom: 1px solid rgba(0, 0, 0, 0.125);
    font-weight: bold;
    color: var(--primary-color);
}

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

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

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

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

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

.text-gray-300 {
    color: #dddfeb !important;
}

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

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

/* Toggle Switch */
.theme-switch-wrapper {
    display: flex;
    align-items: center;
}

.theme-switch {
    display: inline-block;
    height: 34px;
    position: relative;
    width: 60px;
}

.theme-switch input {
    display: none;
}

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

.slider:before {
    background-color: #fff;
    bottom: 4px;
    content: "";
    height: 26px;
    left: 4px;
    position: absolute;
    transition: .4s;
    width: 26px;
}

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

input:checked + .slider:before {
    transform: translateX(26px);
}

.slider.round {
    border-radius: 34px;
}

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

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

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

/* Typography Polish */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    color: #e0e0e0;
}

/* Search Results */
#searchResults {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    max-height: 400px;
    overflow-y: auto;
    background-color: var(--card-bg);
    border: 1px solid rgba(0,0,0,.125);
    border-radius: 0.25rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    display: none;
}

#searchResults .list-group-item {
    background-color: var(--card-bg);
    color: var(--text-color);
    border-color: rgba(0,0,0,.125);
    cursor: pointer;
    transition: background-color 0.2s;
}

#searchResults .list-group-item:hover {
    background-color: rgba(0,0,0,.05);
}

[data-bs-theme="dark"] #searchResults .list-group-item:hover {
    background-color: rgba(255,255,255,.05);
}

/* Button Polish */
.btn {
    transition: all 0.2s;
    font-weight: 600;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* Table Polish */
.table {
    color: var(--text-color);
}

.table-bordered {
    border-color: rgba(0,0,0,.1);
}

[data-bs-theme="dark"] .table-bordered {
    border-color: rgba(255,255,255,.1);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    #sidebar {
        margin-left: calc(var(--sidebar-width) * -1);
    }
    #sidebar.active {
        margin-left: 0;
    }
    .wrapper {
        flex-direction: row;
    }
    #content {
        padding: 10px;
        min-height: auto;
    }
    .card-body {
        overflow-x: auto;
    }
    .card-body .table {
        min-width: 600px;
        font-size: 0.85rem;
    }
    .card-body .table th,
    .card-body .table td {
        white-space: nowrap;
    }
}

.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-color);
}

.auth-card {
    max-width: 420px;
    width: 100%;
}

.auth-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

.auth-title {
    font-weight: 800;
    letter-spacing: 0.05em;
}

.auth-subtitle {
    color: var(--secondary-color);
    font-size: 0.9rem;
}
