/* ============================================================
   CONFIGURACIÓN GENERAL
============================================================ */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    width: 100%;
    min-height: 100%;
}

body {
    width: 100%;
    min-height: 100vh;

    font-family: Arial, Helvetica, sans-serif;

    background: #ffffff;
    color: #222222;
}

button,
input,
select,
textarea {
    font-family: inherit;
}

button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}


/* ============================================================
   ESTRUCTURA PRINCIPAL
============================================================ */

.app {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.main-content {
    flex: 1;

    min-width: 0;
}


/* ============================================================
   BARRA LATERAL
============================================================ */

.sidebar {
    width: 220px;

    min-height: 100vh;

    flex-shrink: 0;

    padding: 24px 16px;

    border-right: 1px solid #e5e5e5;

    background: #ffffff;
}


/* ============================================================
   LOGO ARN4L2
============================================================ */

.logo {
    display: flex;

    align-items: flex-start;

    padding: 0 8px 30px 8px;
}

.logo img {
    display: block;

    width: 150px;
    max-width: 100%;

    height: auto;
}


/* ============================================================
   MENÚ
============================================================ */

.menu {
    display: flex;

    flex-direction: column;

    gap: 4px;
}

.menu-button {
    width: 100%;

    padding: 10px 12px;

    border: none;
    border-radius: 6px;

    background: transparent;

    color: #555555;

    text-align: left;

    font-size: 14px;
}

.menu-button:hover {
    background: #f5f5f5;

    color: #222222;
}

.menu-button.active {
    background: #f0f0f0;

    color: #111111;

    font-weight: 600;
}


/* ============================================================
   BARRA SUPERIOR
============================================================ */

.topbar {
    width: 100%;

    min-height: 72px;

    padding: 0 32px;

    display: flex;

    align-items: center;

    justify-content: space-between;

    border-bottom: 1px solid #e5e5e5;

    background: #ffffff;
}

.topbar-info {
    min-width: 0;
}

.topbar h1 {
    font-size: 20px;

    line-height: 1.2;

    font-weight: 600;

    color: #111111;
}

.topbar p {
    margin-top: 4px;

    font-size: 13px;

    color: #777777;
}


/* ============================================================
   PÁGINAS
============================================================ */

.page-section {
    display: none;
}

.page-section.active-section {
    display: block;
}


/* ============================================================
   DASHBOARD
============================================================ */

.dashboard {
    width: 100%;

    max-width: 1000px;

    margin: 0 auto;

    padding: 40px 32px;
}

.welcome h2 {
    font-size: 24px;

    font-weight: 600;

    color: #111111;
}

.welcome p {
    margin-top: 8px;

    color: #777777;

    font-size: 14px;
}


/* ============================================================
   ACCIONES
============================================================ */

.actions {
    display: flex;

    flex-wrap: wrap;

    gap: 10px;

    margin-top: 28px;
}


/* ============================================================
   BOTÓN PRINCIPAL
============================================================ */

.primary-button {
    border: none;

    background: #222222;

    color: #ffffff;

    padding: 10px 16px;

    border-radius: 6px;

    font-size: 14px;

    line-height: 1.2;

    transition:
        background 0.15s ease,
        opacity 0.15s ease;
}

.primary-button:hover {
    background: #444444;
}


/* ============================================================
   BOTÓN SECUNDARIO
============================================================ */

.secondary-button {
    border: 1px solid #dddddd;

    background: #ffffff;

    color: #333333;

    padding: 9px 12px;

    border-radius: 6px;

    font-size: 13px;

    line-height: 1.2;

    transition:
        background 0.15s ease,
        border-color 0.15s ease;
}

.secondary-button:hover {
    background: #f7f7f7;

    border-color: #cccccc;
}


/* ============================================================
   BOTÓN PELIGRO
============================================================ */

.danger-button {
    color: #666666;
}

.danger-button:hover {
    background: #fafafa;

    color: #222222;
}


/* ============================================================
   TARJETAS DE RESUMEN
============================================================ */

.summary {
    display: grid;

    grid-template-columns:
        repeat(3, minmax(0, 1fr));

    gap: 16px;

    margin-top: 32px;
}

.summary-card {
    padding: 20px;

    border: 1px solid #e5e5e5;

    border-radius: 8px;

    background: #ffffff;
}

.summary-card span {
    display: block;

    color: #777777;

    font-size: 13px;
}

.summary-card strong {
    display: block;

    margin-top: 10px;

    font-size: 24px;

    font-weight: 600;

    color: #111111;
}


/* ============================================================
   FORMULARIO GENERAL
============================================================ */

.form-container {
    width: 100%;

    max-width: 850px;

    margin: 0 auto;

    padding: 40px 32px;
}

.form-header {
    margin-bottom: 32px;
}

.form-header h2 {
    font-size: 22px;

    font-weight: 600;

    color: #111111;
}

.form-header p {
    margin-top: 8px;

    font-size: 14px;

    line-height: 1.5;

    color: #777777;
}

.form-section {
    padding: 28px 0;

    border-top: 1px solid #e5e5e5;
}

.form-section h3 {
    margin-bottom: 20px;

    font-size: 16px;

    font-weight: 600;

    color: #111111;
}

.form-description {
    margin-top: -8px;

    margin-bottom: 18px;

    color: #777777;

    font-size: 13px;

    line-height: 1.5;
}


/* ============================================================
   FILAS DE FORMULARIO
============================================================ */

.form-row {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 16px;
}


/* ============================================================
   GRUPOS DE FORMULARIO
============================================================ */

.form-group {
    display: flex;

    flex-direction: column;

    gap: 7px;

    margin-bottom: 18px;
}

.form-group label {
    font-size: 13px;

    color: #555555;
}


/* ============================================================
   INPUTS Y SELECTS
============================================================ */

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;

    border: 1px solid #dcdcdc;

    border-radius: 6px;

    background: #ffffff;

    color: #222222;

    font-size: 14px;

    outline: none;

    transition:
        border-color 0.15s ease,
        background 0.15s ease;
}

