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

:root {
    --admin-bg: #e2e8f0; /* Fondo gris más oscuro (Slate 200) para crear contraste radical con el blanco */
    --admin-card-bg: #ffffff; /* Blanco puro para las tarjetas */
    --admin-sidebar: #ffffff; /* Blanco puro para la barra lateral */
    --admin-sidebar-text: #475569; /* Texto Menú Slate 600 */
    --admin-primary: #3b82f6; /* Azul brillante */
    --admin-primary-dark: #2563eb; 
    --admin-white: #ffffff;
    --admin-border: #94a3b8; /* Bordes notablemente más oscuros (Slate 400) para definición perfecta */
    --admin-input-bg: #f1f5f9; /* Gris sutil para inputs */
    --admin-text: #1e293b; /* Texto casi negro para máxima lectura */
    --admin-heading: #0f172a; /* Títulos Slate 900 casi negro */
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 2rem;
    --radius-sm: 8px;
    --radius-md: 16px;
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.03); /* Sombra elegante para modo claro */
    --shadow-hover: 0 10px 25px rgba(59, 130, 246, 0.15);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--admin-bg);
    color: var(--admin-text);
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Auth / Login Page */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}

.login-card {
    background: var(--admin-sidebar);
    padding: 3rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-hover);
    width: 100%;
    max-width: 420px;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.6);
}

.login-logo {
    max-height: 60px;
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

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

.form-control {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid var(--admin-border);
    background-color: var(--admin-input-bg);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: 'Outfit', sans-serif;
    color: var(--admin-text);
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--admin-primary);
    box-shadow: 0 0 0 3px rgba(0, 85, 255, 0.15);
}

.btn-admin {
    width: 100%;
    padding: 0.8rem 1.5rem;
    background: linear-gradient(135deg, var(--admin-primary), var(--admin-primary-dark));
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    font-family: 'Outfit', sans-serif;
    text-align: center;
}

.btn-admin:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(0, 85, 255, 0.2);
}

/* Dashboard Layout */
.admin-layout {
    display: flex;
    height: 100vh;
}

/* Sidebar Layout Estilo Linear */
.sidebar {
    width: 240px; 
    background-color: var(--admin-sidebar);
    color: var(--admin-sidebar-text);
    display: flex;
    flex-direction: column;
    box-shadow: 1px 0 10px rgba(0,0,0,0.01);
    border-right: 1px solid #e2e8f0; 
    z-index: 100;
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

/* Floating Toggle Button */
.sidebar-toggle {
    position: absolute;
    right: -12px;
    top: 25px;
    width: 24px;
    height: 24px;
    background: #fff;
    border: 1px solid #e2e8f0;
    color: #64748b;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.7rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    z-index: 110;
    transition: all 0.2s;
}

.sidebar-toggle:hover {
    color: var(--admin-primary);
    border-color: var(--admin-primary);
    background: #f8fafc;
}

/* Collapsed Sidebar State (Narrow) */
.sidebar.collapsed {
    width: 64px;
}

/* Premium Tooltips for Collapsed Mode */
.sidebar.collapsed [data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 70px;
    background: #1e293b;
    color: #fff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.sidebar.collapsed [data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
    left: 68px; /* Pequeño salto hacia el sidebar */
}

.sidebar.collapsed .sidebar-header h3,
.sidebar.collapsed .sidebar-header p,
.sidebar.collapsed .sidebar-header .header-text-group,
.sidebar.collapsed .sidebar-menu li a span,
.sidebar.collapsed .sidebar-menu summary span,
.sidebar.collapsed .sidebar-footer a span,
.sidebar.collapsed details.nav-group summary::after,
.sidebar.collapsed .search-mockup-container {
    display: none !important;
}

.sidebar.collapsed .sidebar-header {
    padding: 1.5rem 0;
    justify-content: center;
}

.sidebar.collapsed .sidebar-menu li a,
.sidebar.collapsed .sidebar-menu summary {
    justify-content: center;
    padding: 0.8rem 0;
}

.sidebar.collapsed .sidebar-menu li a i,
.sidebar.collapsed .sidebar-menu summary i {
    margin: 0 !important;
    width: 20px !important;
    font-size: 1.1rem;
}

.sidebar.collapsed details ul {
    display: none !important;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: none;
}

.sidebar-menu {
    list-style: none;
    padding: 0.5rem 10px;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

.sidebar-menu::-webkit-scrollbar {
    display: none; /* Chrome/Safari/Brave */
}

.sidebar-menu li a, 
.sidebar-menu summary {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    color: #64748b;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    border-radius: 10px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 10px; /* Espacio más notable entre módulos */
    border: 1px solid #f1f5f9; /* Límite visible permanente */
    position: relative;
    background-color: #fcfdfe; /* Fondo muy ligero para definir el área */
}

.sidebar-menu li a:hover,
.sidebar-menu summary:hover {
    background-color: #fff;
    color: var(--admin-primary);
    border-color: #e2e8f0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
}

.sidebar-menu li a.active {
    background-color: #fff;
    color: var(--admin-primary);
    border-color: #dbeafe;
    border-width: 1px;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.08);
}

/* Search Mockup (Estilo Linear Jump-to) */
.search-mockup-container {
    padding: 0 15px 15px 15px;
}
.search-mockup {
    background: #f1f5f9;
    padding: 8px 12px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #94a3b8;
    font-size: 0.85rem;
    border: 1px solid transparent;
    cursor: pointer;
}
.search-mockup:hover {
    border-color: #cbd5e1;
}
.search-shortcut {
    font-size: 0.75rem;
    opacity: 0.6;
    letter-spacing: 1px;
}

.sidebar-footer {
    padding: 0 10px 15px;
}

.sidebar.collapsed .sidebar-footer {
    padding: 15px 0;
    display: flex;
    justify-content: center;
}

.sidebar.collapsed .sidebar-footer a {
    width: 40px;
    height: 40px;
    padding: 0 !important;
    justify-content: center;
    margin: 0 auto !important;
}

.sidebar.collapsed .sidebar-footer a i {
    margin: 0 !important;
    font-size: 1rem;
}

/* Sidebar Dropdowns */
details.nav-group {
    cursor: pointer;
}

details.nav-group summary {
    padding: 0.8rem 1.5rem;
    outline: none;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--admin-sidebar-text);
    font-weight: 500;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

details.nav-group summary:hover {
    background-color: #f1f5f9;
    color: var(--admin-primary);
}

details.nav-group[open] summary {
    color: var(--admin-primary);
}

details.nav-group summary::-webkit-details-marker {
    display: none;
}

details.nav-group summary::after {
    content: '\f054';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    font-size: 0.8rem;
    transition: transform 0.3s;
    opacity: 0.6;
}

details.nav-group[open] summary::after {
    transform: rotate(90deg);
}

details.nav-group ul {
    list-style: none;
    background-color: #f8fafc; /* Gris casi imperceptible */
    margin: 0;
    padding: 0.5rem 0;
}

details.nav-group ul li a {
    padding-left: 2.5rem;
    font-size: 0.95rem;
    color: #64748b;
    border-left: none;
}

details.nav-group ul li a:hover,
details.nav-group ul li a.active {
    color: var(--admin-primary);
    background-color: transparent;
    font-weight: 600;
}

/* Main Content Area */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 2.5rem;
}

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

