/* ============================================
   BITÁCORA DIARIA - Informe de Actividad
   ============================================ */

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

.bitacora-diaria-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-diaria-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-diaria-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-diaria-page .camara-header h4 {
    position: absolute;
    left: 0;
}

.bitacora-diaria-page .camara-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* ============================================
   CALENDAR WRAPPER - Animación de Cortina
   ============================================ */

.calendar-wrapper {
    transition: max-height 0.6s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.6s cubic-bezier(0.4, 0, 0.2, 1),
                margin 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    width: 100%;
    flex-shrink: 0;
}

.calendar-wrapper.calendar-visible {
    max-height: 600px;
    opacity: 1;
    transform: translateY(0);
    margin-bottom: 0.5rem;
}

.calendar-wrapper.calendar-hidden {
    max-height: 0 !important;
    opacity: 0;
    transform: translateY(-50px);
    margin-bottom: 0 !important;
    pointer-events: none;
}

/* Year Selector en Header Principal */
.calendar-year-selector-main {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--bg-primary);
    padding: 0.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    flex: 0 0 auto;
}

/* Usuarios Activos Compacto en Header */
.header-stat-compact {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 0 0 auto;
    position: absolute;
    right: 0;
    padding-right: 1rem;
}

.header-stat-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, #F07400, #00b4ff);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.header-stat-icon svg {
    color: white;
}

.header-stat-info {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
}

.header-stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1;
    white-space: nowrap;
}

.header-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.calendar-year-selector-main .year-btn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.calendar-year-selector-main .year-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #F07400, #00b4ff);
    border-color: transparent;
    color: white;
    transform: scale(1.05);
}

.calendar-year-selector-main .year-btn:active {
    transform: scale(0.95);
}

.calendar-year-selector-main .year-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.calendar-year-selector-main .year-display {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 80px;
    text-align: center;
}

/* Loading State */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    gap: 1rem;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(0);
}

.loading-text {
    color: var(--text-secondary);
    font-size: 1rem;
    margin: 0;
}

/* Empty State */
.empty-state {
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(0);
}

/* Error Message */
.error-message {
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(0);
}

/* ============================================
   REPORT CONTAINER
   ============================================ */

.time-blocks-report {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    width: 100%;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(0);
}

/* ============================================
   USER TIME BLOCK CONTAINER
   ============================================ */

.user-time-block-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 1.5rem;
    overflow: hidden;
    width: 100%;
}

.user-block-header {
    background: linear-gradient(135deg, rgba(240, 116, 0, 0.1), rgba(0, 180, 255, 0.1));
    padding: 0.5rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    position: relative;
    display: flex;
    align-items: center;
    min-height: 0;
}

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

.bitacora-diaria-page .user-avatar {
    width: 68px;
    height: 68px;
    min-width: 68px;
    min-height: 68px;
    border-radius: 50%;
    background: linear-gradient(135deg, #F07400, #00b4ff);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(240, 116, 0, 0.3);
    margin: 0;
    border: none;
}

.user-details {
    flex: 1;
}

.user-name {
    margin: 0 0 0.15rem 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

.user-stats-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.user-stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.user-stat-item svg {
    color: #F07400;
}

/* ============================================
   TIME BLOCKS GRID
   ============================================ */

.time-blocks-grid {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 1rem;
    padding: 1.5rem;
    overflow-x: auto;
}

.time-block-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    min-width: 320px;
    flex-shrink: 0;
}

.time-block-card.has-activities {
    border-color: rgba(240, 116, 0, 0.3);
}

.time-block-card.has-activities:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(240, 116, 0, 0.2);
    border-color: #F07400;
}

.time-block-card.empty-block {
    opacity: 0.6;
}

.time-block-header-card {
    background: linear-gradient(135deg, rgba(240, 116, 0, 0.15), rgba(0, 180, 255, 0.15));
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.time-block-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
}

/* ============================================
   ACTIVITIES LIST
   ============================================ */

.time-block-content {
    padding: 1rem;
}

.activities-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.activity-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem;
    transition: all 0.2s ease;
}