.form-group input,
.form-group select {
    height: 40px;

    padding: 0 12px;
}

.form-group textarea {
    min-height: 90px;

    padding: 10px 12px;

    resize: vertical;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #999999;
}

.form-group input[readonly] {
    background: #f7f7f7;

    color: #777777;
}


/* ============================================================
   FECHAS DE SERVICIO
============================================================ */

#service-dates {
    width: 100%;
}

.service-date {
    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        auto;

    gap: 10px;

    align-items: center;

    margin-bottom: 12px;
}

.service-date input {
    width: 100%;

    height: 40px;

    padding: 0 12px;

    border: 1px solid #dcdcdc;

    border-radius: 6px;

    background: #ffffff;

    color: #222222;

    font-size: 14px;

    outline: none;
}

.service-date input:focus {
    border-color: #999999;
}


/* ============================================================
   BOTÓN ELIMINAR FECHA
============================================================ */

.remove-date {
    height: 40px;

    padding: 0 12px;

    border: 1px solid #dddddd;

    border-radius: 6px;

    background: #ffffff;

    color: #666666;

    font-size: 13px;

    white-space: nowrap;
}

.remove-date:hover {
    background: #f5f5f5;
}


/* ============================================================
   VALOR POR FECHA
============================================================ */

.value-per-date {
    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 20px;

    margin-top: 4px;
}

.value-per-date span {
    color: #555555;

    font-size: 14px;
}

.value-per-date strong {
    color: #222222;

    font-size: 16px;

    font-weight: 600;
}


/* ============================================================
   TOTAL
============================================================ */

.total-box {
    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 20px;

    padding: 20px 0;

    border-top: 1px solid #e5e5e5;

    border-bottom: 1px solid #e5e5e5;
}

.total-box span {
    font-size: 14px;

    color: #555555;
}

.total-box strong {
    font-size: 22px;

    font-weight: 600;

    color: #111111;

    text-align: right;
}


/* ============================================================
   ACCIONES DEL FORMULARIO
============================================================ */

