/* 
 * custom.css — Overrides y estilos adicionales para el panel de administración
 * Paleta principal Berry: --primary: #5e35b1 
 */

:root {
    --primary: #5e35b1;
    --primary-light: #ede7f6;
    --primary-dark: #4527a0;
    --secondary: #ede7f6;
    --sidebar-bg: #111936;
    --sidebar-color: #bdc8f0;
    --sidebar-active-bg: #1a223f;
    --sidebar-active-color: #ffffff;
}

body {
    background-color: #f4f6f8;
    font-family: 'Roboto', sans-serif;
}

/* --- Loader Overlay --- */
#loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    z-index: 1050; /* Por encima de todo, incluyendo modales y sidebars */
    display: none;
    justify-content: center;
    align-items: center;
}

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

/* --- Sidebar --- */
.sidebar {
    background-color: var(--sidebar-bg);
    color: var(--sidebar-color);
    min-height: 100vh;
    width: 240px;
    flex-shrink: 0; /* Evita que el sidebar se comprima en flex */
    transition: all 0.3s;
    position: sticky;
    top: 0;
    align-self: flex-start;
    height: 100vh;
    overflow-y: auto;
}

.sidebar a {
    color: var(--sidebar-color);
    text-decoration: none;
}

.sidebar .nav-link {
    padding: 0.65rem 1rem;
    display: flex;
    align-items: center;
    border-radius: 8px;
    margin: 0.15rem 0.75rem;
    transition: all 0.2s;
    font-size: 0.875rem;
}

.sidebar .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.sidebar .nav-link.active {
    background-color: var(--primary);
    color: #fff;
}

.sidebar .nav-link i {
    font-size: 1.2rem;
    margin-right: 10px;
}

.sidebar-header {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* --- Topbar --- */
.topbar {
    background-color: #fff;
    box-shadow: 0 1px 15px rgba(0,0,0,.04);
    height: 64px;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 0 0 10px 10px;
}

/* main-content: NO usar margin-left ya que el sidebar
   ocupa su espacio naturalmente dentro del d-flex */
.main-content {
    padding: 1.25rem 1.5rem;
    transition: all 0.3s;
    min-width: 0; /* Previene overflow en contenido flex */
    overflow-x: hidden;
}

/* Responsive Sidebar */
@media (max-width: 991.98px) {
    .sidebar {
        position: fixed;
        left: -240px;
        top: 0;
        height: 100vh;
        z-index: 1040;
    }
    .sidebar.show {
        left: 0;
        box-shadow: 4px 0 20px rgba(0,0,0,0.25);
    }
    .main-content {
        padding: 1rem;
        width: 100%;
    }
}

/* Layout raíz del admin */
.admin-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* --- Cards --- */
.card {
    border: none;
    box-shadow: 0 1px 20px 0 rgba(69,90,100,.08);
    border-radius: 12px;
    margin-bottom: 1.25rem;
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid #f1f1f1;
    padding: 1rem 1.25rem;
    border-radius: 12px 12px 0 0 !important;
}

.card-body {
    padding: 1.25rem;
}

/* --- Tablas --- */
.table > :not(caption) > * > * {
    padding: 1rem;
}
.table-hover tbody tr:hover {
    background-color: #f9f9f9;
}

/* --- Empty State --- */
.empty-state {
    padding: 3rem 1rem;
}
.empty-state-icon {
    font-size: 3rem;
    color: #c4c4c4;
}

/* --- Buttons --- */
.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
}
.btn-primary:hover, .btn-primary:focus {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}
.btn-light-primary {
    background-color: var(--primary-light);
    color: var(--primary);
    border: none;
}
.btn-light-primary:hover {
    background-color: var(--primary);
    color: #fff;
}

/* --- Badges --- */
.badge-light-success { background-color: #e6f4ea; color: #1e8e3e; }
.badge-light-warning { background-color: #fef7e0; color: #f29900; }
.badge-light-danger { background-color: #fce8e6; color: #d93025; }
.badge-light-primary { background-color: var(--primary-light); color: var(--primary); }

/* --- Utils --- */
.cursor-pointer { cursor: pointer; }
.text-primary { color: var(--primary) !important; }

/* Image Thumbnails in Tables */
.img-thumbnail-table {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
}
