/* Reset y configuración general */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #f5f7fa;
    padding: 20px;
    color: #2d3748;
}

/* Contenedor principal */
.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* Encabezado */
.header {
    background: white;
    padding: 20px 30px;
    border-radius: 12px;
    margin-bottom: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.header h1 {
    font-size: 24px;
    font-weight: 600;
    color: #1a202c;
}

.header .fecha-actual {
    font-size: 16px;
    color: #4a5568;
    background: #edf2f7;
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: 500;
}

/* Navegación de fechas */
.navegacion-fechas {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    align-items: center;
    flex-wrap: wrap;
    background: white;
    padding: 12px 20px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.navegacion-fechas button {
    padding: 8px 18px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-anterior, .btn-siguiente {
    background: #edf2f7;
    color: #4a5568;
}

.btn-anterior:hover, .btn-siguiente:hover {
    background: #e2e8f0;
}

.btn-hoy {
    background: #ebf8ff;
    color: #2b6cb0;
}

.btn-hoy:hover {
    background: #bee3f8;
}

.btn-crear {
    background: #48bb78;
    color: white;
    margin-left: auto;
}

.btn-crear:hover {
    background: #38a169;
}

.filtro-fecha {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 15px;
}

.filtro-fecha label {
    font-size: 14px;
    color: #4a5568;
    font-weight: 500;
}

.filtro-fecha input[type="date"] {
    padding: 6px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
    background: #f7fafc;
}

/* Contenedor de días */
.dias-container {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

/* Cada día */
.dia-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.dia-card .dia-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #edf2f7;
}

.dia-card .dia-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: #1a202c;
}

.dia-card .dia-header .total-pedidos {
    background: #edf2f7;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 13px;
    color: #4a5568;
    font-weight: 500;
}

/* Grid de tarjetas de pedidos - estilo similar a la imagen */
.pedidos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

/* Tarjeta de pedido - estilo similar a la imagen */
.pedido-card {
    background: #f7fafc;
    border-radius: 10px;
    padding: 16px;
    border: 1px solid #e2e8f0;
    transition: all 0.2s;
    position: relative;
}

.pedido-card:hover {
    border-color: #bee3f8;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.pedido-card.estado-pendiente {
    border-left: 4px solid #ecc94b;
}

.pedido-card.estado-en_progreso {
    border-left: 4px solid #63b3ed;
}

.pedido-card.estado-completado {
    border-left: 4px solid #68d391;
    opacity: 0.7;
}

.pedido-card .pedido-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 6px;
}

.pedido-card .cliente-nombre {
    font-weight: 600;
    font-size: 16px;
    color: #1a202c;
}

.pedido-card .badge-estado {
    font-size: 10px;
    padding: 2px 12px;
    border-radius: 20px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.badge-pendiente {
    background: #fefcbf;
    color: #975a16;
}

.badge-en_progreso {
    background: #bee3f8;
    color: #2a69ac;
}

.badge-completado {
    background: #c6f6d5;
    color: #276749;
}

.pedido-card .pedido-info {
    font-size: 13px;
    color: #4a5568;
    margin: 4px 0;
}

.pedido-card .pedido-info .horario {
    font-weight: 600;
    color: #2d3748;
}

.pedido-card .pedido-total {
    font-weight: 700;
    font-size: 18px;
    color: #1a202c;
    margin: 8px 0 10px 0;
}

.pedido-card .pedido-acciones {
    display: flex;
    gap: 6px;
    margin-top: 12px;
    flex-wrap: wrap;
    border-top: 1px solid #edf2f7;
    padding-top: 12px;
}

.pedido-card .pedido-acciones button {
    padding: 4px 14px;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-editar {
    background: #ebf8ff;
    color: #2b6cb0;
}

.btn-editar:hover {
    background: #bee3f8;
}

.btn-borrar {
    background: #fff5f5;
    color: #c53030;
}

.btn-borrar:hover {
    background: #fed7d7;
}

.btn-reset {
    background: #fefcbf;
    color: #975a16;
}

.btn-reset:hover {
    background: #f6e05e;
}

.btn-cerrar {
    background: #edf2f7;
    color: #4a5568;
}

.btn-cancelar {
    background: #fed7d7;
    color: #9b2c2c;
}

/* Sin pedidos */
.sin-pedidos {
    text-align: center;
    padding: 40px 20px;
    color: #a0aec0;
}

.sin-pedidos .icono {
    font-size: 48px;
    margin-bottom: 15px;
}

/* Loading */
.loading {
    text-align: center;
    padding: 60px 20px;
    color: #a0aec0;
    font-size: 16px;
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .navegacion-fechas {
        flex-direction: column;
        align-items: stretch;
    }
    
    .btn-crear {
        margin-left: 0;
    }
    
    .filtro-fecha {
        margin-left: 0;
        flex-wrap: wrap;
    }
    
    .pedidos-grid {
        grid-template-columns: 1fr;
    }
}

/* Estilos para el formulario de edición/creación */
.form-container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #edf2f7;
}

.form-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: #1a202c;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 5px;
    color: #2d3748;
    font-size: 14px;
}

.form-group label .required {
    color: #e53e3e;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
    background: #f7fafc;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #4299e1;
    background: white;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.15);
}