.form-actions {
    display: flex;

    align-items: center;

    justify-content: flex-end;

    flex-wrap: wrap;

    gap: 10px;

    padding-top: 24px;
}

.form-actions button {
    min-height: 40px;
}


/* ============================================================
   PÁGINAS SIMPLES
============================================================ */

.simple-page {
    width: 100%;

    max-width: 1000px;

    margin: 0 auto;

    padding: 40px 32px;
}


/* ============================================================
   CLIENTES - BARRA DE HERRAMIENTAS
============================================================ */

.client-toolbar {
    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 16px;

    margin-top: 24px;

    margin-bottom: 24px;
}

.search-box {
    flex: 1;

    max-width: 420px;
}

.search-box input {
    width: 100%;

    height: 40px;

    padding: 0 12px;

    border: 1px solid #dcdcdc;

    border-radius: 6px;

    background: #ffffff;

    color: #222222;

    font-size: 14px;

    outline: none;
}

.search-box input:focus {
    border-color: #999999;
}

.client-actions {
    display: flex;

    align-items: center;

    gap: 8px;

    flex-shrink: 0;
}


/* ============================================================
   LISTA DE CLIENTES
============================================================ */

.clientes-lista {
    display: flex;

    flex-direction: column;

    gap: 10px;

    width: 100%;
}

.cliente-card {
    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 20px;

    width: 100%;

    padding: 16px;

    border: 1px solid #e5e5e5;

    border-radius: 8px;

    background: #ffffff;
}

.cliente-card-info {
    display: flex;

    align-items: flex-start;

    flex-direction: column;

    gap: 5px;

    min-width: 0;
}

.cliente-card-info strong {
    color: #222222;

    font-size: 14px;

    font-weight: 600;

    word-break: break-word;
}

.cliente-card-info span {
    color: #777777;

    font-size: 13px;

    word-break: break-word;
}

.cliente-card-actions {
    display: flex;

    align-items: center;

    gap: 8px;

    flex-shrink: 0;
}


/* ============================================================
   BADGES DE CONTACTO
============================================================ */

.contact-badge {
    display: inline-flex;

    align-items: center;

    width: fit-content;

    padding: 3px 7px;

    border: 1px solid #dddddd;

    border-radius: 4px;

    background: #fafafa;

    color: #555555 !important;

    font-size: 11px !important;

    font-weight: 600;
}

.contact-badge.empty {
    color: #999999 !important;
}


/* ============================================================
   ESTADO VACÍO
============================================================ */

.empty-clientes,
.empty-state {
    padding: 40px 20px;

    border: 1px dashed #dddddd;

    border-radius: 8px;

    background: #ffffff;

    text-align: center;

    color: #777777;

    font-size: 14px;
}

.empty-state {
    margin-top: 20px;
}


/* ============================================================
   MODAL
============================================================ */

.modal {
    position: fixed;

    inset: 0;

    z-index: 1000;

    display: none;

    align-items: center;

    justify-content: center;

    padding: 20px;

    background: rgba(0, 0, 0, 0.25);
}

.modal.show {
    display: flex;
}

.modal-content {
    width: 100%;

    max-width: 650px;

    max-height: calc(100vh - 40px);

    overflow-y: auto;

    padding: 28px;

    border: 1px solid #e5e5e5;

    border-radius: 10px;

    background: #ffffff;

    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.08);
}


/* ============================================================
   ENCABEZADO MODAL
============================================================ */

.modal-header {
    display: flex;

    align-items: flex-start;

    justify-content: space-between;

    gap: 20px;

    margin-bottom: 26px;
}

.modal-header h2 {
    font-size: 20px;

    font-weight: 600;

    color: #111111;
}

.modal-header p {
    margin-top: 6px;

    color: #777777;

    font-size: 13px;
}


/* ============================================================
   CERRAR MODAL
============================================================ */

.modal-close {
    width: 32px;

    height: 32px;

    flex-shrink: 0;

    border: none;

    border-radius: 6px;

    background: transparent;

    color: #666666;

    font-size: 24px;

    line-height: 1;
}

