/**
 * Sistema AND - Estilos Personalizados para Admin Layout
 * Color Corporativo: #0064b0
 * Autoridad Nacional de Descentralización de Panamá
 */

/* ========================================
   Variables CSS - Colores Corporativos
   ======================================== */
:root {
    --and-primary: #0064b0;
    --and-primary-dark: #004d8c;
    --and-primary-light: #3d8ac7;
    --and-secondary: #6c757d;
    --and-success: #10b981;
    --and-danger: #ef4444;
    --and-warning: #f59e0b;
    --and-info: #3b82f6;
    --and-light: #f3f4f6;
    --and-dark: #1f2937;
    --and-white: #ffffff;
    
    /* Sombras */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* Transiciones */
    --transition-fast: all 0.2s ease;
    --transition-base: all 0.3s ease;
    --transition-slow: all 0.5s ease;
    
    /* Bordes */
    --border-radius-sm: 6px;
    --border-radius: 8px;
    --border-radius-lg: 12px;
    --border-radius-xl: 16px;
    --border-radius-full: 9999px;
}

/* ========================================
   Botones Personalizados
   ======================================== */
.btn-primary {
    background: linear-gradient(135deg, var(--and-primary) 0%, var(--and-primary-dark) 100%);
    border: none;
    box-shadow: 0 2px 8px rgba(0, 100, 176, 0.3);
    transition: var(--transition-base);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--and-primary-dark) 0%, #003a6b 100%);
    box-shadow: 0 4px 12px rgba(0, 100, 176, 0.4);
    transform: translateY(-2px);
}

.btn-primary:active, .btn-primary:focus {
    background: var(--and-primary-dark);
    box-shadow: 0 0 0 0.2rem rgba(0, 100, 176, 0.25);
}

.btn-outline-primary {
    color: var(--and-primary);
    border-color: var(--and-primary);
}

.btn-outline-primary:hover {
    background: var(--and-primary);
    border-color: var(--and-primary);
    color: white;
}

/* Botones con iconos */
.btn i {
    margin-right: 6px;
    font-size: 16px;
    vertical-align: middle;
}

/* ========================================
   Tarjetas Mejoradas
   ======================================== */
.card {
    border: none;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
    transition: var(--transition-base);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card-header {
    background: linear-gradient(135deg, var(--and-primary) 0%, var(--and-primary-dark) 100%);
    color: white;
    border-bottom: none;
    padding: 1.25rem 1.5rem;
    font-weight: 600;
}

.card-header h4,
.card-header h5 {
    color: white;
    margin: 0;
}

.card-body {
    padding: 1.5rem;
}

/* Tarjetas estadísticas */
.card-stats {
    position: relative;
    overflow: hidden;
}

.card-stats::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: translate(30%, -30%);
}

.card-stats .stats-icon {
    font-size: 2.5rem;
    color: var(--and-primary);
    opacity: 0.2;
    position: absolute;
    right: 20px;
    bottom: 20px;
}

/* ========================================
   Sidebar Mejorado
   ======================================== */

/* ============ SIDEBAR MODERNO ============ */
.sidebar-modern {
    background: linear-gradient(160deg, #003d75 0%, #00539d 40%, #0064b0 100%);
    box-shadow: 4px 0 24px rgba(0, 30, 60, 0.25);
    border-right: none;
}

.sidebar-modern .sidebar-menu-scroll,
.sidebar-modern #sidebar-menu {
    background: transparent;
}

