/* ==================================================
   RESET
================================================== */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}


html,
body {
    width: 100%;
    height: 100%;
}


body {
    font-family:
        Arial,
        Helvetica,
        sans-serif;

    background: #f5f7fb;
    color: #1f2937;
}


/* ==================================================
   APLICACIÓN
================================================== */

.app {
    display: flex;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}


/* ==================================================
   SIDEBAR
================================================== */

.sidebar {
    width: 250px;
    min-width: 250px;

    display: flex;
    flex-direction: column;

    background: #111827;
    color: white;

    transition:
        width 0.25s ease,
        min-width 0.25s ease;
}


/* ==================================================
   CABECERA SIDEBAR
================================================== */

.sidebar-header {
    height: 70px;

    display: flex;
    align-items: center;

    padding: 0 20px;

    border-bottom:
        1px solid rgba(255, 255, 255, 0.08);
}


.logo {
    display: flex;
    align-items: center;
    gap: 12px;

    white-space: nowrap;
}


.logo-icon {
    width: 36px;
    height: 36px;

    display: flex;
    align-items: center;
    justify-content: center;

    background: #2563eb;

    border-radius: 9px;

    font-size: 18px;
    font-weight: bold;
}


.logo-text {
    font-size: 17px;
    font-weight: bold;
}


/* ==================================================
   MENÚ
================================================== */

.menu {
    flex: 1;

    padding: 20px 12px;

    overflow-y: auto;
}


.menu-title {
    padding: 10px 12px;

    color: #6b7280;

    font-size: 11px;
    font-weight: bold;

    letter-spacing: 1px;
}


.menu-item {
    display: flex;
    align-items: center;

    gap: 12px;

    width: 100%;

    padding: 12px;

    margin-bottom: 5px;

    color: #d1d5db;

    text-decoration: none;

    border-radius: 8px;

    transition:
        background 0.2s,
        color 0.2s;
}


.menu-item:hover {
    background: #1f2937;
    color: white;
}


.menu-item.activo {
    background: #2563eb;
    color: white;
}


.menu-icon {
    width: 22px;

    text-align: center;

    font-size: 18px;
}


.menu-text {
    white-space: nowrap;
}


/* ==================================================
   FOOTER SIDEBAR
================================================== */

.sidebar-footer {
    padding: 15px;

    border-top:
        1px solid rgba(255, 255, 255, 0.08);
}


.usuario {
    display: flex;
    align-items: center;

    gap: 10px;
}


.usuario-avatar {
    width: 38px;
    height: 38px;

    display: flex;
    align-items: center;
    justify-content: center;

    flex-shrink: 0;

    background: #2563eb;

    border-radius: 50%;

    color: white;

    font-size: 12px;
    font-weight: bold;
}


.usuario-info {
    display: flex;
    flex-direction: column;

    gap: 3px;

    white-space: nowrap;
}


.usuario-info strong {
    font-size: 13px;
}


.usuario-info small {
    color: #9ca3af;

    font-size: 11px;
}


/* ==================================================
   SIDEBAR CONTRAÍDO
================================================== */

.sidebar.colapsado {
    width: 70px;
    min-width: 70px;
}


.sidebar.colapsado .logo-text,
.sidebar.colapsado .menu-text,
.sidebar.colapsado .menu-title,
.sidebar.colapsado .usuario-info {
    display: none;
}


.sidebar.colapsado .sidebar-header {
    justify-content: center;
    padding: 0;
}


.sidebar.colapsado .menu-item {
    justify-content: center;
}


.sidebar.colapsado .sidebar-footer {
    display: flex;
    justify-content: center;
}


/* ==================================================
   PARTE PRINCIPAL
================================================== */

.main {
    flex: 1;

    min-width: 0;

    display: flex;
    flex-direction: column;
}


/* ==================================================
   TOPBAR
================================================== */

.topbar {
    height: 70px;

    display: flex;
    align-items: center;

    padding: 0 25px;

    background: white;

    border-bottom: 1px solid #e5e7eb;
}


.btn-menu {
    width: 40px;
    height: 40px;

    margin-right: 15px;

    border: none;

    background: transparent;

    border-radius: 8px;

    font-size: 20px;

    cursor: pointer;
}


.btn-menu:hover {
    background: #f3f4f6;
}


.breadcrumb {
    font-size: 18px;
    font-weight: bold;
}


.topbar-right {
    margin-left: auto;

    display: flex;
    align-items: center;

    gap: 18px;
}


.icon-button {
    width: 40px;
    height: 40px;

    border: none;

    background: transparent;

    border-radius: 8px;

    cursor: pointer;

    font-size: 17px;
}


.icon-button:hover {
    background: #f3f4f6;
}


.topbar-user {
    display: flex;
    align-items: center;

    gap: 10px;

    font-size: 13px;
}


/* ==================================================
   CONTENIDO
================================================== */

.contenido {
    flex: 1;

    padding: 30px;

    overflow-y: auto;

    background: #f5f7fb;
}


/* Animación */

.contenido.animar {
    animation: aparecer 0.25s ease;
}


@keyframes aparecer {

    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }

}


/* ==================================================
   FOOTER
================================================== */

.footer {
    height: 40px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 25px;

    background: white;

    border-top: 1px solid #e5e7eb;

    color: #9ca3af;

    font-size: 11px;
}


/* ==================================================
   TARJETAS
================================================== */

.page-header {
    margin-bottom: 25px;
}