.modal-close:hover {
    background: #f5f5f5;

    color: #222222;
}


/* ============================================================
   ACCIONES MODAL
============================================================ */

.modal-actions {
    display: flex;

    align-items: center;

    justify-content: flex-end;

    gap: 10px;

    padding-top: 10px;
}


/* ============================================================
   ACCESIBILIDAD
============================================================ */

.sr-only {
    position: absolute;

    width: 1px;

    height: 1px;

    padding: 0;

    margin: -1px;

    overflow: hidden;

    clip: rect(0, 0, 0, 0);

    white-space: nowrap;

    border: 0;
}


/* ============================================================
   RESPONSIVE - TABLET
============================================================ */

@media (max-width: 768px) {

    .sidebar {
        width: 180px;

        padding: 20px 12px;
    }

    .logo img {
        width: 130px;
    }

    .topbar {
        padding: 0 24px;
    }

    .dashboard {
        padding: 32px 24px;
    }

    .form-container {
        padding: 32px 24px;
    }

    .simple-page {
        padding: 32px 24px;
    }

    .summary {
        grid-template-columns: 1fr;
    }

    .client-toolbar {
        align-items: stretch;

        flex-direction: column;
    }

    .search-box {
        max-width: none;
    }

    .client-actions {
        width: 100%;
    }

    .client-actions button {
        flex: 1;
    }
}


/* ============================================================
   RESPONSIVE - CELULAR
============================================================ */

@media (max-width: 600px) {

    .app {
        display: block;

        min-height: 100vh;
    }


    /* SIDEBAR */

    .sidebar {
        width: 100%;

        min-height: auto;

        padding: 12px;

        border-right: none;

        border-bottom: 1px solid #e5e5e5;
    }


    /* LOGO */

    .logo {
        justify-content: center;

        align-items: center;

        padding: 8px 8px 14px 8px;
    }

    .logo img {
        width: 130px;

        max-width: 70%;
    }


    /* MENÚ */

    .menu {
        flex-direction: row;

        gap: 4px;

        overflow-x: auto;

        padding-bottom: 2px;
    }

    .menu-button {
        width: auto;

        flex: 0 0 auto;

        white-space: nowrap;

        text-align: center;
    }


    /* TOPBAR */

    .topbar {
        min-height: auto;

        padding: 18px 16px;

        align-items: flex-start;

        flex-direction: column;
    }

    .topbar h1 {
        font-size: 19px;
    }


    /* DASHBOARD */

    .dashboard {
        padding: 24px 16px;
    }

    .welcome h2 {
        font-size: 21px;
    }


    /* FORMULARIO */

    .form-container {
        padding: 24px 16px;
    }

    .form-header {
        margin-bottom: 24px;
    }

    .form-header h2 {
        font-size: 21px;
    }

    .form-row {
        grid-template-columns: 1fr;

        gap: 0;
    }


    /* FECHAS */

    .service-date {
        grid-template-columns: 1fr;

        gap: 8px;

        padding-bottom: 14px;

        border-bottom: 1px solid #eeeeee;
    }

    .remove-date {
        width: 100%;
    }


    /* VALOR */

    .value-per-date {
        align-items: flex-start;

        flex-direction: column;

        gap: 5px;
    }


    /* TOTAL */

    .total-box {
        align-items: flex-start;

        flex-direction: column;

        gap: 8px;
    }

    .total-box strong {
        font-size: 21px;

        text-align: left;
    }


    /* BOTONES */

    .actions {
        flex-direction: column;
    }

    .actions button {
        width: 100%;
    }

    .form-actions {
        flex-direction: column-reverse;

        align-items: stretch;
    }

    .form-actions button {
        width: 100%;
    }


    /* CLIENTES */

    .simple-page {
        padding: 24px 16px;
    }

    .client-actions {
        flex-direction: column;
    }

    .client-actions button {
        width: 100%;
    }

    .cliente-card {
        align-items: stretch;

        flex-direction: column;

        gap: 14px;
    }

    .cliente-card-actions {
        width: 100%;
    }

    .cliente-card-actions button {
        flex: 1;
    }


    /* MODAL */

    .modal {
        align-items: flex-end;

        padding: 0;
    }

    .modal-content {
        max-width: none;

        max-height: 92vh;

        padding: 22px 16px;

        border-radius: 10px 10px 0 0;
    }

    .modal-header {
        margin-bottom: 20px;
    }

    .modal-actions {
        flex-direction: column-reverse;

        align-items: stretch;
    }

    .modal-actions button {
        width: 100%;
    }
}


