/* -----------------------------
   ESTILOS GENERALES
------------------------------*/
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    overflow: auto;
    font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    background: #f1f5f9;
    color: #0f172a;
}

/* Cuando el sidebar está abierto en celular, bloqueamos scroll del fondo */
body.no-scroll {
    overflow: hidden;
}

/* -----------------------------
   SIDEBAR
------------------------------*/
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 260px;
    background: #0f172a;
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    padding-top: 20px;
    border-right: 1px solid rgba(255,255,255,0.05);
    transition: transform 0.25s ease;
    z-index: 999;

    /* 🔹 Para poder hacer scroll dentro del menú si hay muchos módulos */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.sidebar .brand {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 6px;
    font-size: 1.4rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.sidebar .brand i {
    font-size: 2rem;
    margin-right: 12px;
    background: linear-gradient(135deg, #0ea5e9, #6366f1);
    padding: 8px 12px;
    border-radius: 10px;
}

.sidebar a {
    padding: 14px 20px;
    font-size: 1.05rem;
    color: #cbd5e1;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: 0.2s;
}

.sidebar a i {
    font-size: 1.5rem;
}

.sidebar a:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

.sidebar a.active {
    background: #1e293b;
    color: #fff;
    border-left: 4px solid #00bcd4;
}

.sidebar .bottom {
    margin-top: auto;
    padding-bottom: 20px;
}

/* -----------------------------
   CONTENIDO PRINCIPAL
------------------------------*/
.main-content {
    margin-left: 260px;
    min-height: 100vh;
    padding: 20px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

/* Overlay para sidebar en móvil */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    z-index: 998;
}

.sidebar-overlay.show {
    display: block;
}

/* -----------------------------
   ESTILOS REUSABLES
------------------------------*/
.modal-content.bg-dark {
    background-color: #1e293b !important;
}

.table-dark-custom {
    background: #1e293b;
    color: #e2e8f0;
}

.text-muted-soft {
    color: #94a3b8 !important;
}

.search-input {
    background: #fff;
    border-radius: 6px;
}

.btn-soft-primary {
    background: #3b82f6;
    color: white;
    border: none;
}
.btn-soft-primary:hover {
    background: #2563eb;
    color: #fff;
}

.btn-soft-success {
    background: #288b4c;
    color: white;
    border: none;
}
.btn-soft-success:hover {
    background: #16a34a;
    color: #fff;
}

.app-card {
    width: 100%;
    margin-bottom: 1.5rem;
}

.app-card-header {
    border-bottom: 1px solid rgba(148,163,184,0.4);
}

.app-card-title {
    font-weight: 600;
}

.auth-wrapper {
    padding-top: 40px;
    padding-bottom: 40px;
}

/* Tablas */
.table-responsive {
    width: 100%;
}

.table-responsive table {
    font-size: 0.9rem;
}

/* -----------------------------
   TARJETAS PRODUCTOS (MÓVIL)
------------------------------*/
.product-card-mobile {
    border-radius: 0.9rem;
    border: 1px solid #e5e7eb;
}

.product-card-mobile h5 {
    font-size: 1rem;
    font-weight: 600;
}

.product-card-mobile .badge {
    font-size: 0.7rem;
}

/* -----------------------------
   RESPONSIVE: TABLET / MÓVIL
------------------------------*/
@media (max-width: 991.98px) {

    body {
        overflow: auto;
    }

    .sidebar {
        transform: translateX(-100%);
        width: 240px;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 16px 10px;
        min-height: 100vh;
    }

    .topbar span {
        font-size: 0.9rem;
    }

    .card,
    .app-card {
        border-radius: 0.75rem;
        margin-bottom: 1rem;
    }

    .row.g-3 > [class*="col-"] {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* -----------------------------
   MÓVIL PEQUEÑO (<576px)
------------------------------*/
@media (max-width: 576px) {

    .main-content {
        padding: 12px 6px;
    }

    .app-card,
    .card {
        font-size: 0.9rem;
    }

    .table-responsive table {
        font-size: 0.8rem;
        width: 100%;
        table-layout: auto;
        word-wrap: break-word;
    }

    .app-card-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.5rem;
    }

    .app-card-header .btn,
    .d-flex .btn {
        width: 100%;
        justify-content: center;
    }

    .auth-wrapper {
        padding-top: 30px;
        padding-left: 10px;
        padding-right: 10px;
    }
}

/* -----------------------------
   DESKTOP (>=992px)
------------------------------*/
@media (min-width: 992px) {
    .sidebar {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 260px;
    }
}
