/* ============================================
   BITÁCORA RUTAS - Informe por Ciclos
   ============================================ */

/* Eliminar padding del main-content para esta página */
.main-content:has(.bitacora-rutas-page) {
    padding: 0 !important;
}

.bitacora-rutas-page {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 95px);
    width: 100%;
    padding: 0;
    overflow: hidden;
    background: var(--bg-primary);
}

/* Ajuste del camara-panel para que ocupe todo el espacio */
.bitacora-rutas-page .camara-panel {
    margin: 0;
    padding: 0.75rem;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.bitacora-rutas-page .camara-header {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: nowrap;
    gap: 1rem;
    position: relative;
    margin: 0 0 0.5rem 0;
    padding: 0.25rem 0.5rem;
    flex-shrink: 0;
}

.bitacora-rutas-page .camara-header h4 {
    position: absolute;
    left: 0;
}

.bitacora-rutas-page .camara-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    box-sizing: border-box;
}

/* ============================================
   CALENDAR WRAPPER
   ============================================ */

.calendar-wrapper {
    width: 100%;
    flex-shrink: 0;
    margin-bottom: 0.5rem;
    box-sizing: border-box;
}

/* ============================================
   CYCLE INFO DISPLAY
   ============================================ */

.cycle-info-display {
    width: 100%;
    padding: 1rem;
    flex-shrink: 0;
}

.cycle-info-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.cycle-info-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.cycle-info-header svg {
    color: #F07400;
    flex-shrink: 0;
}

