/* ============================================================
   AIDEPCE - Sistema de Correlativos
   Diseño: Sidebar blanco con acento azul
   ============================================================ */

:root {
    --aid-primary: #27418C;
    --aid-secondary: #117DBF;
    --aid-accent: #05C7F2;
    --aid-danger: #BF213E;
    --aid-dark: #1a2040;
    --aid-bg: #F4F6FA;
    --aid-sidebar-bg: #FAFBFE;
    --aid-sidebar-border: #EAEDF4;
    --aid-sidebar-accent: #27418C;
    --aid-text: #27418C;
    --aid-text-muted: #5A6685;
    --aid-text-light: #9AA3BA;
    --aid-card-bg: #ffffff;
    --aid-card-border: #EAEDF4;
    --aid-active-bg: #EDF1FB;
    --aid-hover-bg: #F0F3FB;
    --aid-success: #1D9E75;
    --aid-warning: #BA7517;
}

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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 0.9rem;
    background: var(--aid-bg);
    color: #333;
    min-height: 100vh;
}

/* ── LAYOUT PRINCIPAL ──────────────────────────────────────── */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ── SIDEBAR ───────────────────────────────────────────────── */
.sidebar {
    width: 240px;
    background: var(--aid-sidebar-bg);
    border-right: 3px solid var(--aid-sidebar-accent);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    overflow-y: auto;
}

.sidebar-logo {
    padding: 18px 16px;
    border-bottom: 1px solid var(--aid-sidebar-border);
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.sidebar-logo img {
    height: 42px;
    width: auto;
    border-radius: 6px;
}

.sidebar-logo-text {
    font-size: 15px;
    font-weight: 600;
    color: var(--aid-primary);
    line-height: 1.2;
}

.sidebar-logo-sub {
    font-size: 10px;
    color: var(--aid-text-light);
    margin-top: 2px;
}

.sidebar-nav {
    flex: 1;
    padding: 8px 0;
}

.nav-section {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--aid-text-light);
    padding: 16px 16px 6px;
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: 13px;
    color: var(--aid-text-muted);
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: all 0.15s ease;
    margin: 1px 0;
}

.nav-item:hover {
    background: var(--aid-hover-bg);
    color: var(--aid-primary);
    text-decoration: none;
}

.nav-item.active {
    background: var(--aid-active-bg);
    color: var(--aid-primary);
    font-weight: 600;
    border-left-color: var(--aid-accent);
}

.nav-item .nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

.sidebar-user {
    padding: 14px 16px;
    border-top: 1px solid var(--aid-sidebar-border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--aid-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    flex-shrink: 0;
}

.user-info-name {
    font-size: 12px;
    color: var(--aid-primary);
    font-weight: 600;
}

.user-info-role {
    font-size: 10px;
    color: var(--aid-text-light);
}

.btn-logout {
    margin-left: auto;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: 1px solid var(--aid-sidebar-border);
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}

.btn-logout:hover {
    background: #FEF0F2;
    border-color: var(--aid-danger);
}

/* ── CONTENIDO PRINCIPAL ───────────────────────────────────── */
.main-content {
    flex: 1;
    margin-left: 240px;
    padding: 28px 32px;
    min-height: 100vh;
}

/* ── TOPBAR ────────────────────────────────────────────────── */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.topbar-breadcrumb {
    font-size: 11px;
    color: var(--aid-text-light);
    margin-bottom: 4px;
}

.topbar-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--aid-primary);
}

.topbar-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

/* ── PILLS Y FILTROS ──────────────────────────────────────── */
.filter-pill {
    font-size: 12px;
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid #D6E0F0;
    background: #fff;
    color: var(--aid-text-muted);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.15s;
    text-decoration: none;
    display: inline-block;
}

.filter-pill:hover {
    border-color: var(--aid-primary);
    color: var(--aid-primary);
}

.filter-pill.active {
    background: var(--aid-primary);
    color: #fff;
    border-color: var(--aid-primary);
}

.filter-pill-accent {
    background: #fff;
    color: var(--aid-secondary);
    border: 1px solid var(--aid-secondary);
    font-weight: 600;
}