.activity-item:hover {
    border-color: #F07400;
    box-shadow: 0 2px 8px rgba(240, 116, 0, 0.1);
}

.activity-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    gap: 0.5rem;
}

.activity-type-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.activity-type-badge.type-tabulacion {
    background: linear-gradient(135deg, rgba(0, 180, 255, 0.2), rgba(0, 180, 255, 0.1));
    color: #00b4ff;
    border: 1px solid rgba(0, 180, 255, 0.3);
}

.activity-type-badge.type-pendientes {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.2), rgba(255, 193, 7, 0.1));
    color: #ffc107;
    border: 1px solid rgba(255, 193, 7, 0.3);
}

.activity-time {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-family: 'Courier New', monospace;
}

.activity-details {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.activity-route {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.activity-label {
    color: var(--text-secondary);
}

.activity-route strong {
    color: var(--text-primary);
    font-weight: 600;
}

.activity-ciclo {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-left: auto;
}

.activity-progress {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.progress-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.progress-start,
.progress-end {
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 600;
}

.progress-advance {
    padding: 0.25rem 0.5rem;
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.2), rgba(0, 255, 136, 0.1));
    color: #00ff88;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
}

.activity-duration {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.activity-duration svg {
    color: #F07400;
}

/* ============================================
   TIME BLOCK SUMMARY
   ============================================ */

.time-block-summary {
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.summary-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.summary-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.summary-value {
    font-size: 0.95rem;
    color: var(--text-primary);
    font-weight: 600;
}

.summary-value.progress-positive {
    background: linear-gradient(135deg, #00ff88, #00d4aa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============================================
   EMPTY BLOCK
   ============================================ */

.empty-block-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    gap: 0.5rem;
    opacity: 0.5;
}

.empty-block-content svg {
    color: var(--text-secondary);
}

.empty-block-content p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ============================================
   TOGGLE CALENDAR BUTTON (USER HEADER)
   ============================================ */

.toggle-calendar-btn-user-header {
    position: absolute;
    top: 0px;
    right: 1.5rem;
    width: 38px;
    height: 42px;
    border: none;
    background: linear-gradient(135deg, #F07400, #00b4ff);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    padding-bottom: 6px;
    box-shadow: 0 4px 12px rgba(240, 116, 0, 0.3);
    flex-shrink: 0;
    clip-path: polygon(0% 0%, 100% 0%, 100% 75%, 50% 100%, 0% 75%);
}

.toggle-calendar-btn-user-header svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.toggle-calendar-btn-user-header:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(240, 116, 0, 0.5);
}

.toggle-calendar-btn-user-header:active {
    transform: scale(0.98);
}

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

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

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

    .header-stat-compact {
        position: static;
        margin-top: 0.5rem;
    }

    .user-block-header {
        padding: 0.75rem 1.5rem;
    }

    .user-name {
        font-size: 1.1rem;
    }

    .bitacora-diaria-page .user-avatar {
        width: 68px;
        height: 68px;
        min-width: 68px;
        min-height: 68px;
        font-size: 1.25rem;
    }

    .time-blocks-grid {
        padding: 1rem;
        gap: 0.75rem;
    }

    .activity-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .user-stats-summary {
        gap: 1rem;
    }

    .activity-progress {
        flex-direction: column;
        align-items: flex-start;
    }

    .toggle-calendar-btn-user-header {
        width: 36px;
        height: 40px;
        top: 0px;
        right: 1rem;
    }

    .toggle-calendar-btn-user-header svg {
        width: 16px;
        height: 16px;
    }
}

@media (max-width: 480px) {
    .bitacora-diaria-page .camara-header {
        flex-direction: column;
    }

    .header-stat-compact {
        position: static;
        width: 100%;
        justify-content: center;
    }

    .user-info-header {
        flex-direction: column;
        text-align: center;
    }

    .user-stats-summary {
        justify-content: center;
    }

    .toggle-calendar-btn-user-header {
        width: 34px;
        height: 38px;
        top: 0px;
        right: 0.75rem;
    }

    .toggle-calendar-btn-user-header svg {
        width: 14px;
        height: 14px;
    }
}