.page-header h1 {
    margin-bottom: 7px;

    font-size: 25px;
}


.page-header p {
    color: #6b7280;

    font-size: 14px;
}


.cards {
    display: grid;

    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    gap: 20px;

    margin-bottom: 25px;
}


.card {
    padding: 22px;

    background: white;

    border: 1px solid #e5e7eb;

    border-radius: 12px;

    box-shadow:
        0 2px 5px rgba(0, 0, 0, 0.03);
}


.card-title {
    color: #6b7280;

    font-size: 13px;

    margin-bottom: 10px;
}


.card-value {
    font-size: 28px;

    font-weight: bold;
}


.card-footer {
    margin-top: 10px;

    color: #16a34a;

    font-size: 12px;
}


/* ==================================================
   PANEL
================================================== */

.panel {
    padding: 25px;

    background: white;

    border: 1px solid #e5e7eb;

    border-radius: 12px;
}


.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-bottom: 20px;
}


.panel-header h2 {
    font-size: 18px;
}


/* ==================================================
   BOTONES
================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    gap: 7px;

    padding: 9px 15px;

    border: none;

    border-radius: 7px;

    cursor: pointer;

    font-size: 13px;

    text-decoration: none;
}


.btn-primary {
    background: #2563eb;
    color: white;
}


.btn-primary:hover {
    background: #1d4ed8;
}


.btn-secondary {
    background: #e5e7eb;
    color: #374151;
}


/* ==================================================
   TABLAS
================================================== */

.tabla {
    width: 100%;

    border-collapse: collapse;
}


.tabla th,
.tabla td {
    padding: 13px 12px;

    text-align: left;

    border-bottom: 1px solid #e5e7eb;

    font-size: 13px;
}


.tabla th {
    background: #f9fafb;

    color: #6b7280;

    font-size: 12px;
}


.tabla tr:hover td {
    background: #f9fafb;
}


/* ==================================================
   BADGES
================================================== */

.badge {
    display: inline-block;

    padding: 4px 9px;

    border-radius: 20px;

    font-size: 11px;
    font-weight: bold;
}


.badge-activo {
    background: #dcfce7;
    color: #166534;
}


.badge-inactivo {
    background: #fee2e2;
    color: #991b1b;
}


.badge-stock {
    background: #dbeafe;
    color: #1e40af;
}


/* ==================================================
   FORMULARIOS
================================================== */

.formulario {
    max-width: 700px;
}


.form-group {
    margin-bottom: 18px;
}


.form-group label {
    display: block;

    margin-bottom: 7px;

    font-size: 13px;
    font-weight: bold;
}


.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;

    padding: 10px 12px;

    border: 1px solid #d1d5db;

    border-radius: 7px;

    outline: none;

    font-family: inherit;
    font-size: 13px;
}


.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #2563eb;

    box-shadow:
        0 0 0 3px rgba(37, 99, 235, 0.1);
}


/* ==================================================
   LOADING
================================================== */

.loading {
    height: 200px;

    display: flex;
    align-items: center;
    justify-content: center;

    color: #6b7280;
}


/* ==================================================
   RESPONSIVE
================================================== */

@media (max-width: 900px) {

    .cards {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

}


@media (max-width: 700px) {

    .sidebar {
        position: fixed;

        left: 0;
        top: 0;
        bottom: 0;

        z-index: 1000;

        transform: translateX(0);

        box-shadow:
            5px 0 20px rgba(0, 0, 0, 0.15);
    }


    .sidebar.oculto {
        transform: translateX(-100%);
    }


    .topbar-user span {
        display: none;
    }


    .contenido {
        padding: 20px;
    }


    .cards {
        grid-template-columns: 1fr;
    }


    .tabla {
        min-width: 600px;
    }


    .panel {
        overflow-x: auto;
    }

}

/* ==================================================
   GRUPOS DEL MENÚ
================================================== */

.menu-grupo {
    width: 100%;
    margin-bottom: 5px;
}


/* ==================================================
   BOTÓN PRINCIPAL DEL SUBMENÚ
================================================== */

.menu-toggle {
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: inherit;
    text-align: left;
    cursor: pointer;
}


/* ==================================================
   FLECHA DEL SUBMENÚ
================================================== */

.menu-flecha {
    margin-left: auto;

    font-size: 10px;

    color: #9ca3af;

    transition:
        transform 0.25s ease,
        color 0.2s ease;
}


/* Flecha cuando el menú está abierto */

.menu-toggle.abierto .menu-flecha {
    transform: rotate(180deg);
    color: white;
}


/* ==================================================
   SUBMENÚ
================================================== */

.submenu {
    display: none;

    padding: 3px 0 8px 34px;
}


/* Submenú abierto */

.submenu.abierto {
    display: block;
}


/* ==================================================
   ELEMENTOS DEL SUBMENÚ
================================================== */

.submenu-item {
    display: block;

    width: 100%;

    padding: 9px 12px;

    margin-bottom: 3px;

    color: #9ca3af;

    text-decoration: none;

    font-size: 13px;

    border-left: 2px solid #374151;

    border-radius: 0 6px 6px 0;

    transition:
        background 0.2s ease,
        color 0.2s ease,
        border-color 0.2s ease;
}


/* Hover */

.submenu-item:hover {
    background: #1f2937;

    color: white;

    border-left-color: #2563eb;
}


/* Elemento activo */

.submenu-item.activo {
    background: #1e3a8a;

    color: white;

    border-left-color: #60a5fa;
}