/* ── Reset y base ── */
*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    background: #1a1a2e;
    color: #e0e0e0;
    font-family: 'Segoe UI', Arial, sans-serif;
    min-height: 100vh;
}

/* ── Header ── */
.monitor-header {
    background: #0f0f1a;
    padding: 14px 28px;
    display: flex;
    align-items: center;
    gap: 24px;
    border-bottom: 1px solid #2a2a4a;
}

.monitor-titulo { font-size: 1.3rem; font-weight: 700; color: #90caf9; }
.monitor-fecha  { font-size: 0.95rem; color: #9e9e9e; text-transform: capitalize; }
.monitor-jornada-badge {
    margin-left: auto;
    background: #2E7D32;
    color: #fff;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* ── Grid de cards ── */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    padding: 28px;
}

.sin-repartos {
    text-align: center;
    padding: 80px 0;
    color: #616161;
    font-size: 1.1rem;
}

/* ── Card de repartidor ── */
.repartidor-card {
    border-radius: 14px;
    padding: 22px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    user-select: none;
}

.repartidor-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.repartidor-card.activo    { background: #b8860b; color: #1a1a2e; }
.repartidor-card.completado { background: #2E7D32; color: #ffffff; }
.repartidor-card.cerrado   { background: #424242; color: #cccccc; }

.card-nombre   { font-size: 1.15rem; font-weight: 700; margin-bottom: 10px; }
.card-progreso { display: flex; align-items: baseline; gap: 6px; margin-bottom: 10px; }
.progreso-numero { font-size: 2.2rem; font-weight: 800; line-height: 1; }
.progreso-label  { font-size: 0.85rem; opacity: 0.8; }

.card-barra {
    background: rgba(0,0,0,0.25);
    border-radius: 6px;
    height: 8px;
    overflow: hidden;
    margin-bottom: 10px;
}

.barra-fill {
    height: 100%;
    background: rgba(255,255,255,0.6);
    border-radius: 6px;
    transition: width 0.4s ease;
}

.card-estado-badge {
    font-size: 0.8rem;
    font-weight: 600;
    opacity: 0.85;
    text-align: right;
}

.card-estado-badge.cerrado-anticipado { color: #FFB300; opacity: 1; }

.card-motivo {
    font-size: 0.75rem;
    opacity: 0.75;
    margin-top: 4px;
    font-style: italic;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Panel de detalle ── */
.detalle-panel {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: min(520px, 100vw);
    background: #12122a;
    border-left: 1px solid #2a2a4a;
    display: flex;
    flex-direction: column;
    z-index: 500;
    box-shadow: -8px 0 30px rgba(0,0,0,0.5);
}

.detalle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 22px;
    border-bottom: 1px solid #2a2a4a;
    background: #0f0f1a;
}

.detalle-nombre { font-size: 1.1rem; font-weight: 700; color: #90caf9; }
.detalle-cerrar {
    background: none; border: none; color: #9e9e9e;
    font-size: 1.2rem; cursor: pointer; padding: 4px 8px;
}
.detalle-cerrar:hover { color: #fff; }

.detalle-lista { overflow-y: auto; flex: 1; padding: 8px 0; }

.detalle-fila {
    padding: 12px 22px;
    border-bottom: 1px solid #1e1e3a;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 12px;
}

.detalle-fila.fila-exitosa { border-left: 4px solid #2E7D32; }
.detalle-fila.fila-fallida { border-left: 4px solid #c62828; }

.fila-qr        { font-size: 0.78rem; color: #b0bec5; grid-column: 1 / -1; }
.fila-proveedor { font-size: 0.9rem; font-weight: 600; }
.fila-direccion { font-size: 0.85rem; color: #9e9e9e; }
.fila-estado    { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fila-notas     { font-size: 0.78rem; color: #ef9a9a; }

.badge-exitosa  { background: #2E7D32; color: #fff; padding: 2px 8px; border-radius: 10px; font-size: 0.78rem; }
.badge-fallida  { background: #c62828; color: #fff; padding: 2px 8px; border-radius: 10px; font-size: 0.78rem; }
.badge-pendiente{ background: #424242; color: #bdbdbd; padding: 2px 8px; border-radius: 10px; font-size: 0.78rem; }

/* ── Toasts ── */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    z-index: 600;
    max-width: 340px;
    pointer-events: none;
}

.toast {
    padding: 12px 16px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    cursor: pointer;
    pointer-events: all;
    animation: slideIn 0.25s ease;
}

.toast.exitosa            { background: #2E7D32; }
.toast.fallida            { background: #c62828; }
.toast.cierre-completado  { background: #1565C0; border-left: 4px solid #42A5F5; }
.toast.cierre-anticipado  { background: #4A2800; border-left: 4px solid #FFB300; }

.toast-repartidor { font-weight: 700; font-size: 0.9rem; }
.toast-qr         { font-size: 0.78rem; opacity: 0.85; }
.toast-resultado  { font-size: 0.82rem; margin-top: 4px; font-weight: 600; }

@keyframes slideIn {
    from { transform: translateX(110%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

/* ── Overlay jornada completa ── */
.jornada-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.82);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 800;
}

.jornada-card {
    background: #0f0f1a;
    border: 1px solid #2E7D32;
    border-radius: 20px;
    padding: 48px 60px;
    text-align: center;
    max-width: 400px;
}

.jornada-icono  { font-size: 3.5rem; color: #2E7D32; margin-bottom: 16px; }
.jornada-card h2 { margin: 0 0 12px; font-size: 1.8rem; color: #e0e0e0; }
.jornada-card p  { color: #9e9e9e; margin: 6px 0; }
.jornada-hora   { font-size: 1.4rem; color: #90caf9; font-weight: 700; margin-top: 12px !important; }
.jornada-card small { display: block; margin-top: 20px; color: #616161; font-size: 0.8rem; }

/* ── Reconexión (Blazor circuit) ── */
#components-reconnect-modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 36px;
    background: #f57c00;
    color: #1a1a2e;
    text-align: center;
    line-height: 36px;
    z-index: 9999;
    font-size: 0.88rem;
    font-weight: 600;
}

#components-reconnect-modal.components-reconnect-show,
#components-reconnect-modal.components-reconnect-failed {
    display: block;
}

/* ── Loading / acceso denegado ── */
.loading-screen, .access-denied {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    gap: 16px;
    color: #9e9e9e;
}

.loading-spinner {
    width: 48px; height: 48px;
    border: 4px solid #2a2a4a;
    border-top-color: #90caf9;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.access-denied h2 { color: #ef9a9a; }