/* --- Logo Area --- */
.sidebar-modern .navbar-brand-box {
    padding: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-modern .navbar-brand-box .logo {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    width: 100%;
    line-height: normal;
}

.sidebar-modern .logo-lg {
    display: block;
}

.sidebar-modern .logo-lg img {
    height: 75px;
    width: auto;
    max-width: 220px;
    object-fit: contain;
    filter: brightness(0) invert(1);
    opacity: 0.95;
    transition: opacity 0.2s ease;
}

.sidebar-modern .logo-sm {
    display: none;
}

.sidebar-modern .logo-sm img {
    height: 32px;
    width: 32px;
    object-fit: contain;
    filter: brightness(0) invert(1);
    opacity: 0.95;
}

/* Collapsed sidebar (70px) - Logo pequeño */
body[data-sidebar-size="sm"] .sidebar-modern .navbar-brand-box {
    padding: 0;
    width: 70px !important;
}

body[data-sidebar-size="sm"] .sidebar-modern .logo-lg {
    display: none;
}

body[data-sidebar-size="sm"] .sidebar-modern .logo-sm {
    display: block;
}

body[data-sidebar-size="sm"] .sidebar-modern .logo-sm img {
    height: 28px;
    width: 28px;
}

body[data-sidebar-size="sm"] .sidebar-modern .logo {
    padding: 12px 8px;
}

/* Compact sidebar (160px) - Logo mediano */
body[data-sidebar-size="md"] .sidebar-modern .navbar-brand-box {
    width: 160px;
}

body[data-sidebar-size="md"] .sidebar-modern .logo-lg img {
    height: 44px;
    max-width: 140px;
}

body[data-sidebar-size="md"] .sidebar-modern .logo {
    padding: 16px 10px;
}

body[data-sidebar-size="md"] .sidebar-modern > [data-simplebar] {
    margin-top: 52px;
    height: calc(100% - 52px);
}

/* Mobile - Logo en sidebar abierto */
@media (max-width: 991.98px) {
    .sidebar-modern .navbar-brand-box {
        width: 100%;
        position: relative;
    }

    .sidebar-modern .logo-lg img {
        height: 38px;
    }
}

/* --- Menu Container --- */
.sidebar-modern #side-menu {
    padding: 16px 12px;
}

/* --- Menu Title --- */
.sidebar-modern .menu-title {
    padding: 10px 16px 8px;
    color: rgba(255, 255, 255, 0.45);
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin: 16px 0 4px 0;
    background: none;
    border-radius: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sidebar-modern .menu-title:first-child {
    margin-top: 0;
}

.sidebar-modern .menu-title i {
    font-size: 13px;
    opacity: 0.6;
}

/* --- Menu Items --- */
.sidebar-modern #side-menu > li > a {
    padding: 10px 16px;
    color: rgba(255, 255, 255, 0.72);
    font-weight: 500;
    font-size: 14px;
    border-radius: 8px;
    margin: 2px 0;
    transition: color 0.2s ease, background 0.2s ease;
    position: relative;
    display: flex;
    align-items: center;
}

.sidebar-modern #side-menu > li > a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* Active state */
.sidebar-modern #side-menu > li.mm-active > a {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-weight: 600;
}

.sidebar-modern #side-menu > li.mm-active > a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 60%;
    width: 3px;
    background: #fff;
    border-radius: 0 3px 3px 0;
}

/* --- Icons --- */
.sidebar-modern .nav-icon {
    font-size: 18px;
    width: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    color: rgba(255, 255, 255, 0.55);
    transition: color 0.2s ease;
    flex-shrink: 0;
}

.sidebar-modern #side-menu > li > a:hover .nav-icon,
.sidebar-modern #side-menu > li.mm-active > a .nav-icon {
    color: #fff;
}

/* --- Submenu --- */
.sidebar-modern .sub-menu {
    background: none;
    border-radius: 0;
    margin: 0;
    padding: 4px 0 4px 0;
    position: relative;
}

