@import url('https://fonts.googleapis.com/css2?family=Red+Rose:wght@400;700&display=swap');

/* ===== ESTILOS GENERALES ===== */

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background-color: #f5f9ff;
}

/* ===== TOPBAR (HEADER) ===== */

.topbar {
    background-color: #15A3DD;
    color: white;
    padding: 0 30px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo {
    font-weight: bold;
    font-size: 20px;
}

.menu {
    display: flex;
    gap: 15px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ===== FOOTER ===== */

.footer-bar {
    background-color: #15A3DD;
    height: 16px;
    margin-top: 20px;
}

/* ===== CONTENIDO GENERAL ===== */

.page-container {
    padding: 20px 40px 40px 40px;
    flex: 1 0 auto;
}

.page-title {
    font-size: 22px;
    font-weight: bold;
    margin-bottom: 10px;
}


.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.btn-primary-icon {
    margin-left: 8px;
    font-weight: bold;
}

/* ===== BUSCADOR ===== */

.search-box {
    display: flex;
    align-items: center;
    gap: 5px;
}

.search-box input {
    padding: 6px 10px;
    border-radius: 6px;
    min-width: 220px;
}

.search-box button {
    background-color: #15A3DD;
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid #ffffff;
}

/* ===== MENSAJES ===== */

.alert-error {
    background-color: #ffe5e5;
    color: #a30000;
    border: 1px solid #ffb3b3;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 13px;
    margin-bottom: 10px;
}

.alert-success {
    background-color: #e3f8e3;
    color: #136c13;
    border: 1px solid #9ede9e;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 13px;
    margin-bottom: 10px;
}

/* ===== TABLAS ===== */

.table-container {
    margin-top: 10px;
    border-radius: 4px;
    background-color: rgba(21, 163, 221, 0.22);
    padding: 0 0 10px 0;
    min-height: 360px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

.table-toolbar {
    background-color: #15A3DD;
    padding: 6px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 4px 4px 0 0;
    border-bottom: 4px solid #e5f5ff;
}

.btn-primary {
    background-color: #15A3DD;
    color: white;
    border: 1px solid #ffffff;
    padding: 8px 16px;
    border-radius: 3px;
    cursor: pointer;
    font-weight: 500;
}

thead {
    color: #000000;
}

thead th {
    padding: 8px 10px;
    font-size: 14px;
    border-bottom: 4px solid #e5f5ff;
}

thead th + th {
    border-left: 2px solid #e5f5ff;
}

tbody tr {
    background-color: #72c7f4;
}

th, td {
    padding: 8px 10px;
    text-align: left;
    font-size: 14px;
}

tbody tr + tr {
    border-top: 4px solid #e5f5ff;
}

tbody tr td {
    box-shadow: 0 0 0 1px #e5f5ff;
}

tbody tr td:first-child {
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
}

tbody tr td:last-child {
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
}

tbody tr:nth-child(even),
tbody tr:nth-child(odd) {
    background-color: #71C7EB;
}

.status-activo {
    color: #006400;
    font-weight: 600;
}

/* ===== MODAL GENÉRICO ===== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.3);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.show {
    display: flex;
}

.modal-card {
    background-color: #ffffff;
    border-radius: 8px;
    padding: 20px 30px 25px 30px;
    min-width: 420px;
    max-width: 540px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.modal-title {
    font-size: 18px;
    font-weight: bold;
}

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
}

.modal-form-row {
    display: flex;
    gap: 12px;
    margin-bottom: 10px;
}

.modal-form-group {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.modal-form-group label {
    font-size: 13px;
    margin-bottom: 3px;
    font-weight: 600;
}

.modal-form-group input[type="text"],
.modal-form-group input[type="email"],
.modal-form-group textarea,
.modal-form-group select {
    padding: 6px 8px;
    border-radius: 4px;
    border: 1px solid #c0c0c0;
    font-size: 13px;
}

.modal-form-group textarea {
    resize: vertical;
    min-height: 70px;
}

.modal-actions {
    margin-top: 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.modal-btn-primary {
    width: 100%;
    background-color: #15A3DD;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
}

.modal-btn-cancel {
    background: none;
    border: none;
    color: #ff4d4d;
    font-size: 13px;
    cursor: pointer;
}

.modal-id-row {
    align-items: center;
    margin-top: 10px;
    margin-bottom: 8px;
}

.modal-id-label {
    font-size: 13px;
    font-weight: 600;
    margin-right: 8px;
}

.modal-id-value {
    font-size: 13px;
}

/* ===== BOTÓN ACCIONES / MENÚ DESPLEGABLE ===== */

.acciones-wrapper {
    position: relative;
    display: inline-block;
}

.acciones-menu {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 130px;
    background-color: #ffffff;
    border-radius: 3px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    padding: 4px 0;
    margin-top: 4px;
    z-index: 9999;
    display: none;
}

.acciones-menu.show {
    display: block;
}

.acciones-item {
    width: 100%;
    text-align: left;
    padding: 6px 12px;
    font-size: 12px;
    background-color: transparent;
    border: none;
    cursor: pointer;
}

.acciones-item:hover {
    background-color: #e6f4ff;
}

.acciones-item-danger {
    color: #c0392b;
}

.acciones-item-danger:hover {
    background-color: #fdecea;
}

/* ===== LOGO ===== */

.logo {
    display: flex;
    align-items: center;
}

.logo img {
    height: 250px;
    display: block;
}

/* ===== MENÚ USUARIO HEADER ===== */

.user-menu {
    position: relative;
    display: inline-block;
}

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(58deg, #006fa3, #005081);
    color: #ffffff;
    border: none;
    height: 34px;
    padding: 0 16px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
}

.user-menu-btn:hover {
    background: linear-gradient(58deg, #007fbd, #00446d);
}

.user-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
}

.user-label {
    font-family: 'Red Rose', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: 700;
    font-size: 20px;
    white-space: nowrap;
}
.user-arrow {
    font-size: 20px;
    line-height: 1;
    display: flex;
    align-items: center;
}

.user-menu-dropdown {
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 4px;
    min-width: 160px;
    background-color: #ffffff;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
    padding: 4px 0;
    z-index: 9999;
    display: none;
}

.user-menu-dropdown.show {
    display: block;
}

.user-menu-dropdown a,
.user-menu-dropdown button {
    display: block;
    width: 100%;
    padding: 7px 12px;
    font-size: 13px;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: none;
    color: #333333;
}

.user-menu-dropdown a:hover,
.user-menu-dropdown button:hover {
    background-color: #e6f4ff;
}

.user-menu-dropdown button {
    text-align: left;
}

.user-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 0;
    overflow: visible;
    padding: 0;
}

.user-icon img {
    width: 24px;
    height: 24px;
    display: block;
}

/* ===== FOOTER ===== */

.footer-bar {
    background-color: #15A3DD;
    height: 22px;
    margin-top: 20px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 20px;
    font-size: 10px;
    color: #ffffff;
}

.footer-content {
    display: flex;
    align-items: center;
    gap: 4px;
}

.footer-icon {
    font-size: 11px;
}

.footer-text {
    letter-spacing: 0.5px;
}

html, body {
    height: 100%;
}

.app-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.footer-bar {
    flex-shrink: 0;
    background-color: #15A3DD;
    height: 22px;
    margin-top: 20px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 20px;
    font-size: 10px;
    color: #ffffff;
}

.menu {
    display: flex;
    gap: 15px;
}

.menu-link {
    color: #ffffff;
    text-decoration: none;
    font-weight: 500;
    font-size: 16px;
}

.topbar .menu .menu-link.menu-link--active {
    color: #000000 !important;
    font-weight: 700;
}
.menu-link--active {
    color: #000000;
    font-weight: 700;
}

/* ========================================================= */
/* =========== ESTILOS: SUBMENÚ ALMACÉN (clic) ============ */
/* ========================================================= */

.menu-item-almacen{
    position: relative;
    display: inline-flex;
    align-items: center;
}

/* Botón caret que abre/cierra el menú (sin romper el link) */
.submenu-toggle{
    background: transparent;
    border: none;
    color: #ffffff;
    cursor: pointer;
    margin-left: 6px;
    font-size: 14px;
    line-height: 1;
    padding: 2px 4px;
}

/* Caja blanca del submenú, alineada con el enlace */
.submenu-almacen{
    position: absolute;
    left: 0;
    top: calc(100% + 10px);
    display: none;

    /* ancho según contenido real */
    width: max-content;
    min-width: 0;          /* asegura que no haya mínimo heredado */
    max-width: none;       /* no lo limites */

    background: #ffffff;
    border-radius: 10px;
    padding: 12px 16px;
    box-shadow: 0 10px 25px rgba(0,0,0,.15);
    z-index: 2000;

    white-space: nowrap;   /* evita salto de línea */
}

.submenu-almacen::before{
    content: "";
    position: absolute;
    top: -8px; left: 16px;
    width: 16px; height: 16px;
    background: #ffffff;
    transform: rotate(45deg);
    box-shadow: -2px -2px 3px rgba(0,0,0,.03);
}

/* Mostrar cuando el contenedor está en estado abierto */
.menu-item-almacen.is-open .submenu-almacen{
    display: block;
}

/* Links internos: #15A3DD y bold, como pediste */
.submenu-link{
    display: block;
    color: #15A3DD;
    font-weight: 700;
    padding: 8px 4px;
    border-radius: 6px;
    white-space: nowrap;
    font-size: 15px;
}
.submenu-link:hover{
    background: #f4f9ff;
}

.cliente-estado-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 10px;
    border-radius: 8px;
    background: #e0e0e0;
}

.cliente-estado-wrapper.activo {
    background: #d8f5e3;
}

.cliente-detalle-card {
    background: #ffffff;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 30px;
}

.cliente-detalle-row {
    display: flex;
    gap: 40px;
    margin-bottom: 16px;
}

.cliente-detalle-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cliente-detalle-group input {
    width: 100%;
}

.cliente-historial-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.btn-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 10px;
    border-radius: 10px;
    background: #71c7eb;
    text-decoration: none;
    font-weight: 600;
}