.filter-pill-accent:hover {
    background: var(--aid-secondary);
    color: #fff;
}

/* ── TARJETAS MÉTRICAS ─────────────────────────────────────── */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.metric-card {
    background: var(--aid-card-bg);
    border-radius: 10px;
    padding: 16px 18px;
    border: 1px solid var(--aid-card-border);
}

.metric-label {
    font-size: 11px;
    color: var(--aid-text-light);
    margin-bottom: 6px;
    font-weight: 500;
}

.metric-value {
    font-size: 24px;
    font-weight: 600;
    color: var(--aid-primary);
}

.metric-change {
    font-size: 11px;
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.metric-change.up { color: var(--aid-success); }
.metric-change.down { color: var(--aid-danger); }
.metric-change.neutral { color: var(--aid-text-light); }

/* ── TARJETAS CONTENIDO ────────────────────────────────────── */
.card {
    background: var(--aid-card-bg);
    border-radius: 10px;
    padding: 20px;
    border: 1px solid var(--aid-card-border);
    margin-bottom: 18px;
}

.card-header-custom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 8px;
}

.card-title-custom {
    font-size: 15px;
    font-weight: 600;
    color: var(--aid-primary);
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

/* ── ACCESOS RÁPIDOS ───────────────────────────────────────── */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.quick-action {
    background: var(--aid-card-bg);
    border-radius: 10px;
    padding: 16px 14px;
    border: 1px solid var(--aid-card-border);
    text-align: center;
    text-decoration: none;
    transition: all 0.15s;
    display: block;
}

.quick-action:hover {
    border-color: var(--aid-primary);
    background: var(--aid-sidebar-bg);
    text-decoration: none;
}

.quick-action-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    margin: 0 auto 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quick-action-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--aid-primary);
}

.quick-action-sub {
    font-size: 10px;
    color: var(--aid-text-light);
    margin-top: 3px;
}