.cycle-info-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    background: linear-gradient(135deg, #F07400, #00b4ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============================================
   BITÁCORA COMMENTS SECTION
   ============================================ */

.bitacora-comments-section {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
    animation: fadeIn 0.4s ease-in;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header de Comentarios */
.comments-header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.65rem;
    background: linear-gradient(135deg, #F07400, #00b4ff);
    border-radius: 12px;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 15px rgba(240, 116, 0, 0.3);
    animation: slideDown 0.5s ease-out;
    width: 100%;
    box-sizing: border-box;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.comments-header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.comments-header-left svg {
    color: white;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.comments-header-left h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.comments-header-right {
    display: flex;
    align-items: center;
}

.btn-save-all {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    background: #00b4ff;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.btn-save-all:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    background: #0096d9;
}

.btn-save-all:active {
    transform: translateY(0);
}

/* Categorías de Rutas */
.route-category {
    margin-bottom: 2rem;
    animation: fadeInUp 0.6s ease-out;
    width: 100%;
    box-sizing: border-box;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.category-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-left: 4px solid #F07400;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    width: 100%;
    box-sizing: border-box;
}

.category-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, #F07400, #ff9a44);
    box-shadow: 0 3px 8px rgba(240, 116, 0, 0.3);
}

.category-icon.series-100 {
    background: linear-gradient(135deg, #11998e, #38ef7d);
    box-shadow: 0 3px 8px rgba(17, 153, 142, 0.3);
}

.category-icon.series-200 {
    background: linear-gradient(135deg, #4facfe, #00f2fe);
    box-shadow: 0 3px 8px rgba(79, 172, 254, 0.3);
}

.category-icon.series-300 {
    background: linear-gradient(135deg, #fa709a, #fee140);
    box-shadow: 0 3px 8px rgba(250, 112, 154, 0.3);
}

.category-icon.series-400 {
    background: linear-gradient(135deg, #a8edea, #fed6e3);
    box-shadow: 0 3px 8px rgba(168, 237, 234, 0.3);
}

.category-icon svg {
    color: white;
}

.category-title h4 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Grid de Rutas */
.routes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    width: 100%;
    box-sizing: border-box;
}

/* Cards de Rutas */
.route-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    position: relative;
    overflow: hidden;
}

.route-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #F07400, #ff9a44);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.route-card:hover::before {
    transform: scaleX(1);
}

.route-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    border-color: #F07400;
}

.route-card.has-comments {
    background: linear-gradient(145deg, var(--bg-secondary) 0%, rgba(240, 116, 0, 0.05) 100%);
    border-color: rgba(240, 116, 0, 0.3);
}

/* Series Cards con colores específicos */
.series-100-card::before {
    background: linear-gradient(90deg, #11998e, #38ef7d);
}

.series-100-card:hover {
    border-color: #11998e;
}

.series-100-card.has-comments {
    background: linear-gradient(145deg, var(--bg-secondary) 0%, rgba(17, 153, 142, 0.05) 100%);
    border-color: rgba(17, 153, 142, 0.3);
}

.series-200-card::before {
    background: linear-gradient(90deg, #4facfe, #00f2fe);
}

.series-200-card:hover {
    border-color: #4facfe;
}

.series-200-card.has-comments {
    background: linear-gradient(145deg, var(--bg-secondary) 0%, rgba(79, 172, 254, 0.05) 100%);
    border-color: rgba(79, 172, 254, 0.3);
}

.series-300-card::before {
    background: linear-gradient(90deg, #fa709a, #fee140);
}

.series-300-card:hover {
    border-color: #fa709a;
}

.series-300-card.has-comments {
    background: linear-gradient(145deg, var(--bg-secondary) 0%, rgba(250, 112, 154, 0.05) 100%);
    border-color: rgba(250, 112, 154, 0.3);
}

.series-400-card::before {
    background: linear-gradient(90deg, #a8edea, #fed6e3);
}

.series-400-card:hover {
    border-color: #a8edea;
}

.series-400-card.has-comments {
    background: linear-gradient(145deg, var(--bg-secondary) 0%, rgba(168, 237, 234, 0.05) 100%);
    border-color: rgba(168, 237, 234, 0.3);
}

/* Header de Card */
.route-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-color);
}

.route-number {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    background: linear-gradient(135deg, #F07400, #ff9a44);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.comment-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #11998e, #38ef7d);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(17, 153, 142, 0.7);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 8px rgba(17, 153, 142, 0);
    }
}

.comment-badge svg {
    color: white;
}

/* Body de Card */
.route-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-control {
    padding: 0.65rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    font-size: 0.9rem;
    transition: all 0.3s ease;
    font-family: inherit;
}

/* Colores del texto según el tema */
/* Modo Oscuro (Default) */
:root .form-control {
    color: #e9ecef !important;
}

:root .form-control::placeholder {
    color: #adb5bd !important;
    opacity: 1;
}

/* Modo Claro */
:root.light-mode .form-control {
    color: #1a1a1a !important;
}

:root.light-mode .form-control::placeholder {
    color: #6c757d !important;
    opacity: 1;
}

.form-control:focus {
    outline: none;
    border-color: #F07400;
    box-shadow: 0 0 0 3px rgba(240, 116, 0, 0.1);
    background: var(--bg-secondary);
}

/* Asegurar que el color del texto sea visible cuando está enfocado */
:root .form-control:focus {
    color: #e9ecef !important;
}

:root.light-mode .form-control:focus {
    color: #1a1a1a !important;
}

.form-control:disabled {
    background: var(--bg-primary);
    cursor: not-allowed;
    opacity: 0.7;
}

.form-control.readonly-field {
    background: var(--bg-tertiary);
    cursor: not-allowed;
    opacity: 0.7;
}

.form-control.locked {
    background: var(--bg-tertiary);
    cursor: not-allowed;
    opacity: 0.6;
    border-color: #dc3545;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

/* ============================================
   INPUT CON BOTÓN DE BORRAR
   ============================================ */

.input-with-delete {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.input-with-delete .form-control {
    flex: 1;
}

/* Botón de borrar con gradient */
.btn-delete-item {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    min-width: 36px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #dc3545, #ff6b6b);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(220, 53, 69, 0.3);
}

.btn-delete-item svg {
    width: 18px;
    height: 18px;
    color: white;
    transition: transform 0.2s ease;
}

.btn-delete-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.45);
    background: linear-gradient(135deg, #c82333, #e74c3c);
}

.btn-delete-item:hover svg {
    transform: scale(1.1);
}

.btn-delete-item:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.3);
}

.locked-indicator {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    color: #dc3545;
    font-weight: 600;
    margin-top: 0.25rem;
}

.locked-indicator svg {
    flex-shrink: 0;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1200px) {
    .routes-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

@media (max-width: 768px) {
    .bitacora-rutas-page .camara-header {
        flex-direction: column;
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .bitacora-rutas-page .camara-header h4 {
        position: static;
        width: 100%;
        text-align: center;
    }

    .cycle-info-header {
        flex-direction: column;
    }

    .cycle-info-header h3 {
        font-size: 1rem;
    }

    .comments-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .comments-header-left {
        flex-direction: column;
    }

    .routes-grid {
        grid-template-columns: 1fr;
    }

    .btn-save-all {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .comments-header-left h3 {
        font-size: 0.95rem;
    }

    .category-title h4 {
        font-size: 1rem;
    }

    .route-card {
        padding: 0.85rem;
    }
}

/* Estilos para items eliminados */
.has-deleted-items {
    border-color: #dc3545 !important;
    border-width: 2px !important;
}

.has-deleted-items:focus {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
}
