:root {
    --vino: #7a1b4d;
    --gris: #475569;
    --bg: #f4f7f6;
}

body {
    font-family: sans-serif;
    margin: 0;
    background: #2d1a2d;
}

body .hidden, 
section.hidden,
#admin-panel.hidden {
    display: none !important;
}

/* INTERFAZ DE LOGEO */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

.login-box {
    background: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    width: 320px;
}

.password-wrapper {
    position: relative;
    width: 90%;
    margin: 15px auto;
}

.password-wrapper input {
    width: 100%;
    padding: 10px;
    padding-right: 40px;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
}

.password-wrapper i {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--gris);
}

.btn-ingreso {
    width: 100%;
    padding: 12px;
    background: var(--vino);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    margin-top: 10px;
}

/* MAQUETACIÓN DEL PANEL */
.admin-panel {
    max-width: 600px;
    margin: 20px auto;
    background: white;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.panel-header {
    text-align: center;
    border-bottom: 2px solid var(--vino);
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.logo-admin {
    width: 140px;
}

.slogan {
    font-size: 11px;
    color: var(--vino);
    margin: 5px 0;
}

.panel-header h1 {
    font-size: 18px;
    color: var(--vino);
    margin: 5px 0;
}

.info-text {
    font-size: 11px;
    margin: 2px 0;
}

.highlight-text {
    font-size: 12px;
    font-weight: bold;
    color: #1e293b;
    margin-top: 5px;
}

.btn-logout {
    background: var(--gris);
    color: white;
    border: none;
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    margin-top: 10px;
}

/* CUADRÍCULA DE DATOS */
.client-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
}

.field {
    display: flex;
    flex-direction: column;
}

.field.full-width {
    grid-column: span 2;
}

.field label {
    font-size: 11px;
    font-weight: bold;
    color: var(--vino);
    margin-bottom: 2px;
}

.field input {
    border: none;
    border-bottom: 1px solid #ccc;
    padding: 5px;
    font-size: 13px;
    background: transparent;
}

.client-grid .field .input-important {
    color: #d90429;
    font-weight: bold;
    font-size: 16px;
}

/* TABLA DINÁMICA */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 12px;
}

th {
    background: var(--vino);
    color: white;
    padding: 8px;
    font-size: 11px;
}

td {
    border: 1px solid #eee;
    padding: 5px;
}

td input {
    width: 95%;
    border: 1px solid #ddd;
    padding: 4px;
    box-sizing: border-box;
}

.btn-add {
    margin-top: 10px;
    background: var(--gris);
    color: white;
    border: none;
    padding: 8px;
    border-radius: 5px;
    cursor: pointer;
    width: 100%;
    font-size: 12px;
}

/* RESUMEN DE SALDOS */
.resumen-container {
    border: 2px solid var(--vino);
    border-radius: 8px;
    margin: 15px 0;
    padding: 10px;
    display: flex;
    justify-content: space-around;
    text-align: center;
}

.resumen-item label {
    display: block;
    font-size: 11px;
    font-weight: bold;
    color: var(--vino);
}

.resumen-item input {
    width: 80px;
    text-align: center;
    border: 1px solid #ccc;
}

.resumen-item span {
    font-size: 18px;
    font-weight: bold;
    color: var(--vino);
}

.btn-print {
    width: 100%;
    padding: 18px;
    background: var(--vino);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
}

/* ALERTAS EN PANTALLA */
.client-grid .field input[type="date"]#fecha-entrega.alerta-verde {
    background: #4caf50;
    color: #ffffff;
    border: 1px solid #388e3c;
    border-radius: 4px;
    padding: 5px;
    font-weight: bold;
}
.client-grid .field input[type="date"]#fecha-entrega.alerta-amarillo {
    background: #ffeb3b;
    color: #000000;
    border: 1px solid #fbc02d;
    border-radius: 4px;
    padding: 5px;
    font-weight: bold;
}
.client-grid .field input[type="date"]#fecha-entrega.alerta-rojo {
    background: #f44336;
    color: #ffffff;
    border: 1px solid #d32f2f;
    border-radius: 4px;
    padding: 5px;
    font-weight: bold;
}

/* BÚSQUEDA HISTÓRICA */
.search-container { margin-top: 30px; padding-top: 10px; }
.separator { border: 0; border-top: 2px dashed #ccc; margin-bottom: 20px; }
.search-container h2 { font-size: 16px; color: var(--vino); margin-bottom: 12px; }
.search-box input { width: 96%; padding: 10px; border: 1px solid #ccc; border-radius: 6px; font-size: 13px; margin-bottom: 15px; }
.results-container { max-height: 250px; overflow-y: auto; }
.search-item-card { background: #fdfdfd; border: 1px solid #e2e8f0; border-radius: 6px; padding: 10px; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; cursor: pointer; }
.search-item-info p { margin: 2px 0; font-size: 12px; }
.search-item-status { text-align: right; font-weight: bold; color: var(--vino); font-size: 13px; }

/* VISIBILIDAD DE IMPRESIÓN INTERNA */
.print-only-block, .print-text-cell {
    display: none;
}

/* PIE DE PÁGINA REQUERIDO */
.ticket-footer {
    text-align: center;
    margin-top: 15px;
    font-family: sans-serif;
}
.separator-line {
    margin: 5px 0;
    letter-spacing: 2px;
}
.footer-legal {
    font-size: 11px;
    font-weight: bold;
    color: #000;
    line-height: 1.4;
    margin: 5px 0 0 0;
}

/* ======================================================== */
/* CONFIGURACIÓN EXCLUSIVA PARA EL TICKET IMPRESO */
/* ======================================================== */
@media print {
    @page {
        size: 5.5in 8.5in;
        margin: 0.4cm;
    }

    body {
        background: white;
        color: #000000;
    }

    .no-print,
    .search-container,
    #seccion-busqueda,
    .btn-add,
    .btn-logout,
    table tbody tr td input {
        display: none !important;
    }

    /* Mostrar texto formateado dentro de las celdas */
    .print-text-cell {
        display: block !important;
        font-size: 13px;
        color: #000000;
        word-break: break-word;
    }

    .admin-panel {
        max-width: 100%;
        margin: 0;
        padding: 0;
        box-shadow: none;
        border: none;
        display: block;
    }

    .print-only-block {
        display: block !important;
        font-size: 14px;
        margin: 4px 0;
        color: #000000;
    }

    .font-bold-print {
        font-weight: bold !important;
        font-size: 16px !important;
    }

    .highlighted-print-box {
        border: 1px solid #000;
        padding: 5px;
        margin-top: 5px;
        background-color: transparent !important;
    }

    .resumen-container {
        border: 1px solid #000;
    }

    .resumen-item span {
        color: #000000 !important;
    }

    .ticket-footer {
        display: block !important;
    }

    * {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}