.sidebar-modern .sub-menu::before {
    content: '';
    position: absolute;
    left: 28px;
    top: 4px;
    bottom: 4px;
    width: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-modern .sub-menu li a {
    padding: 8px 16px 8px 44px;
    color: rgba(255, 255, 255, 0.55);
    font-size: 13.5px;
    font-weight: 400;
    border-radius: 6px;
    margin: 1px 0;
    transition: color 0.2s ease, background 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.sidebar-modern .sub-menu li a::before {
    content: '';
    position: absolute;
    left: 26px;
    top: 50%;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transition: background 0.2s ease, transform 0.2s ease;
}

.sidebar-modern .sub-menu li a i {
    font-size: 15px;
    width: 18px;
    color: rgba(255, 255, 255, 0.45);
    transition: color 0.2s ease;
}

.sidebar-modern .sub-menu li a:hover {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.95);
}

.sidebar-modern .sub-menu li a:hover::before {
    background: #fff;
    transform: scale(1.3);
}

.sidebar-modern .sub-menu li a:hover i {
    color: rgba(255, 255, 255, 0.9);
}

.sidebar-modern .sub-menu li.mm-active > a {
    color: #fff;
    font-weight: 500;
}

.sidebar-modern .sub-menu li.mm-active > a::before {
    background: #fff;
}

/* --- Arrow Icon --- */
.sidebar-modern .has-arrow::after {
    border: none;
    font-family: 'Material Design Icons';
    content: "\F0142";
    font-size: 16px;
    transition: transform 0.25s ease;
    position: absolute;
    right: 16px;
    color: rgba(255, 255, 255, 0.35);
}

.sidebar-modern #side-menu > li > a:hover .has-arrow::after,
.sidebar-modern .mm-active > .has-arrow::after {
    color: rgba(255, 255, 255, 0.7);
}

.sidebar-modern .mm-active > .has-arrow::after {
    transform: rotate(90deg);
}

/* --- Scrollbar --- */
.sidebar-modern .simplebar-track.simplebar-vertical {
    width: 4px;
    right: 2px;
    background: transparent;
}

.sidebar-modern .simplebar-scrollbar::before {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.sidebar-modern:hover .simplebar-scrollbar::before {
    opacity: 1;
}

/* --- Badge --- */
.sidebar-modern .badge {
    font-size: 10px;
    padding: 3px 7px;
    font-weight: 600;
    border-radius: 6px;
}

/* --- Dark mode override --- */
[data-sidebar="dark"] .sidebar-modern #sidebar-menu ul li a {
    color: rgba(255, 255, 255, 0.72);
}

[data-sidebar="dark"] .sidebar-modern #sidebar-menu ul li a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

/* --- Responsive --- */
@media (max-width: 991.98px) {
    .sidebar-modern .vertical-menu-btn {
        display: block;
        background: rgba(255, 255, 255, 0.12);
        color: #fff;
        border: none;
        border-radius: 8px;
        margin: 10px;
    }
}

/* ========================================
   Topbar Mejorado
   ======================================== */
.navbar-header {
    background: #00539d;
    box-shadow: 0 2px 15px rgba(0, 83, 157, 0.3);
    z-index: 1000;
}

#page-topbar .header-item {
    color: #fff !important;
}

#page-topbar .header-item i {
    color: #fff !important;
}

#page-topbar .vertical-menu-btn {
    color: #fff !important;
}

#page-topbar .vertical-menu-btn i {
    color: #fff !important;
}

#page-topbar .header-item:hover {
    color: #fff !important;
}

.navbar-brand-box {
    background: rgba(255, 255, 255, 0.1);
}

.logo-light {
    filter: brightness(0) invert(1);
}

/* Notificaciones en topbar */
.noti-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.noti-icon .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--and-danger);
    border-radius: var(--border-radius-full);
    font-size: 10px;
    padding: 2px 5px;
}

#page-topbar .topbar-badge {
    position: absolute;
    top: 5px;
    right: 3px;
    font-size: 9px;
    padding: 2px 5px;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Dropdown de notificaciones */
#page-topbar .dropdown-menu-lg {
    min-width: 320px;
    max-width: 380px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

#page-topbar .notification-item {
    transition: all 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
}

#page-topbar .notification-item:last-child {
    border-bottom: none;
}

#page-topbar .notification-item:hover {
    background: #f8f9fa;
    transform: translateX(2px);
}

#page-topbar .dropdown-menu .bg-primary {
    background: linear-gradient(135deg, #00539d 0%, #003d75 100%) !important;
}

#page-topbar .dropdown-menu .btn-link {
    color: #00539d;
    text-decoration: none;
    font-weight: 500;
}

#page-topbar .dropdown-menu .btn-link:hover {
    color: #003d75;
    text-decoration: underline;
}

#page-topbar .avatar-xs {
    width: 2rem;
    height: 2rem;
}

#page-topbar .avatar-title {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 16px;
}

/* --- Fix scroll area para logo grande --- */
.sidebar-modern > [data-simplebar] {
    margin-top: 123px;
    height: calc(100% - 123px);
}