.page-header h2 {
    font-weight: 600;
    color: var(--admin-heading);
    font-size: 1.8rem;
}

.user-info {
    font-weight: 500;
    color: var(--admin-text);
    background: transparent;
    padding: 0.6rem 0;
}

.card {
    background: var(--admin-card-bg);
    border-radius: var(--radius-md);
    padding: 1.8rem;
    box-shadow: var(--shadow-soft);
    margin-bottom: 1.5rem;
    border: 1px solid var(--admin-border);
    transition: transform 0.3s, box-shadow 0.3s;
}

.card:hover {
    box-shadow: var(--shadow-hover);
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
}

table th {
    text-align: left;
    padding: 1rem;
    border-bottom: 2px solid var(--admin-border); /* Línea gruesa para separar cabeceras */
    color: #475569;
    font-weight: 600;
    font-size: 0.95rem;
}

table td {
    padding: 1.2rem 1rem;
    border-bottom: 1px solid var(--admin-border);
    color: var(--admin-text);
    vertical-align: middle;
}

/* Editor Styles */
.editor-toolbar {
    border-bottom: 1px solid var(--admin-border);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.image-preview {
    width: 100%;
    height: 200px;
    background: var(--admin-bg);
    border: 2px dashed var(--admin-border);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    margin-top: 0.5rem;
    cursor: pointer;
    transition: border-color 0.3s;
}

.image-preview:hover {
    border-color: var(--admin-primary);
}

/* Modal System */
.modal-overlay {
    display: none; 
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    overflow-y: auto; /* Permitir scroll si el modal es muy alto */
    padding: 2rem 1rem;
    align-items: flex-start; /* Empezar desde arriba si desborda */
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.show {
    display: flex;
    opacity: 1;
}

.modal-box {
    background-color: var(--admin-card-bg);
    border-radius: var(--radius-md);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 500px;
    padding: 2.5rem;
    position: relative;
    transform: translateY(-20px);
    transition: transform 0.3s ease;
    border: 1px solid var(--admin-border);
    max-height: calc(100vh - 4rem); /* Evitar que el modal sea más alto que la pantalla */
    overflow-y: auto; /* Scroll interno si es necesario */
}

.modal-overlay.show .modal-box {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--admin-border);
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--admin-heading);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #94a3b8;
    cursor: pointer;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #ef4444;
}
/* Global Table Action Links & Badges */
.badge-base { padding: 0.35rem 0.75rem; border-radius: 50px; font-size: 0.8rem; font-weight: 600; display: inline-block; }
.badge-role { background: #f1f5f9; color: #475569; }
.badge-active { background: rgba(16,185,129,0.15); color: #047857; }
.badge-inactive { background: rgba(239,68,68,0.15); color: #b91c1c; }

.action-link { 
    color: var(--admin-primary); 
    margin-right: 12px; 
    transition: all 0.2s ease; 
    text-decoration: none; 
    font-weight: 500; 
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
}
.action-link i { margin: 0 !important; }
.action-link:hover { color: var(--admin-primary-dark); transform: translateY(-1px); }
.action-danger { color: #ef4444; }
.action-danger:hover { color: #dc2626; }
.action-warn { color: #f59e0b; }
.action-warn:hover { color: #d97706; }
.action-success { color: #10b981; }
.action-success:hover { color: #059669; }

/* --- Botones Estilo 'Tile' (Cuadrados) --- */
.btn-action-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 6px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.7rem;
    font-weight: 600;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 60px;
    border: none;
}

.btn-action-tile i { 
    font-size: 1rem; 
    margin: 0 !important; 
}

.btn-action-tile.tile-edit { background: #64748b; color: white; }
.btn-action-tile.tile-view { background: #3b82f6; color: white; }
.btn-action-tile.tile-delete { background: #ef4444; color: white; }

.btn-action-tile:hover { 
    transform: translateY(-3px); 
    box-shadow: 0 8px 15px rgba(0,0,0,0.1); 
    opacity: 0.95; 
    color: white; 
}