.form-group textarea {
    resize: vertical;
    min-height: 60px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
}

/* Botón de disponibilidad */
.btn-disponibilidad {
    background: #ebf8ff;
    color: #2b6cb0;
    border: 1px solid #bee3f8;
    padding: 6px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-disponibilidad:hover {
    background: #bee3f8;
}

.btn-disponibilidad .badge {
    background: #48bb78;
    color: white;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 11px;
    margin-left: 5px;
}

/* Servicios del pedido */
.servicios-container {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
    background: #f7fafc;
    margin-top: 8px;
}

.servicio-item {
    display: grid;
    grid-template-columns: 2fr 80px 120px 40px;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
    background: white;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #edf2f7;
}

.servicio-item select,
.servicio-item input {
    padding: 6px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 13px;
    background: white;
}

.servicio-item select:focus,
.servicio-item input:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 2px rgba(66, 153, 225, 0.15);
}

.servicio-item .servicio-nombre {
    font-weight: 500;
    color: #2d3748;
    font-size: 14px;
}

.servicio-item .servicio-precio {
    color: #4a5568;
    font-size: 13px;
}

.servicio-item .servicio-cantidad {
    display: flex;
    align-items: center;
    gap: 6px;
}

.servicio-item .servicio-cantidad button {
    width: 28px;
    height: 28px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    color: #4a5568;
    transition: all 0.2s;
}

.servicio-item .servicio-cantidad button:hover {
    background: #edf2f7;
}

.servicio-item .servicio-cantidad span {
    min-width: 30px;
    text-align: center;
    font-weight: 600;
}

.servicio-item .btn-eliminar-servicio {
    background: none;
    border: none;
    color: #e53e3e;
    cursor: pointer;
    font-size: 18px;
    padding: 0 5px;
    transition: color 0.2s;
}

.servicio-item .btn-eliminar-servicio:hover {
    color: #c53030;
}

.btn-agregar-servicio {
    background: #48bb78;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
    margin-top: 10px;
}

.btn-agregar-servicio:hover {
    background: #38a169;
}

/* Resumen de totales */
.resumen-totales {
    background: #f7fafc;
    border-radius: 8px;
    padding: 15px 20px;
    margin-top: 15px;
    border: 1px solid #e2e8f0;
}

.resumen-totales .total-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 14px;
}

.resumen-totales .total-row.total-final {
    font-weight: 700;
    font-size: 18px;
    border-top: 2px solid #e2e8f0;
    padding-top: 10px;
    margin-top: 5px;
}

.resumen-totales .total-row .label {
    color: #4a5568;
}

.resumen-totales .total-row .value {
    color: #1a202c;
}