/* ============================================================
   PANTALLAS MUY PEQUEÑAS
============================================================ */

@media (max-width: 380px) {

    .dashboard,
    .form-container,
    .simple-page {
        padding-left: 12px;

        padding-right: 12px;
    }

    .topbar {
        padding-left: 12px;

        padding-right: 12px;
    }

    .sidebar {
        padding-left: 8px;

        padding-right: 8px;
    }

    .logo img {
        width: 120px;
    }

    .modal-content {
        padding-left: 14px;

        padding-right: 14px;
    }
}

/* ==========================================================
   HISTORIAL
========================================================== */

.historial-toolbar{

    margin-bottom:20px;

}

.historial-toolbar input{

    width:100%;

    padding:12px;

    border:1px solid #dcdcdc;

    border-radius:10px;

}

.historial-lista{

    display:flex;

    flex-direction:column;

    gap:12px;

}

.historial-card{

    background:#ffffff;

    border:1px solid #e5e7eb;

    border-radius:12px;

    padding:16px;

    display:flex;

    align-items:center;

    gap:20px;

    flex-wrap:wrap;

}

.historial-numero{

    font-weight:700;

}

.historial-cliente{

    font-weight:600;

}

.historial-total{

    margin-left:auto;

    font-weight:700;

}

.historial-fecha{

    color:#6b7280;

}

.logo-option{

    display:flex;

    justify-content:flex-end;

    margin-bottom:10px;

}

.logo-option label{

    display:flex;

    align-items:center;

    gap:6px;

    font-size:13px;

    color:#777;

}

#login-container {

    position: fixed;

    inset:0;

    display:flex;

    justify-content:center;

    align-items:center;

    background:#f4f6f9;

}


.login-box {

    width:380px;

    padding:45px;

    background:white;

    border-radius:18px;

    box-shadow:
        0 15px 40px rgba(0,0,0,.15);

}


.login-box h2 {

    text-align:center;

    font-size:30px;

    margin-bottom:40px;

}


.login-box h2 small {

    display:block;

    font-size:14px;

    font-weight:400;

    margin-top:8px;

    color:#777;

}


.login-box label {

    display:block;

    text-align:left;

    margin-bottom:8px;

    font-weight:600;

}


.login-box input {

    width:100%;

    height:45px;

    margin-bottom:25px;

    padding:0 12px;

    font-size:16px;

    border-radius:8px;

    border:1px solid #ccc;

    box-sizing:border-box;

}


.login-box button {

    width:100%;

    height:45px;

    margin-top:12px;

    border-radius:8px;

    border:none;

    cursor:pointer;

    font-size:16px;

}


.login-box button:first-of-type {

    background:#4f46e5;

    color:white;

}


.login-box button:last-of-type {

    background:#e5e7eb;

}

/* ============================================================
   CONTROL DE ACCESO
============================================================ */

#app-container {
    display:none;
}

#login-container {
    display:flex;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}


#logout-button {
    border: 1px solid #dddddd;
    background: #ffffff;
    color: #333333;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
}


#logout-button:hover {
    background: #f5f5f5;
}

/* ============================================================
   LOGIN
============================================================ */

.login-link{
    margin-top:15px;
    text-align:center;
}

.login-link a{
    color:#555555;
    font-size:14px;
    text-decoration:none;
    transition:0.2s;
}

.login-link a:hover{
    color:#111111;
    text-decoration:underline;
}

