@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #115E59;      /* IMSS-like dark green */
    --primary-light: #14B8A6; /* Vibrant green */
    --secondary: #0F172A;
    --background: #F1F5F9;
    --surface: rgba(255, 255, 255, 0.7);
    --surface-border: rgba(255, 255, 255, 0.5);
    --text-main: #1E293B;
    --text-muted: #64748B;
    --success: #10B981;
    --danger: #EF4444;
    --warning: #F59E0B;
    
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    
    --shadow-glass: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--background);
    background-image: radial-gradient(at 0% 0%, hsla(160, 100%, 74%, 0.15) 0px, transparent 50%),
                      radial-gradient(at 100% 0%, hsla(189, 100%, 56%, 0.15) 0px, transparent 50%),
                      radial-gradient(at 100% 100%, hsla(208, 100%, 50%, 0.15) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
}

/* Glassmorphism Classes */
.glass-panel {
    background: var(--surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-glass);
}

.glass-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    transition: var(--transition);
}

.glass-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Layout updated to Top Navbar (Bootstrap 5) */
.main-content {
    /* Container-fluid classes used in blade handle padding/margins now */
}

/* Typography */
h1, h2, h3, h4 { color: var(--secondary); font-weight: 600; }
h1 { font-size: 2rem; margin-bottom: 1.5rem; }
h2 { font-size: 1.5rem; margin-bottom: 1rem; }

p { color: var(--text-muted); line-height: 1.6; }

/* Navigation */
.nav-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

.nav-brand img {
    height: 40px;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.nav-item:hover, .nav-item.active {
    background: rgba(20, 184, 166, 0.1);
    color: var(--primary);
}

/* Components */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.875rem;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    outline: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(20, 184, 166, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 8px -1px rgba(20, 184, 166, 0.4);
}

.btn-secondary {
    background: white;
    color: var(--text-main);
    border: 1px solid var(--surface-border);
}

.btn-secondary:hover {
    background: #F8FAFC;
    transform: translateY(-1px);
}

/* Forms & Inputs */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(0,0,0,0.1);
    background: rgba(255,255,255,0.9);
    font-size: 0.875rem;
    color: var(--text-main);
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.1);
}

/* Tables */
.table-container {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--radius-md);
}

.table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.table th {
    background: rgba(0,0,0,0.02);
    padding: 1rem;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-muted);
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.table td {
    padding: 1rem;
    font-size: 0.875rem;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background: rgba(255,255,255,0.5);
}

/* Status Badges */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.badge-warning { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.badge-danger { background: rgba(239, 68, 68, 0.1); color: var(--danger); }

/* Header Utilities */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

/* Grid System */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; }

/* Utilities */
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mt-4 { margin-top: 1.5rem; }
.text-right { text-align: right; }
.flex { display: flex; }
.gap-2 { gap: 0.5rem; }
.items-center { align-items: center; }

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    font-weight: 500;
}
.alert-success { background: rgba(16, 185, 129, 0.1); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.2); }
.alert-danger { background: rgba(239, 68, 68, 0.1); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.2); }

/* Topbar & Responsiveness Updates */
.topbar {
    display: flex;
    align-items: center;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.user-profile {
    display: flex;
    align-items: center;
    background: var(--surface);
    padding: 0.5rem 1rem;
    border-radius: 99px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    border: 1px solid var(--surface-border);
}

.menu-toggle {
    display: none;
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 1.25rem;
    cursor: pointer;
}

.mobile-only { display: none !important; }

@media (max-width: 992px) {
    .grid-4, .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .page-header { flex-direction: column; align-items: flex-start; gap: 1rem; }
}

@media (max-width: 768px) {
    .menu-toggle { display: block; }
    .desktop-only { display: none !important; }
    .mobile-only { display: flex !important; }
    
    .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
    
    .user-profile { background: transparent; border: none; box-shadow: none; padding: 0; }
    .user-profile > div:first-child { display: none; } /* Hide names on mobile to save space */
}

/* Pagination Styles */
.pagination {
    display: flex;
    list-style: none;
    gap: 0.25rem;
    padding: 0;
    margin: 1rem 0;
    flex-wrap: wrap;
    align-items: center;
}
.page-item { margin: 0; }
.page-item.disabled .page-link, .page-item.disabled span.page-link {
    color: var(--text-muted);
    background-color: rgba(255, 255, 255, 0.5);
    cursor: not-allowed;
}
.page-item.active .page-link, .page-item.active span.page-link {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}
.page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 0.5rem;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: var(--primary);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
}
.page-link:hover:not(.disabled) {
    background: var(--primary-light);
    color: white;
    border-color: var(--primary-light);
}

/* Bootstrap Utilities for Pagination */
.d-flex { display: flex; }
.justify-content-between { justify-content: space-between; }
.justify-items-center { justify-content: center; }
.align-items-center { align-items: center; }
.flex-fill { flex: 1; }
.small { font-size: 0.875rem; }
.text-muted { color: var(--text-muted); }
.fw-semibold { font-weight: 600; }
.d-none { display: none; }
@media (min-width: 576px) {
    .d-sm-flex { display: flex !important; }
    .d-sm-none { display: none !important; }
    .flex-sm-fill { flex: 1 !important; }
    .justify-content-sm-between { justify-content: space-between !important; }
    .align-items-sm-center { align-items: center !important; }
}
/* Re-added Layout for Vertical Sidebar Accordion */
.sidebar {
    width: 280px;
    height: 100vh;
    position: fixed;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    z-index: 100;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-right: 1px solid var(--surface-border);
    box-shadow: 4px 0 15px rgba(0,0,0,0.03);
}

.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 2rem;
    min-height: 100vh;
}

/* Accordion Nav Styles */
.nav-accordion-btn {
    background: transparent !important;
    color: var(--text-muted) !important;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 1rem;
    border: none;
    box-shadow: none !important;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-accordion-btn:not(.collapsed) {
    color: var(--primary) !important;
}

.nav-accordion-btn i { width: 20px; text-align: center; }

.nav-accordion-btn::after {
    filter: none;
    opacity: 0.5;
}

.nav-accordion-btn:not(.collapsed)::after {
    filter: invert(24%) sepia(82%) saturate(583%) hue-rotate(129deg) brightness(89%) contrast(90%); /* matches var(--primary) #115E59 */
    opacity: 1;
}

.nav-sublinks {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nav-sublinks a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem 0.75rem 3.5rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    transition: var(--transition);
    border-radius: var(--radius-sm);
}

.nav-sublinks a:hover, .nav-sublinks a.active {
    color: var(--primary);
    background: rgba(17, 94, 89, 0.08); /* light primary */
    font-weight: 600;
}

.nav-item-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.nav-item-link:hover, .nav-item-link.active {
    color: var(--primary);
    background: rgba(17, 94, 89, 0.08);
}
.nav-item-link i { width: 20px; text-align: center; }

/* Desktop overrides */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    .sidebar.active {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
        padding: 1rem;
    }
}

/* Custom Webkit Scrollbars (Modern & Thin) */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(17, 94, 89, 0.2); /* Matches primary color lightly */
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(17, 94, 89, 0.4);
}

/* Specifically hide or thin out the sidebar scrollbar */
.sidebar::-webkit-scrollbar {
    width: 4px;
}
.sidebar::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
}
.sidebar:hover::-webkit-scrollbar-thumb {
    background: rgba(17, 94, 89, 0.3);
}