/* Modal de disponibilidad */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal-content .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #edf2f7;
}

.modal-content .modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.modal-content .modal-header .btn-cerrar-modal {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #a0aec0;
}

.modal-content .modal-header .btn-cerrar-modal:hover {
    color: #4a5568;
}

.modal-content .trabajador-disponible {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-radius: 6px;
    margin-bottom: 8px;
    background: #f7fafc;
    border: 1px solid #edf2f7;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-content .trabajador-disponible:hover {
    background: #edf2f7;
    border-color: #bee3f8;
}

.modal-content .trabajador-disponible .nombre {
    font-weight: 500;
}

.modal-content .trabajador-disponible .carga {
    font-size: 13px;
    color: #4a5568;
}

.modal-content .trabajador-disponible .carga .verde {
    color: #48bb78;
}

.modal-content .trabajador-disponible .carga .amarillo {
    color: #ecc94b;
}

.modal-content .trabajador-disponible .carga .rojo {
    color: #e53e3e;
}

.modal-content .trabajador-disponible .seleccionar {
    background: #4299e1;
    color: white;
    border: none;
    padding: 4px 16px;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
}

.modal-content .trabajador-disponible .seleccionar:hover {
    background: #3182ce;
}

/* Acciones del formulario */
.acciones-form {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #edf2f7;
}

.btn-guardar {
    background: #48bb78;
    color: white;
    padding: 10px 35px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: background 0.2s;
}

.btn-guardar:hover {
    background: #38a169;
}

.btn-cancelar {
    background: #edf2f7;
    color: #4a5568;
    padding: 10px 25px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: background 0.2s;
}

.btn-cancelar:hover {
    background: #e2e8f0;
}

/* Responsive */
@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .form-row-3 {
        grid-template-columns: 1fr;
    }
    
    .servicio-item {
        grid-template-columns: 1fr;
        gap: 6px;
        padding: 12px;
    }
    
    .acciones-form {
        flex-direction: column;
    }
    
    .acciones-form button {
        width: 100%;
    }
}

/* Estilos para el selector de horario en el modal */
#selector-horario select {
    width: 100%;
    padding: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    transition: border-color 0.2s;
}

#selector-horario select:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.15);
}

#selector-horario select:disabled {
    background: #f7fafc;
    cursor: not-allowed;
}

/* Grid de horas en el modal */
.grid-horas {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
    padding: 5px;
}

.hora-bloque {
    padding: 6px 4px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    background: #f7fafc;
    color: #a0aec0;
    text-align: center;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s;
}

.hora-bloque.disponible {
    border-color: #48bb78;
    background: #f0fff4;
    color: #276749;
    cursor: pointer;
}

.hora-bloque.disponible:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(72, 187, 120, 0.2);
}

.hora-bloque.ocupado {
    border-color: #e53e3e;
    background: #fff5f5;
    color: #e53e3e;
    opacity: 0.6;
    cursor: not-allowed;
}

.hora-bloque.seleccionado {
    border-color: #4299e1;
    background: #ebf8ff;
    color: #2b6cb0;
    box-shadow: 0 0 0 2px #4299e1;
}

/* Grid de horas - más compacto */
.grid-horas {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 4px;
    max-height: 120px;
    overflow-y: auto;
    padding: 4px;
}

.grid-horas .hora-bloque {
    padding: 4px 2px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    text-align: center;
    font-size: 11px;
    font-weight: 500;
    transition: all 0.2s;
    cursor: default;
}

.grid-horas .hora-bloque.disponible {
    border-color: #48bb78;
    background: #f0fff4;
    color: #276749;
    cursor: pointer;
}

.grid-horas .hora-bloque.disponible:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(72, 187, 120, 0.2);
}

.grid-horas .hora-bloque.ocupado {
    border-color: #e53e3e;
    background: #fff5f5;
    color: #e53e3e;
    opacity: 0.6;
    cursor: not-allowed;
}

