/* =========================================================
   ERP Dashboard - Global Styles
   Archivo: /app_dashboard/assets/css/style.css
   Nota: cargar después de Bootstrap.
   ========================================================= */

/* =========================
   Base
   ========================= */
:root {
    --sidebar-width: 250px;
    --sidebar-bg: #20262c;
    --page-bg: #f5f7fb;
    --primary: #0d6efd;
    --text-muted: #6c757d;
    --white-soft: rgba(255,255,255,.09);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--page-bg);
    overflow-x: hidden;
}

/* =========================
   Login
   ========================= */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a, #1d4ed8);
}

.login-card {
    width: 100%;
    max-width: 420px;
    border-radius: 22px;
    box-shadow: 0 18px 40px rgba(0,0,0,.18);
}

/* =========================
   Layout general
   ========================= */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.main-content {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    padding: 32px 36px;
    transition: margin-left .3s ease, width .3s ease;
}

/* =========================
   Sidebar
   ========================= */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: #fff;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    padding: 18px 16px;
    overflow-y: auto;
    z-index: 1000;
    transition: transform .3s ease;
}

.sidebar-logo {
    text-align: center;
    margin-bottom: 28px;
}

.sidebar-logo img {
    max-width: 165px;
}

.sidebar-nav a,
.sidebar-link {
    display: block;
    color: #e5edf7;
    text-decoration: none;
    padding: 11px 12px;
    border-radius: 10px;
    margin-bottom: 8px;
    font-size: 15px;
}

.sidebar-nav a:hover,
.sidebar-link:hover {
    background: var(--white-soft);
    color: #fff;
}

.sidebar-link.active-link,
.sidebar-submenu a.active-link {
    background: var(--primary);
    color: #fff;
    font-weight: 600;
}

/* =========================
   Sidebar grupos desplegables
   ========================= */
.sidebar-group {
    margin-bottom: 8px;
}

.sidebar-group-title {
    width: 100%;
    border: none;
    background: transparent;
    color: #e5edf7;
    padding: 12px;
    border-radius: 10px;
    font-size: 15px;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.sidebar-group-title:hover {
    background: var(--white-soft);
    color: #fff;
}

.sidebar-arrow {
    transition: transform .2s ease;
}

.sidebar-group.active > .sidebar-group-title {
    background: rgba(255,255,255,.10);
    color: #fff;
    font-weight: 600;
}

.sidebar-group.active .sidebar-arrow {
    transform: rotate(180deg);
}

.sidebar-submenu {
    display: none;
    padding-left: 18px;
    margin-top: 4px;
}

.sidebar-group.active .sidebar-submenu {
    display: block;
}

.sidebar-submenu a {
    display: block;
    color: #cbd5e1;
    text-decoration: none;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 4px;
}

.sidebar-submenu a:hover {
    background: rgba(255,255,255,.08);
    color: #fff;
}

/* =========================
   Botón hamburguesa y overlay
   ========================= */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 1200;
    border: none;
    background: var(--sidebar-bg);
    color: #fff;
    width: 46px;
    height: 46px;
    border-radius: 12px;
    font-size: 24px;
    box-shadow: 0 8px 20px rgba(0,0,0,.18);
}

.sidebar-overlay {
    display: none;
}

/* =========================
   Usuario superior
   ========================= */
.topbar-user {
    position: fixed;
    top: 18px;
    right: 24px;
    z-index: 1100;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* =========================
   Cards / Dashboard
   ========================= */
.dashboard-card,
.card-kpi,
.kpi-card {
    border: none;
    border-radius: 18px;
    box-shadow: 0 8px 24px rgba(0,0,0,.06);
}

.dashboard-card {
    box-shadow: 0 10px 30px rgba(0,0,0,.06);
}

.kpi-card {
    transition: transform .2s ease;
}

.kpi-card:hover {
    transform: translateY(-2px);
}

.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    background: rgba(13,110,253,.08);
}

.metric-label {
    font-size: .9rem;
    color: var(--text-muted);
}

.metric-value {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1.1;
}

.section-title {
    font-weight: 700;
    margin-bottom: .25rem;
}

.mini-stat {
    font-size: .95rem;
    color: var(--text-muted);
}

/* =========================
   Tablas
   ========================= */
.table thead th {
    white-space: nowrap;
}

/* =========================
   Responsive: tablet y celular
   ========================= */
@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-toggle {
        display: block;
    }

    .sidebar-overlay.active {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.45);
        z-index: 900;
    }

    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 78px 18px 24px;
    }

    .topbar-user {
        top: 14px;
        right: 14px;
    }

    .topbar-user .btn {
        font-size: 13px;
        padding: 7px 10px;
    }
}

@media (max-width: 576px) {
    .main-content {
        padding: 76px 14px 22px;
    }

    .sidebar {
        width: 260px;
    }

    .sidebar-logo img {
        max-width: 140px;
    }
}


.btn-save{
    border:none;
    background:#0d6efd;
    color:#fff;
    padding:14px 26px;
    border-radius:14px;
    font-size:15px;
    font-weight:600;
    cursor:pointer;
    transition:all .2s ease;
    display:inline-flex;
    align-items:center;
    gap:10px;
    box-shadow:0 8px 18px rgba(13,110,253,.20);
}

.btn-save:hover{
    background:#0b5ed7;
    transform:translateY(-2px);
    box-shadow:0 12px 24px rgba(13,110,253,.28);
}

.btn-save:active{
    transform:scale(.98);
}

.form-actions{
    display:flex;
    justify-content:flex-end;
    margin-top:10px;
}