/* ==============================
   ESTILOS GENERALES
============================== */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f4f4;
}

h1, h2, h3 {
    color: #333;
    margin-top: 20px;
}

/* ==============================
   FORMULARIOS
============================== */
form {
    background: white;
    padding: 20px;
    margin: 20px auto;
    width: 320px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    border-radius: 5px;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="search"],
select,
textarea,
form button:not(.btn),
.nfc-container button:not(.btn) {
    width: 100%;
    padding: 10px;
    margin: 6px 0;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 14px;
}

input[type="checkbox"],
input[type="radio"] {
    width: auto;
    margin: 0 6px 0 0;
}

/* ==============================
   TABLA DE PRODUCTOS
============================== */
table {
    width: 90%;
    margin: 25px auto;
    border-collapse: collapse;
    background: white;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    overflow: hidden;
}

th, td {
    padding: 12px 10px;
    border: 1px solid #ddd;
    text-align: center;
    vertical-align: middle;
}

th {
    background-color: #007bff;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ==============================
   FILAS PRINCIPALES
============================== */
.product-row {
    cursor: pointer;
    background-color: #fff;
    transition: background 0.2s ease;
}

.product-row:hover {
    background-color: #f0f8ff;
}

/* ==============================
   FILA DE DETALLES DESPLEGABLE
============================== */
.details-row td {
    background-color: #eef6ff;
    text-align: left;
    padding: 15px;
    border-top: none;
}

.details-row p {
    margin: 6px 0;
    font-size: 14px;
    color: #333;
}

/* ==============================
   CONTENEDOR DE MINIATURAS
============================== */
.thumbnail {
    width: 100px;
    height: auto;
    margin: 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.thumbnail:hover {
    transform: scale(1.08);
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.3);
}

/* ==============================
   MODAL DE IMAGEN AMPLIADA
============================== */
.modal {
    display: block;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
}

.modal-content {
    margin: 5% auto;
    padding: 10px;
    max-width: 90%;
    text-align: center;
    background: transparent;
}

.close {
    color: white;
    font-size: 30px;
    font-weight: bold;
    float: right;
    margin-right: 15px;
    cursor: pointer;
}

.close:hover {
    color: #bbb;
}

.fullscreen {
    max-width: 95%;
    max-height: 85vh;
    border-radius: 5px;
    object-fit: contain;
}

/* ==============================
   BUSCADORES
============================== */
.search-bar {
    margin: 15px auto;
    width: 90%;
    text-align: left;
}

.search-bar label {
    font-weight: bold;
    color: #333;
    margin-right: 10px;
}

.search-bar input {
    width: 250px;
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #bbb;
}

/* ==============================
   ENLACES
============================== */
a {
    color: #007bff;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.imagen-slot {
    margin: 10px auto;
    text-align: center;
}

.upload-btn {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.upload-btn:hover {
    background-color: #0056b3;
}

/* ==============================
   NFC LOGIN
============================== */
.nfc-container {
    background: white;
    padding: 20px;
    margin: 0 auto 20px auto;
    width: 320px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    border-radius: 5px;
}

#estadoNFC {
    margin-top: 10px;
    font-size: 14px;
    color: #333;
}

.nfc-container button {
    background-color: #28a745;
}

.nfc-container button:hover {
    background-color: #1e7e34;
}
/* ==============================
   LAYOUT: HEADER / MAIN / FOOTER
============================== */
.header {
    background: #fff;
    border-bottom: 1px solid #ddd;
    padding: 16px 20px;
}

.header-container {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px;
}

.header-title h1 {
    margin: 0 0 4px 0;
    font-size: 1.4rem;
    color: #1a1a2e;
}

.header-title .subtitle {
    margin: 0;
    font-size: 0.9rem;
    color: #666;
}

.userbox {
    font-size: 0.85rem;
    color: #444;
    text-align: right;
}

main {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px 16px;
    box-sizing: border-box;
}

footer {
    text-align: center;
    padding: 16px;
    font-size: 0.8rem;
    color: #999;
    border-top: 1px solid #e0e0e0;
    margin-top: 30px;
}

/* ==============================
   LOGIN BOX
============================== */
.login-box {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
    padding: 24px 20px;
    max-width: 420px;
    margin: 20px auto;
    box-sizing: border-box;
}

.login-box form {
    box-shadow: none;
    padding: 0;
    margin: 0;
    width: 100%;
    max-width: 100%;
}

.login-box label {
    display: block;
    margin: 12px 0 4px;
    font-weight: bold;
    font-size: 0.9rem;
    color: #333;
}

/* ==============================
   BOTÓN GENÉRICO .btn
   — altura automática, nunca se estira
============================== */
.btn {
    display: inline-block;
    background-color: #007bff;
    color: #fff !important;
    border: none;
    padding: 12px 20px;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none !important;
    text-align: center;
    line-height: 1.4;
    transition: background 0.2s ease;
    box-sizing: border-box;
    /* altura siempre auto — nunca se estira */
    height: auto;
    align-self: auto;
}

.btn:hover {
    background-color: #0056b3;
    text-decoration: none !important;
}

.btn.disabled {
    background: #ccc !important;
    cursor: not-allowed;
    pointer-events: none;
}

/* ==============================
   BARRA DE ACCIONES
   — fila que NO estira los hijos
============================== */
.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 16px 0;
    align-items: flex-start;  /* clave: no estira en altura */
}