/* ============================================================
   LOGIN FLOTANTE
   ============================================================ */

#login-overlay {
    position: fixed;
    inset: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    background: rgba(100, 100, 100, 0.55);

    z-index: 99999;
}


.login-modal {
    width: 320px;

    background: #ffffff;

    border: 1px solid #999999;
    border-radius: 6px;

    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);

    font-family: Arial, sans-serif;
}


.login-modal-title {
    padding: 12px 16px;

    font-size: 14px;
    font-weight: bold;

    border-bottom: 1px solid #dddddd;
}


.login-modal-content {
    padding: 20px;
}


.login-modal label {
    display: block;

    margin-bottom: 5px;

    font-size: 13px;
}


.login-modal input {
    width: 100%;

    box-sizing: border-box;

    padding: 7px 8px;

    margin-bottom: 14px;

    border: 1px solid #999999;
    border-radius: 3px;
}


.login-error {
    min-height: 18px;

    margin-bottom: 8px;

    font-size: 12px;

    color: #b00020;
}


.login-actions {
    display: flex;

    justify-content: flex-end;

    gap: 8px;

    margin-top: 8px;
}


.login-actions button {
    min-width: 70px;

    padding: 7px 14px;

    cursor: pointer;
}

/* ============================================================
   PANTALLA DE LOGIN
   ============================================================ */

#login-container {
    position: fixed;
    inset: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    background: #808080;

    z-index: 9999;
}


/* Ventana tipo alerta */

.login-box {
    width: 320px;

    padding: 20px;

    background: white;

    border: 1px solid #555;
    border-radius: 4px;

    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.35);
}


.login-box h2 {
    margin: 0 0 20px;

    font-size: 16px;
}


.login-box h2 small {
    display: block;

    margin-top: 4px;

    font-size: 11px;
    font-weight: normal;
}


.login-box label {
    display: block;

    margin: 12px 0 5px;

    font-size: 13px;
}


.login-box input {
    width: 100%;

    box-sizing: border-box;

    padding: 7px;

    border: 1px solid #888;
}


.login-box button {
    margin-top: 15px;
}

/* ==========================================================
   LOGIN TIPO ALERTA
   ========================================================== */

#login-container {
    position: fixed;
    inset: 0;
    z-index: 99999;

    display: flex;
    justify-content: center;
    align-items: flex-start;

    padding-top: 40px;

    background: #ffffff;
}

#login-box {
    width: 448px;
    padding: 20px 16px 16px;

    background: #292a2f;

    color: #ffffff;

    box-sizing: border-box;

    box-shadow:
        0 3px 8px rgba(0, 0, 0, 0.45);
}

.login-title {
    margin-bottom: 42px;

    font-family: Arial, sans-serif;
    font-size: 14px;
    font-weight: 400;
}

.login-row {
    display: grid;

    grid-template-columns: 70px 1fr;

    align-items: center;

    margin-bottom: 14px;
}

.login-row label {
    font-family: Arial, sans-serif;
    font-size: 12px;

    color: #ffffff;
}

.login-row input {
    width: 100%;
    height: 33px;

    padding: 5px 8px;

    box-sizing: border-box;

    background: #1d1e22;

    color: #ffffff;

    border: 1px solid #44474f;

    outline: none;

    font-size: 14px;
}

.login-row input:focus {
    border-color: #6d9ee8;

    box-shadow:
        0 0 0 1px #6d9ee8;
}

.login-buttons {
    display: flex;

    justify-content: flex-end;

    gap: 8px;

    margin-top: 24px;
}

.login-buttons button {
    height: 32px;

    padding: 0 17px;

    border-radius: 3px;

    border: 1px solid #44474f;

    background: #292a2f;

    color: #ffffff;

    cursor: pointer;

    font-size: 12px;
}

#login-button {
    background: #6d9ee8;

    color: #172033;

    border-color: #6d9ee8;
}

#login-mensaje {
    min-height: 16px;

    margin-left: 70px;

    color: #ff8a8a;

    font-family: Arial, sans-serif;
    font-size: 11px;
}