/* ── BOTONES ───────────────────────────────────────────────── */
.btn-aid-primary {
    background: var(--aid-primary);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-aid-primary:hover { background: #1a2c63; }

.btn-aid-secondary {
    background: var(--aid-secondary);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-aid-secondary:hover { background: #0e6499; }

.btn-aid-danger {
    background: var(--aid-danger);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-aid-danger:hover { background: #991a32; }

.btn-aid-outline {
    background: #fff;
    color: var(--aid-primary);
    border: 1px solid #D6E0F0;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.btn-aid-outline:hover {
    border-color: var(--aid-primary);
    background: var(--aid-active-bg);
    text-decoration: none;
}

.btn-export {
    background: #fff;
    color: var(--aid-secondary);
    border: 1px solid var(--aid-secondary);
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.btn-export:hover {
    background: var(--aid-secondary);
    color: #fff;
}

/* ── TABS DE DOCUMENTO ─────────────────────────────────────── */
.doc-tabs {
    display: flex;
    gap: 4px;
    background: #EAEDF4;
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 20px;
    width: fit-content;
}

.doc-tab {
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    background: transparent;
    color: var(--aid-text-muted);
    transition: all 0.15s;
    text-decoration: none;
    display: inline-block;
}

.doc-tab:hover {
    color: var(--aid-primary);
}

.doc-tab.active {
    background: #fff;
    color: var(--aid-primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* ── FORMULARIOS ───────────────────────────────────────────── */
.form-label-aid {
    font-size: 13px;
    font-weight: 600;
    color: var(--aid-text-muted);
    margin-bottom: 6px;
}

.form-card {
    background: var(--aid-card-bg);
    border-radius: 12px;
    padding: 28px;
    border: 1px solid var(--aid-card-border);
    border-top: 3px solid var(--aid-primary);
}

.form-card-vale {
    border-top-color: var(--aid-secondary);
}

.form-card-danger {
    border-top-color: var(--aid-danger);
}

/* ── TABLAS ─────────────────────────────────────────────────── */
.table-aid {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.table-aid thead th {
    background: var(--aid-active-bg);
    color: var(--aid-primary);
    font-weight: 600;
    padding: 10px 12px;
    border-bottom: 2px solid #D6E0F0;
    font-size: 12px;
}

.table-aid tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--aid-card-border);
    color: #444;
}

.table-aid tbody tr:hover {
    background: var(--aid-hover-bg);
}

/* ── BADGES ────────────────────────────────────────────────── */
.badge-aid {
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 600;
    display: inline-block;
}

.badge-recibo {
    background: #EDF1FB;
    color: var(--aid-primary);
}

.badge-vale {
    background: #E1F5EE;
    color: #085041;
}

.badge-anulado {
    background: #FEF0F2;
    color: var(--aid-danger);
}

.badge-admin {
    background: var(--aid-active-bg);
    color: var(--aid-primary);
}

.badge-usuario {
    background: #E8F8FD;
    color: var(--aid-secondary);
}

/* ── ALERTAS ───────────────────────────────────────────────── */
.alert-aid {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 16px;
    text-align: center;
}

.alert-success { background: #E1F5EE; color: #085041; border: 1px solid #9FE1CB; }
.alert-danger { background: #FEF0F2; color: #791F1F; border: 1px solid #F7C1C1; }
.alert-warning { background: #FAEEDA; color: #633806; border: 1px solid #FAC775; }
.alert-info { background: #E8F8FD; color: #0C447C; border: 1px solid #B5D4F4; }

/* ── RESPONSIVE ────────────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        border-right: none;
        border-bottom: 3px solid var(--aid-sidebar-accent);
    }
    
    .sidebar-nav { display: none; }
    
    .main-content {
        margin-left: 0;
        padding: 16px;
    }
    
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ── FOOTER ──────────────────────────────── */
.app-footer { margin-top:40px; padding:20px 0; border-top:1px solid var(--aid-card-border); display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:12px; }
.footer-copyright { font-size:11px; color:var(--aid-text-light); }
.footer-support { display:flex; align-items:center; gap:12px; }
.footer-support a { font-size:11px; color:var(--aid-secondary); text-decoration:none; font-weight:500; display:inline-flex; align-items:center; gap:4px; }
.footer-support a:hover { color:var(--aid-primary); text-decoration:underline; }

/* ── DATATABLES PAGINATION FIX ───────────── */
.dataTables_paginate .paginate_button { color:var(--aid-text-muted) !important; border:1px solid #D6E0F0 !important; border-radius:6px !important; background:#fff !important; margin:0 2px !important; padding:4px 10px !important; font-size:12px !important; }
.dataTables_paginate .paginate_button:hover { background:var(--aid-active-bg) !important; color:var(--aid-primary) !important; border-color:var(--aid-primary) !important; }
.dataTables_paginate .paginate_button.current { background:var(--aid-primary) !important; color:#fff !important; border-color:var(--aid-primary) !important; }
.dataTables_paginate .paginate_button.disabled { color:#C4CBDB !important; background:#F8F9FC !important; border-color:#EAEDF4 !important; }

/* ── ADMIN PANELS ────────────────────────── */
.admin-grid { display:grid; grid-template-columns:360px 1fr; gap:20px; align-items:start; }
@media (max-width:900px) { .admin-grid { grid-template-columns:1fr; } }
.item-actions { display:flex; gap:4px; justify-content:center; flex-wrap:wrap; }
.btn-sm-action { padding:3px 8px; font-size:11px; font-weight:600; border-radius:6px; border:1px solid; background:#fff; cursor:pointer; transition:all 0.15s; }
.btn-sm-edit { color:var(--aid-secondary); border-color:var(--aid-secondary); }
.btn-sm-edit:hover { background:var(--aid-secondary); color:#fff; }
.btn-sm-toggle { color:#BA7517; border-color:#E8C76A; }
.btn-sm-toggle:hover { background:#FAEEDA; }
.btn-sm-delete { color:var(--aid-danger); border-color:var(--aid-danger); }
.btn-sm-delete:hover { background:var(--aid-danger); color:#fff; }
.status-active { display:inline-block; width:8px; height:8px; border-radius:50%; background:var(--aid-success); margin-right:4px; }
.status-inactive { display:inline-block; width:8px; height:8px; border-radius:50%; background:#C4CBDB; margin-right:4px; }
