/* Custom Calendar Styles */
.calendar-container {
    display: flex;
    flex-direction: column;
    min-height: 500px;
    height: auto;
    overflow: visible;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.calendar-grid {
    display: grid;
    grid-template-rows: auto 1fr;
    gap: 1px;
    background-color: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 1rem;
    overflow: hidden;
    flex: 1;
}

.calendar-days-header {
    display: grid;
    grid-template-columns: repeat(var(--grid-cols, 7), 1fr);
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
}

.calendar-day-label {
    padding: 1rem;
    text-align: center;
    font-weight: 700;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #8B5CF6;
    border-bottom: 2px solid rgba(139, 92, 246, 0.3);
}

.calendar-body {
    display: grid;
    grid-template-columns: repeat(var(--grid-cols, 7), 1fr);
    grid-auto-rows: minmax(120px, 1fr);
}

.calendar-cell {
    background: white;
    padding: 0.5rem;
    border: 0.5px solid rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
    position: relative;
}

.dark .calendar-cell {
    background: #2a1642;
    border-color: rgba(255, 255, 255, 0.05);
}

.calendar-cell.other-month {
    background: #f9fafb;
    opacity: 0.5;
}

.dark .calendar-cell.other-month {
    background: #1e102f;
}

.calendar-cell.today {
    background: rgba(16, 185, 129, 0.05);
}

.calendar-cell.today .day-number {
    background: #10B981;
    color: white;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.day-number {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #6B7280;
}

.dark .day-number {
    color: #9CA3AF;
}

.event-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.event-item {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    color: white;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.1s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.event-item:hover {
    transform: scale(1.02);
    z-index: 10;
    white-space: normal;
    overflow: visible;
    height: auto;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
}

/* Toggle Styles */
.view-toggle {
    display: flex;
    background: rgba(139, 92, 246, 0.1);
    padding: 0.25rem;
    border-radius: 0.75rem;
    border: 1px solid rgba(139, 92, 246, 0.2);
}

.toggle-btn {
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.toggle-btn.active {
    background: #8B5CF6;
    color: white;
    box-shadow: 0 4px 6px rgba(139, 92, 246, 0.3);
}

.toggle-btn:not(.active):hover {
    background: rgba(139, 92, 246, 0.2);
}

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

.calendar-grid {
    animation: fadeIn 0.5s ease-out;
}

.sticky-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: #f8f9fa;
    padding: 1rem 0.5rem;
    border-bottom: 1px solid rgba(139, 92, 246, 0.1);
}

.dark .sticky-header {
    background: #1a0b2e;
    border-bottom-color: rgba(139, 92, 246, 0.2);
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .calendar-grid {
        display: none; /* Hide grid on mobile if we show list */
    }

    .mobile-list-view {
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
        padding-bottom: 2rem;
    }

    .mobile-day-card {
        background: white;
        border-radius: 1.25rem;
        box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
        overflow: hidden;
        border: 1px solid rgba(139, 92, 246, 0.1);
    }

    .dark .mobile-day-card {
        background: #2a1642;
        border-color: rgba(139, 92, 246, 0.2);
    }

    .mobile-day-header {
        background: rgba(139, 92, 246, 0.05);
        padding: 0.75rem 1.25rem;
        border-bottom: 1px solid rgba(139, 92, 246, 0.1);
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .mobile-day-name {
        font-weight: 800;
        color: #8B5CF6;
        text-transform: uppercase;
        font-size: 0.75rem;
        letter-spacing: 0.05em;
    }

    .mobile-day-date {
        font-weight: 600;
        color: #6B7280;
        font-size: 0.875rem;
    }

    .dark .mobile-day-date {
        color: #9CA3AF;
    }

    .mobile-event-item {
        padding: 1rem 1.25rem;
        border-bottom: 1px solid rgba(0,0,0,0.03);
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
    }

    .dark .mobile-event-item {
        border-bottom-color: rgba(255,255,255,0.03);
    }

    .mobile-event-item:last-child {
        border-bottom: none;
    }

    .mobile-event-class {
        font-size: 0.65rem;
        font-weight: 800;
        text-transform: uppercase;
        padding: 0.1rem 0.5rem;
        border-radius: 1rem;
        width: fit-content;
        color: white;
    }

    .mobile-event-text {
        font-size: 1rem;
        font-weight: 600;
        color: #111827;
    }

    .dark .mobile-event-text {
        color: #F3F4F6;
    }

    .mobile-event-encargado {
        font-size: 0.75rem;
        color: #6B7280;
    }

    .dark .mobile-event-encargado {
        color: #9CA3AF;
    }
}

/* Modal Styles */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.7);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 1.5rem;
}

.modal-backdrop.show {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: white;
    width: 95%;
    max-width: 500px;
    max-height: 90vh;
    border-radius: 1.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    scrollbar-width: thin;
    scrollbar-color: rgba(139, 92, 246, 0.3) transparent;
}

.modal-content::-webkit-scrollbar {
    width: 6px;
}

.modal-content::-webkit-scrollbar-thumb {
    background-color: rgba(139, 92, 246, 0.3);
    border-radius: 10px;
}

.dark .modal-content {
    background: #2a1642;
    border: 1px solid rgba(139, 92, 246, 0.2);
}

.modal-backdrop.show .modal-content {
    transform: scale(1);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dark .modal-header {
    border-color: rgba(255, 255, 255, 0.05);
}

.modal-body {
    padding: 1.5rem;
}

.detail-row {
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid rgba(0,0,0,0.03);
}

.dark .detail-row {
    border-bottom-color: rgba(255,255,255,0.03);
}

.detail-row:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.detail-label {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    color: #8B5CF6;
    margin-bottom: 0.5rem;
    display: flex;
    items-center;
    gap: 0.5rem;
}

.detail-value {
    font-size: 1.1rem;
    color: #1f2937;
    font-weight: 500;
    line-height: 1.5;
}

.dark .detail-value {
    color: #f3f4f6;
}

.close-modal {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.close-modal:hover {
    background: rgba(0,0,0,0.05);
}

.dark .close-modal:hover {
    background: rgba(255,255,255,0.05);
}

/* Timeline Styles */
.timeline-container {
    margin-top: 1.5rem;
    padding-left: 1rem;
    border-left: 2px solid rgba(139, 92, 246, 0.2);
    position: relative;
}

.timeline-item {
    position: relative;
    padding-bottom: 2rem;
    padding-left: 1.5rem;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-dot {
    position: absolute;
    left: -1.45rem;
    top: 0.25rem;
    width: 12px;
    height: 12px;
    background: #8B5CF6;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.1);
}

.dark .timeline-dot {
    border-color: #2a1642;
}

.timeline-time {
    font-size: 0.75rem;
    font-weight: 800;
    color: #8B5CF6;
    margin-bottom: 0.25rem;
}

.timeline-actividad {
    font-weight: 700;
    color: #1f2937;
    font-size: 1rem;
}

.dark .timeline-actividad {
    color: white;
}

.timeline-responsable {
    font-size: 0.8rem;
    color: #6B7280;
    margin-top: 0.25rem;
}

.dark .timeline-responsable {
    color: #9CA3AF;
}

.sub-timeline {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: rgba(139, 92, 246, 0.05);
    border-radius: 1rem;
    font-size: 0.75rem;
}

.sub-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px dashed rgba(139, 92, 246, 0.1);
    padding-bottom: 0.5rem;
}

.sub-item:last-child {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.badge-unidad {
    padding: 0.25rem 0.75rem;
    border-radius: 2rem;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    margin-left: 0.5rem;
    color: white;
}