.grid-horas .hora-bloque.seleccionado {
    border-color: #4299e1;
    background: #ebf8ff;
    color: #2b6cb0;
    box-shadow: 0 0 0 2px #4299e1;
}

/* Modal más alto */
.modal-content {
    max-height: 85vh;
    overflow-y: auto;
}

.modal-content .modal-header {
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
    padding-bottom: 10px;
}

/* ===== MENÚ DE NAVEGACIÓN ===== */
.nav-menu {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.nav-menu a {
    color: #4a5568;
    text-decoration: none;
    font-weight: 500;
    padding: 5px 12px;
    border-radius: 6px;
    transition: all 0.2s;
    font-size: 13px;
}

.nav-menu a:hover {
    background: rgba(255,255,255,0.15);
    color: white;
}

.nav-menu a.active {
    background: rgba(255,255,255,0.25);
    color: white;
}

.nav-menu .separator {
    color: rgba(255,255,255,0.3);
    font-size: 16px;
}

/* Para los headers de clientes y servicios (fondo blanco) */
.clientes-header .nav-menu a,
.servicios-header .nav-menu a {
    color: #4a5568;
}

.clientes-header .nav-menu a:hover,
.servicios-header .nav-menu a:hover {
    background: #edf2f7;
    color: #1a202c;
}

.clientes-header .nav-menu a.active,
.servicios-header .nav-menu a.active {
    background: #ebf8ff;
    color: #2b6cb0;
}

.clientes-header .nav-menu .separator,
.servicios-header .nav-menu .separator {
    color: #e2e8f0;
}

/* Botón Ver Detalle */
.btn-ver-detalle {
    background: #ebf8ff;
    color: #2b6cb0;
    border: none;
    padding: 4px 14px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-ver-detalle:hover {
    background: #bee3f8;
}

/* Estilos para el modal de detalle */
.modal-detalle-pedido .modal-content {
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-detalle-pedido .modal-header {
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
    padding-bottom: 15px;
    border-bottom: 1px solid #edf2f7;
}

/* Estilos para impresión */
@media print {
    .no-print {
        display: none !important;
    }
    
    .modal-overlay {
        position: static !important;
        background: none !important;
        display: block !important;
    }
    
    .modal-content {
        box-shadow: none !important;
        border: none !important;
        padding: 20px !important;
        max-height: none !important;
        overflow: visible !important;
    }
    
    .modal-header {
        position: static !important;
    }
    
    .btn-cerrar-modal {
        display: none !important;
    }
}


/* ===== HEADER ===== */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 30px;
    border-radius: 12px;
    margin-bottom: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.header h1 {
    font-size: 28px;
    font-weight: 300;
    color: white;
    margin: 0;
}

.header .fecha-actual {
    font-size: 18px;
    background: rgba(255,255,255,0.2);
    padding: 8px 20px;
    border-radius: 20px;
    color: white;
}

/* ===== MENÚ DE NAVEGACIÓN EN EL HEADER ===== */
.nav-menu {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.nav-menu a {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: 6px;
    transition: all 0.2s;
    font-size: 14px;
}

.nav-menu a:hover {
    background: rgba(255,255,255,0.15);
    color: white;
}

.nav-menu a.active {
    background: rgba(255,255,255,0.25);
    color: white;
}

.nav-menu .separator {
    color: rgba(255,255,255,0.3);
    font-size: 18px;
}

/* ===== BOTÓN LOGOUT ===== */
.btn-logout {
    background: rgba(255,255,255,0.15);
    color: white !important;
    border: 1px solid rgba(255,255,255,0.2);
    padding: 6px 16px !important;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-logout:hover {
    background: rgba(255,0,0,0.3);
    border-color: rgba(255,0,0,0.3);
}

/* ===== USER INFO EN HEADER ===== */
.user-info-header {
    display: flex;
    align-items: center;
    gap: 15px;
    color: rgba(255,255,255,0.9);
    font-size: 14px;
}

.user-info-header .user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    color: white;
}