.btn-acciones {
    background-color: #008fd6;
    color: #ffffff;
    border: none;
    border-radius: 3px;
    padding: 4px 12px;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 999px;
    border: 1px solid #000;
    text-decoration: none;
}

.cliente-estado-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 10px;
    border-radius: 8px;
    background: #e0e0e0;
}

.page-header-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.cliente-detalle-card {
    background: #ffffff;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 30px;
}

.cliente-detalle-row {
    display: flex;
    gap: 40px;
    margin-bottom: 16px;
}

.cliente-detalle-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cliente-detalle-group input {
    width: 100%;
}

.cliente-historial-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.btn-acciones-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin: 0;
    border-radius: 50%;
    border: none;
    background: #15A3DD;
    color: #ffffff;
    line-height: 0;
    font-size: 0;
    cursor: pointer;
    padding: 5px;
}

/* Botón volver */
.perfil-back-btn{
    width: 30px;
    height: 30px;
    border: 1px solid #2c2c2c;
    background: #ffffff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Tarjeta */
.perfil-card{
    width: 520px;
    background: #ffffff;
    border: 1px solid #7b7b7b;
    border-radius: 10px;
    padding: 18px 18px 20px 18px;
    box-sizing: border-box;
}

.perfil-card-header{
    position: relative;
    padding-bottom: 8px;
}

.perfil-page{
    min-height: calc(100vh - 64px - 22px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    box-sizing: border-box;
}
.perfil-shell{
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.perfil-close-btn{
    position: absolute;
    right: 2px;
    top: -2px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
}

.perfil-title{
    margin: 0;
    text-align: center;
    font-size: 14px;
    font-weight: 700;
}

.perfil-fields{
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
}

.perfil-input{
    width: 260px;
    height: 28px;
    border: 1px solid #a0a0a0;
    border-radius: 6px;
    padding: 0 10px;
    font-size: 12px;
    box-sizing: border-box;
}

.perfil-input:disabled{
    background: #f7f7f7;
    color: #666666;
}

.perfil-save-btn{
    width: 240px;
    background-color: #15A3DD;
    color: #ffffff;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 700;
    font-size: 12px;
}

.perfil-actions{
    margin-top: 18px;
    display: flex;
    justify-content: center;
}

/* =========================
   HEADER RESPONSIVE MENU
   ========================= */

/* Botón hamburguesa (oculto en desktop) */
.menu-mobile-toggle{
    display: none;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,.6);
    background: rgba(255,255,255,.12);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

/* Desktop mantiene comportamiento normal */
@media (min-width: 901px){
    .menu { display: flex; }
}

/* ===== Mobile / Tablet ===== */
@media (max-width: 900px){

    .topbar{
        flex-wrap: wrap;
        align-items: center;
        gap: 10px;
        padding: 10px 12px;
    }

    .topbar-left{
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
    }

    .menu-mobile-toggle{
        display: inline-flex;
    }

    /* usuario abajo o a la derecha según tu layout */
    .topbar-right{
        width: 100%;
        display: flex;
        justify-content: flex-end;
    }

    /* Menú colapsable */
    .menu{
        width: 100%;
        display: none; /* cerrado por defecto */
        margin-top: 8px;
        padding: 10px;
        border-radius: 12px;
        background: rgba(255,255,255,0.10);
        border: 1px solid rgba(255,255,255,0.18);
        box-sizing: border-box;

        /* grilla de "cuadritos" */
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .menu.menu--open{
        display: grid;
    }

    /* Links como cards */
    .menu .menu-link{
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;

        padding: 10px 10px;
        border-radius: 10px;
        background: rgba(255,255,255,0.92);
        border: 1px solid rgba(21,163,221,0.35);
        color: #0b4a63;
        font-weight: 700;
        font-size: 13px;
        line-height: 1.1;
        white-space: normal;     /* permite 2 líneas */
        word-break: break-word;  /* evita que se corte */
        min-height: 42px;
    }

    .menu .menu-link:hover{
        filter: brightness(.98);
    }

    .menu .menu-link.menu-link--active{
        outline: 2px solid rgba(21,163,221,0.65);
        background: #e4f2f9;
    }

    /* contenedores con submenú se ven como card también */
    .menu .menu-item-almacen{
        position: relative;
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    /* cuando el menú está en grilla, el item con submenú ocupa una celda */
    .menu .menu-item-almacen > .menu-link{
        width: 100%;
    }

    /* Submenú como cajita debajo (cuando el contenedor está open por tu JS) */
    .menu .submenu-almacen{
        position: static;      /* importante en móvil */
        display: none;
        padding: 8px;
        border-radius: 10px;
        background: rgba(255,255,255,0.92);
        border: 1px solid rgba(21,163,221,0.25);
        box-shadow: none;
    }

    .menu .menu-item-almacen.is-open .submenu-almacen{
        display: grid;
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .menu .submenu-almacen .submenu-link{
        display: block;
        padding: 9px 10px;
        border-radius: 10px;
        background: #f6fbfe;
        border: 1px solid rgba(21,163,221,0.18);
        color: #0b4a63;
        font-weight: 700;
        font-size: 13px;
        text-decoration: none;
    }

    .menu .submenu-almacen .submenu-link:hover{
        background: #e7f6ff;
    }
}

/* Extra: en pantallas muy pequeñas, 1 columna */
@media (max-width: 520px){
    .menu{
        grid-template-columns: 1fr;
    }
}