/* los .btn dentro de .actions NO se estiran */
.actions .btn {
    flex: 0 0 auto;
}


/* ==============================
   PILA DE BOTONES CENTRADA
   (igual que "Mostrar todos los servicios")
============================== */
.btn-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin: 20px auto;
    width: 100%;
}

.btn-stack .btn {
    width: auto;          /* el botón mide lo que mide su texto */
    min-width: 220px;     /* mínimo razonable para legibilidad */
    max-width: 420px;
}

.btn-danger {
    background-color: #dc3545 !important;
}
.btn-danger:hover {
    background-color: #a71d2a !important;
}

.check-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #444;
    cursor: pointer;
}

/* ==============================
   GRID DE SERVICIOS (vista normal)
============================== */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
    margin: 16px 0;
}

@media (max-width: 600px) {
    .grid {
        grid-template-columns: 1fr;
    }
}

/* Tarjeta de servicio */
a.svc {
    display: block;
    background: #fff;
    border: 1px solid #dde3ec;
    border-radius: 10px;
    padding: 16px;
    text-decoration: none !important;
    color: #1a1a2e !important;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    transition: box-shadow 0.2s, border-color 0.2s;
}

a.svc:hover {
    box-shadow: 0 3px 10px rgba(0,0,0,0.14);
    border-color: #007bff;
    text-decoration: none !important;
}

a.svc.completado {
    border-left: 4px solid #28a745;
    background: #f6fff8;
}

a.svc.disabled {
    opacity: 0.5;
    pointer-events: none;
    cursor: default;
}

.svc .name {
    font-weight: 700;
    font-size: 1rem;
    color: #1a1a2e;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.svc .code {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 10px;
}

/* Badges de estado */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge.pending {
    background: #e8f0fe;
    color: #1a56db;
}

.badge.ready {
    background: #d4edda;
    color: #155724;
}

/* ==============================
   SERVICIOS-GRID (vista calendario)
============================== */
.servicios-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    margin: 16px 0;
}

.dia-columna {
    background: #fff;
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.dia-columna h3 {
    font-size: 0.9rem;
    font-weight: 700;
    color: #007bff;
    margin: 0 0 10px 0;
    text-transform: uppercase;
    border-bottom: 2px solid #e8f0fe;
    padding-bottom: 6px;
}

.dia-columna a.svc {
    padding: 10px;
    margin-bottom: 8px;
}

/* FIX cross-browser */
button {
    height: auto;
}

button:not(.btn) {
    width: auto;
}

.svc {
    text-align: left;
}

/* evitar herencias raras */
.grid, .svc, .actions {
    align-items: stretch;
}
/* ==============================
   STANDARD APP HEADER / PAGE WIDTH
============================== */
header .wrap,
.header-container {
    width: min(1180px, 94vw);
    margin: 0 auto;
    box-sizing: border-box;
}

header .wrap {
    text-align: center;
}

header .wrap h1,
.header-title h1 {
    margin: 0 0 6px;
    line-height: 1.15;
}

header .wrap .subtitle,
.header-title .subtitle {
    margin: 0;
    color: #555;
}

main {
    width: min(1180px, 94vw);
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}


/* ==============================
   STANDARD DEMO HEADER
============================== */
.app-header {
    background:#fff;
    border-bottom:1px solid #dfe3ea;
    padding:14px 18px;
}
.app-header-inner {
    width:min(1180px, 94vw);
    margin:0 auto;
    display:grid;
    grid-template-columns:1fr auto;
    gap:14px;
    align-items:center;
}
.app-title {
    margin:0 0 4px;
    color:#1a1a2e;
    font-size:1.55rem;
    line-height:1.15;
}
.app-subtitle {
    margin:0;
    color:#555;
    line-height:1.3;
}
.app-user {
    color:#444;
    text-align:right;
    font-size:.9rem;
    line-height:1.35;
}
.app-actions {
    width:min(1180px, 94vw);
    margin:12px auto 0;
    display:flex;
    gap:10px;
    flex-wrap:wrap;
    justify-content:flex-start;
}
.app-main {
    width:min(1180px, 94vw);
    margin:0 auto;
    padding:18px 0 28px;
    box-sizing:border-box;
}
.toolbar-card {
    background:#fff;
    border:1px solid #dde3ec;
    border-radius:8px;
    box-shadow:0 1px 6px rgba(0,0,0,.06);
    padding:14px;
    margin-bottom:16px;
}
@media (max-width:700px) {
    .app-header { padding:10px 12px; }
    .app-header-inner { grid-template-columns:1fr; gap:6px; text-align:center; }
    .app-title { font-size:1.35rem; }
    .app-subtitle { font-size:.92rem; }
    .app-user { text-align:center; font-size:.82rem; }
    .app-actions { margin-top:10px; display:grid; grid-template-columns:1fr; }
    .app-actions .btn { width:100%; box-sizing:border-box; }
    .app-main { padding-top:12px; }
}