﻿/* Estilos del Calendario */
.calendario-container {
    padding: 1rem;
}

.header-section {
    margin-bottom: 2rem;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-title {
    font-size: 2rem;
    font-weight: bold;
    margin: 0;
    color: #333;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Controles del calendario */
.calendar-controls {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

/* Estilos de FullCalendar personalizados */
.fc-theme-standard .fc-scrollgrid {
    border: 1px solid #dee2e6;
}

.fc-theme-standard td,
.fc-theme-standard th {
    border-color: #dee2e6;
}

.fc-event {
    border-radius: 4px;
    padding: 2px 4px;
    font-size: 0.85rem;
    cursor: move; /* Cursor para drag and drop */
    transition: all 0.2s ease;
}

.fc-event:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 10;
}
/* Efecto durante el drag */
.fc-event.fc-event-dragging {
    opacity: 0.8;
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    z-index: 1000;
}

/* Estilo para las celdas durante el drag over */
.fc-day.fc-day-future:hover,
.fc-day.fc-day-past:hover,
.fc-day.fc-day-today:hover {
    background-color: rgba(0, 123, 255, 0.1);
}
.fc-daygrid-event {
    white-space: normal;
    overflow: visible;
    text-overflow: initial;
}

.fc-ruta-event {
    display: flex;
    flex-direction: column;
    gap: 2px;
    white-space: normal;
}

.fc-ruta-operarios {
    font-weight: 700;
    font-size: 1.1rem;
    color: #0d6efd;
    line-height: 1.3;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.fc-ruta-operario-item {
    display: block;
    font-weight: 700;
}

.fc-ruta-operario-item + .fc-ruta-operario-item {
    margin-top: 0.2rem;
}

.fc-ruta-operario-item--sin {
    color: #6c757d;
}

.fc-ruta-detalle {
    font-size: 0.8rem;
    color: #495057;
    font-weight: 500;
}

.fc-daygrid-event .fc-ruta-operarios,
.fc-daygrid-event .fc-ruta-detalle {
    white-space: normal;
}

/* Indicador visual de que se puede arrastrar */
.fc-event::before {
    content: "⋮⋮";
    position: absolute;
    left: 2px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    color: rgba(0, 0, 0, 0.3);
    line-height: 1;
}

/* Estilos específicos para rutas */
.ruta-card {
    transition: all 0.2s ease;
    cursor: pointer;
}

    .ruta-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    }

/* Observaciones */
.observaciones-section {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Toast personalizado */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
}

/* Filtros */
.collapse .card-body {
    background-color: #f8f9fa;
}

#filtrosPanel .card-header {
    cursor: pointer;
    user-select: none;
}

    #filtrosPanel .card-header:hover {
        background-color: #f8f9fa;
    }

/* Estados de carga mejorados */
.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

    .loading::after {
        content: "";
        position: absolute;
        top: 50%;
        left: 50%;
        width: 40px;
        height: 40px;
        margin: -20px 0 0 -20px;
        border: 4px solid #f3f3f3;
        border-top: 4px solid #007bff;
        border-radius: 50%;
        animation: spin 1s linear infinite;
        z-index: 1000;
    }

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Indicador de carga en el calendario */
.fc-view-harness.loading {
    min-height: 400px;
}

/* Mensaje de información sobre paginado */
.calendar-info {
    background: #e3f2fd;
    border: 1px solid #bbdefb;
    border-radius: 0.25rem;
    padding: 0.75rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    color: #1565c0;
}

    .calendar-info i {
        margin-right: 0.5rem;
    }

/* Responsive */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        align-items: stretch;
    }

    .header-actions {
        justify-content: center;
    }

    .calendar-controls .d-flex {
        flex-direction: column;
        gap: 1rem;
    }

    .kanban-board {
        grid-template-columns: 1fr;
    }

    .kanban-content {
        max-height: 400px;
    }

    .page-title {
        font-size: 1.5rem;
        text-align: center;
    }

    .ruta-card .row {
        flex-direction: column;
    }

    .ruta-card .col-md-8,
    .ruta-card .col-md-4 {
        margin-bottom: 1rem;
    }
}

@media (max-width: 576px) {
    .calendario-container {
        padding: 0.5rem;
    }

    .kanban-card {
        padding: 0.75rem;
    }

    .fc-toolbar {
        flex-direction: column;
        gap: 0.5rem;
    }

    .fc-toolbar-chunk {
        display: flex;
        justify-content: center;
    }

    .modal-dialog {
        margin: 0.5rem;
    }
}

/* Animaciones */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ruta-card {
    animation: fadeIn 0.3s ease;
}

    /* Mejoras de accesibilidad */
    .ruta-card:focus,
    .fc-event:focus {
        outline: 2px solid #007bff;
        outline-offset: 2px;
    }

/* Print styles */
@media print {
    .header-actions,
    .calendar-controls,
    .nav-tabs,
    .modal,
    .calendar-info {
        display: none !important;
    }

    .calendario-container {
        padding: 0;
    }

    .card {
        border: none;
        box-shadow: none;
    }
}

/* Estilos para crear/editar ruta */
.direccion-item {
    transition: all 0.3s ease;
}

    .direccion-item:hover {
        transform: translateY(-1px);
    }

.drag-handle {
    cursor: move;
    padding: 0.5rem;
    border-radius: 0.25rem;
    transition: background-color 0.2s ease;
}

    .drag-handle:hover {
        background-color: rgba(0, 0, 0, 0.05);
    }

/* Estilos para Sortable.js */
.sortable-ghost {
    opacity: 0.5;
    background-color: #f8f9fa;
}

.sortable-chosen {
    transform: scale(1.02);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.sortable-drag {
    transform: rotate(2deg);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

/* Validación visual */
.direccion-input.is-invalid {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

.direccion-input.is-valid {
    border-color: #28a745;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
}

/* Animaciones */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.direccion-item {
    animation: slideIn 0.3s ease;
}

/* Toast notifications */
.toast-notification {
    animation: slideInRight 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .direccion-item .d-flex {
        flex-direction: column;
        gap: 0.5rem;
    }

    .direccion-item .flex-grow-1 {
        order: 1;
    }

    .direccion-item .drag-handle {
        order: 2;
        align-self: center;
    }

    .direccion-item .btn {
        order: 3;
        align-self: center;
    }
}

/* Estados del formulario */
.form-loading {
    pointer-events: none;
    opacity: 0.7;
}

.form-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 1000;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Mejoras visuales */
.card {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Indicadores de estado */
.required-field::after {
    content: " *";
    color: #dc3545;
}

/* Estilos para el resumen */
.resumen-card {
    position: sticky;
    top: 20px;
}

/* Atajos de teclado info */
.keyboard-shortcuts {
    font-size: 0.8rem;
    color: #6c757d;
    margin-top: 1rem;
    padding: 0.5rem;
    background-color: #f8f9fa;
    border-radius: 0.25rem;
}

.keyboard-shortcuts kbd {
    background-color: #e9ecef;
    color: #495057;
    padding: 0.1rem 0.3rem;
    border-radius: 0.2rem;
    font-size: 0.7rem;
}

/* FullCalendar v5/v6 */
.fc .fc-event-title {
    white-space: pre-line;
}
.fc-daygrid-day-events {
    overflow-y: visible;
}
