:root {
    --primary-color: #2c7da0;
    --primary-dark: #1f5068;
    --secondary-color: #61a5c2;
    --success-color: #2a9d8f;
    --danger-color: #e76f51;
    --warning-color: #e9c46a;
    --info-color: #4895ef;
    --dark-bg: #1a1a2e;
    --dark-surface: #16213e;
    --light-bg: #f8f9fa;
    --light-surface: #ffffff;
    --text-dark: #212529;
    --text-light: #e9ecef;
    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', sans-serif;
    background: var(--light-bg);
    transition: background 0.3s ease;
}

/* Dark Theme */
body.dark-theme {
    --light-bg: #1a1a2e;
    --light-surface: #16213e;
    --text-dark: #e9ecef;
    background: var(--light-bg);
    color: var(--text-dark);
}

body.dark-theme .card,
body.dark-theme .modal-content,
body.dark-theme .top-bar,
body.dark-theme .sidebar {
    background: var(--light-surface);
    border-color: #2d2d44;
}

body.dark-theme .table {
    color: var(--text-light);
}

body.dark-theme .table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(255, 255, 255, 0.05);
}

body.dark-theme .form-control,
body.dark-theme .form-select {
    background: #0f0f1a;
    border-color: #2d2d44;
    color: var(--text-light);
}

body.dark-theme .form-control:focus {
    background: #0f0f1a;
    color: var(--text-light);
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(135deg, #1a472a 0%, #0d2818 100%);
    color: white;
    transition: all 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

body.dark-theme .sidebar {
    background: linear-gradient(135deg, #0d1b2a 0%, #1b263b 100%);
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar.collapsed .sidebar-header span,
.sidebar.collapsed .nav-link span,
.sidebar.collapsed .user-info span,
.sidebar.collapsed .btn-logout span,
.sidebar.collapsed .nav-divider {
    display: none;
}

.sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 12px;
}

.sidebar.collapsed .nav-link i {
    margin-right: 0;
    font-size: 1.3rem;
}

.sidebar.collapsed .sidebar-header {
    justify-content: center;
    padding: 15px;
}

.sidebar-header {
    padding: 20px;
    font-size: 1.3rem;
    font-weight: bold;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-header i {
    font-size: 1.5rem;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
}

.nav-item {
    list-style: none;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    transition: all 0.3s;
    gap: 12px;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-link i {
    width: 20px;
    text-align: center;
}

.nav-divider {
    padding: 10px 20px;
    font-size: 0.7rem;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 1px;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    font-size: 0.85rem;
}

.user-info i {
    font-size: 1.2rem;
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    margin-top: 10px;
    background: rgba(231, 111, 81, 0.2);
    color: #e76f51;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s;
}

.btn-logout:hover {
    background: rgba(231, 111, 81, 0.3);
    color: #f4a261;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    transition: margin-left 0.3s ease;
    min-height: 100vh;
}

.main-content.expanded {
    margin-left: var(--sidebar-collapsed);
}

.top-bar {
    background: white;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e0e0e0;
    position: sticky;
    top: 0;
    z-index: 999;
}

.toggle-sidebar {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: inherit;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.3s;
}

.toggle-sidebar:hover {
    background: rgba(0, 0, 0, 0.05);
}

.btn-theme-toggle {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: inherit;
    padding: 8px 12px;
    border-radius: 8px;
}

.content-wrapper {
    padding: 20px;
}

/* Cards */
.card {
    border: none;
    border-radius: 16px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s, box-shadow 0.3s;
    background: white;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    padding: 1rem 1.25rem;
    font-weight: 500;
}

.stats-card .card-body {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem;
}

.stats-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stats-card.primary .stats-icon {
    background: rgba(44, 125, 160, 0.15);
    color: var(--primary-color);
}
.stats-card.success .stats-icon {
    background: rgba(42, 157, 143, 0.15);
    color: var(--success-color);
}
.stats-card.info .stats-icon {
    background: rgba(72, 149, 239, 0.15);
    color: var(--info-color);
}
.stats-card.warning .stats-icon {
    background: rgba(233, 196, 106, 0.15);
    color: var(--warning-color);
}

.stats-info h3 {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
}
.stats-info span {
    font-size: 0.85rem;
    color: #6c757d;
}

body.dark-theme .stats-info span {
    color: #adb5bd;
}

/* Botones */
.btn-primary {
    background: var(--primary-color);
    border: none;
    padding: 8px 20px;
}
.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-sm {
    padding: 4px 12px;
    font-size: 0.75rem;
}

/* Tablas */
.table {
    margin-bottom: 0;
}
.table th {
    font-weight: 600;
    border-top: none;
}

/* Modal */
.modal-content {
    border-radius: 16px;
    border: none;
}
.modal-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}
.modal-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .main-content.expanded {
        margin-left: 0;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: #f1f1f1;
}
::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}