/* frontend-v3/css/pages/calendar.css */
@import url('../global.css');

.calendar-layout {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 30px;
    height: calc(100vh - 48px);
    min-height: 400px;
    transition: grid-template-columns var(--transition-normal) ease;
    overflow: hidden;
}

.calendar-layout.sidebar-collapsed {
    grid-template-columns: 1fr;
}

.calendar-layout.sidebar-collapsed .calendar-sidebar-pane {
    display: none;
}

/* Left Pane: Month Grid */
.calendar-sidebar-pane {
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: 100%;
    overflow-y: auto;
}

.month-selector-card {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.calendar-month-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.month-nav-btn {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all var(--transition-fast);
}

.month-nav-btn:hover {
    background: rgba(255,255,255,0.08);
    border-color: var(--border-color-hover);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    text-align: center;
}

.weekday-header {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    padding-bottom: 6px;
}

.day-cell {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    position: relative;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
}

.day-cell:hover:not(.empty) {
    background: rgba(255,255,255,0.05);
}

.day-cell.today {
    border-color: var(--accent-secondary);
    color: var(--accent-secondary);
}

.day-cell.selected {
    background: var(--accent-primary) !important;
    color: #fff !important;
    box-shadow: 0 4px 12px var(--accent-primary-glow);
}

.day-cell.empty {
    cursor: default;
}

.day-indicator-dot {
    position: absolute;
    bottom: 4px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--accent-secondary);
}

.day-cell.selected .day-indicator-dot {
    background: #fff;
}

/* Right Pane: Day Timeline */
.calendar-timeline-pane {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.timeline-pane-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.timeline-hours-scroll {
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: auto;
    background: rgba(13, 17, 30, 0.3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    position: relative;
}

.hour-row {
    display: grid;
    grid-template-columns: 80px 1fr;
    min-height: 120px;
    position: relative;
    border-bottom: 1px solid rgba(255,255,255,0.02);
}

.hour-row:last-child {
    border-bottom: none;
}

.hour-label {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-muted);
    padding-top: 10px;
    position: sticky;
    left: 0;
    background: #090e18; /* Solid match to blend with transparent parent */
    z-index: 15;
    padding-left: 10px;
}

.hour-content-slot {
    position: relative;
    width: 100%;
    height: 100%;
    transition: background var(--transition-fast);
    cursor: pointer;
    border-radius: var(--radius-sm);
}

.hour-content-slot:hover {
    background: rgba(255, 255, 255, 0.015);
}

/* Absolute Positioned Booking Cards in Timeline */
.timeline-booking-card {
    position: absolute;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-left: 4px solid var(--accent-primary);
    border-radius: var(--radius-md);
    padding: 8px 12px;
    color: var(--text-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
    box-shadow: 0 4px 15px rgba(0,0,0,0.25);
    transition: all var(--transition-fast);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    overflow: hidden;
}
/* Color Coding by Status */
.timeline-booking-card.status-requested {
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.25);
    border-left-color: #f59e0b;
}
.timeline-booking-card.status-approved {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.3);
    border-left-color: var(--accent-primary);
}
.timeline-booking-card.status-inprogress {
    background: rgba(6, 182, 212, 0.15);
    border-color: rgba(6, 182, 212, 0.3);
    border-left-color: var(--accent-secondary);
}
.timeline-booking-card.status-finished {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.3);
    border-left-color: var(--success);
}
.timeline-booking-card.status-denied {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    border-left-color: var(--danger);
}
.timeline-booking-card.status-private {
    background: rgba(107, 114, 128, 0.15);
    border-color: rgba(107, 114, 128, 0.3);
    border-left-color: var(--text-muted);
}
.timeline-booking-card:hover {
    background: rgba(20, 27, 48, 0.98) !important;
    border-color: var(--accent-primary) !important;
    transform: translateY(-2px);
    width: 280px !important;
    z-index: 150 !important;
    box-shadow: 0 12px 35px rgba(0,0,0,0.5);
    overflow: visible;
}

.booking-card-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 100%;
    min-width: 0;
}

.booking-card-client {
    font-weight: 700;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.booking-card-service {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.booking-card-time {
    font-size: 0.75rem;
    font-family: monospace;
    color: var(--accent-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.timeline-booking-card:hover .booking-card-client,
.timeline-booking-card:hover .booking-card-service,
.timeline-booking-card:hover .booking-card-time {
    white-space: normal;
    overflow: visible;
}

.booking-card-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast);
    z-index: 20;
}

.timeline-booking-card:hover .booking-card-actions {
    opacity: 1;
    pointer-events: auto;
}

.booking-card-btn.btn-delete {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--danger);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    padding: 0;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.booking-card-btn.btn-delete:hover {
    background: var(--danger) !important;
    border-color: var(--danger) !important;
    color: #fff !important;
    box-shadow: 0 0 8px var(--danger-glow);
}

/* Horizontal Week Selector for Mobile */
.mobile-week-selector {
    display: none;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-bottom: 16px;
    background: rgba(13,17,30,0.4);
    border: 1px solid var(--border-color);
    padding: 10px;
    border-radius: var(--radius-md);
}

.mobile-weekday-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    padding: 8px 4px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.mobile-weekday-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--text-muted);
}

.mobile-day-value {
    font-size: 0.85rem;
    font-weight: 700;
}

.mobile-weekday-item.active {
    background: var(--accent-primary);
    color: #fff;
    box-shadow: 0 4px 10px var(--accent-primary-glow);
}

.mobile-weekday-item.active .mobile-weekday-label {
    color: rgba(255,255,255,0.8);
}

.mobile-weekday-item.has-booking::after {
    content: '';
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--accent-secondary);
}

.mobile-weekday-item.active.has-booking::after {
    background: #fff;
}

/* Booking Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(3, 4, 8, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn var(--transition-fast) ease-in-out;
}

.booking-modal-card {
    width: 90%;
    max-width: 500px;
    padding: 30px;
    border-radius: var(--radius-lg);
    animation: slideIn var(--transition-normal) cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.modal-close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color var(--transition-fast);
}

.modal-close-btn:hover {
    color: var(--text-primary);
}

/* Responsiveness adjustments for Calendar layout */
@media(max-width: 768px) {
    .calendar-layout {
        grid-template-columns: 1fr;
        height: auto;
    }
    
    .calendar-sidebar-pane {
        display: none; /* Hide full month grid on mobile by default */
    }
    
    .mobile-week-selector {
        display: grid; /* Show horizontal week selector stripe */
    }

    #btn-toggle-cal-sidebar {
        display: none !important;
    }
}

.timeline-bookings-container {
    position: absolute;
    left: 100px;
    top: 20px;
    bottom: 20px;
    pointer-events: none;
}

.timeline-booking-card {
    pointer-events: auto;
}
