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

:root {
    /* Mantenemos los tonos serios del Colegio de Abogados */
    --primary-color: #1e3a5f; /* Azul Marino */
    --primary-hover: #152b47;
    --primary-light: #e0e7ff;
    --secondary-color: #c5a059; /* Dorado */
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --sidebar-width: 280px;

    /* Para mantener compatibilidad con Bootstrap utilities si hiciera falta */
    --bs-primary: #1e3a5f;
    --bs-secondary: #c5a059;
}

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

/* --- Scrollbar personalizado --- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* --- Layout Principal --- */
.wrapper {
    display: flex;
    width: 100%;
    height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-card);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    border-right: 1px solid #e2e8f0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid #f1f5f9;
}

.sidebar-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-link {
    color: var(--text-muted);
    padding: 0.52rem 1.1rem;
    border-radius: 0.65rem;
    margin: 0.15rem 0.85rem;
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
    text-decoration: none;
    cursor: pointer;
}

.nav-link i {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.nav-link:hover, .nav-link.active {
    color: var(--primary-color);
    background-color: var(--primary-light);
}

/* --- Main Content --- */
.main-content {
    margin-left: var(--sidebar-width);
    flex-grow: 1;
    min-height: 100vh;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

/* --- Top Navbar --- */
.top-navbar {
    background-color: var(--bg-card);
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 999;
}

.search-bar {
    background-color: #f1f5f9;
    border: none;
    border-radius: 2rem;
    padding: 0.6rem 1.5rem 0.6rem 2.5rem;
    width: 300px;
    transition: width 0.3s;
}

.search-bar:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--primary-light);
    width: 350px;
}

.search-wrapper { position: relative; }
.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.user-profile img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-light);
}

/* --- Cards & Dashboard Elements --- */
.content-body {
    padding: 2rem;
    flex-grow: 1;
}

.stat-card {
    background: var(--bg-card);
    border-radius: 1.25rem;
    padding: 1.5rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
    height: 100%;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.icon-box {
    width: 48px;
    height: 48px;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

/* Utilidades de colores para iconos */
.bg-indigo-light { background-color: #e0e7ff; color: #4f46e5; }
.bg-emerald-light { background-color: #d1fae5; color: #10b981; }
.bg-rose-light { background-color: #ffe4e6; color: #f43f5e; }
.bg-amber-light { background-color: #fef3c7; color: #f59e0b; }

.chart-container {
    background: var(--bg-card);
    border-radius: 1.25rem;
    padding: 1.5rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

/* --- Botones de Acción Mágicos --- */
.btn-action {
    width: 36px;
    height: 36px;
    border-radius: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    transition: all 0.2s;
    background: #f1f5f9;
    color: var(--text-muted);
}
.btn-action:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.05);
}
.btn-action.delete:hover { background: #f43f5e; }

/* --- Badges modernos --- */
.badge-soft-success { background-color: #d1fae5; color: #065f46; border-radius: 2rem; padding: 0.35em 0.8em; }
.badge-soft-warning { background-color: #fef3c7; color: #92400e; border-radius: 2rem; padding: 0.35em 0.8em; }
.badge-soft-danger { background-color: #ffe4e6; color: #9f1239; border-radius: 2rem; padding: 0.35em 0.8em; }

/* --- Formularios Premium --- */
.form-control {
    border: 1px solid #e2e8f0;
    padding: 0.7rem 1rem;
    border-radius: 0.6rem;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}
.form-control:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 0.25rem rgba(197, 160, 89, 0.15); /* Shadow dorada al enfocar */
}
.form-label {
    margin-bottom: 0.4rem;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* --- Animaciones --- */
.fade-in-up {
    animation: fadeInUp 0.6s ease-out forwards;
    opacity: 0;
    transform: translateY(20px);
}
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }

@keyframes fadeInUp {
    to { opacity: 1; transform: translateY(0); }
}

/* --- Sidebar Toggle (siempre visible) --- */
.sidebar-toggle {
    display: block;
    font-size: 1.35rem;
    cursor: pointer;
    color: var(--text-main);
    padding: 4px 6px;
    border-radius: 8px;
    transition: background 0.2s;
    line-height: 1;
}
.sidebar-toggle:hover {
    background: var(--primary-light);
    color: var(--primary-color);
}

/* --- Sidebar colapsado (desktop) --- */
.sidebar.collapsed {
    transform: translateX(-100%);
}
.main-content.expanded {
    margin-left: 0;
}

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0,0,0,0.1);
    }
    .main-content {
        margin-left: 0;
    }
    .search-wrapper { display: none; }
    .top-navbar { padding: 0 1rem; }
    .content-body { padding: 1rem; }
}

/* Sobrescribir Primary de Bootstrap para alinearlo al tema si es necesario */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}
.btn-primary:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
}
.text-primary {
    color: var(--primary-color) !important;
}

/* Loader global */
#global-loader {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(255,255,255,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(5px);
    transition: opacity 0.3s ease;
}
#global-loader.d-none {
    display: none !important;
}

/* --- Photo Edit Overlay --- */
.group-photo-edit {
    position: relative;
    overflow: hidden;
    border-radius: 0.75rem;
}
.group-photo-edit::after {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.3);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}
.group-photo-edit:hover::after {
    opacity: 1;
}
.photo-edit-overlay {
    position: absolute;
    bottom: 8px;
    right: 8px;
    z-index: 10;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}
.group-photo-edit:hover .photo-edit-overlay {
    opacity: 1;
    transform: translateY(0);
}
.group-photo-edit img {
    transition: transform 0.3s;
}
.group-photo-edit:hover img {
    transform: scale(1.05);
}

/* ── SweetAlert2 — estilo formal ICAL ───────────────────────────────────── */
.swal-ical-popup {
    font-family: 'Inter', sans-serif !important;
    border-radius: 10px !important;
    box-shadow: 0 8px 32px rgba(15,23,42,.18) !important;
}
.swal-ical-title {
    font-size: 1rem !important;
    font-weight: 700 !important;
    color: #0f172a !important;
    padding-bottom: .25rem !important;
}
.swal-ical-html {
    font-size: .85rem !important;
    color: #475569 !important;
    margin-top: .25rem !important;
}
.swal-ical-icon {
    width: 48px !important;
    height: 48px !important;
    margin: .5rem auto .75rem !important;
    border-width: 2px !important;
}
.swal-ical-icon .swal2-icon-content {
    font-size: 1.5rem !important;
}
.swal-ical-actions {
    margin-top: 1.1rem !important;
    gap: .5rem !important;
}
}
