/* =============================================
   CALENDAR.CSS - Weekly Calendar View Styling
   ============================================= */

/* Calendar Main Container */
.calendar-main {
    flex: 1;
    min-width: 0;  /* Allow shrinking in flex layout */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #FFFFFF;
    transition: margin-right var(--duration-slow) var(--ease-out);
}

/* Calendar Grid Container */
.calendar-grid-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.calendar-grid {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: auto;
}

/* =============================================
   DAY HEADERS
   ============================================= */

.day-headers {
    display: grid;
    grid-template-columns: 56px repeat(7, 1fr);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: #FFFFFF;
    z-index: 10;
}

.timezone-label {
    font-size: 10px;
    color: var(--warm-gray);
    padding: var(--space-2) var(--space-2);
    text-align: right;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding-bottom: var(--space-3);
    font-weight: 500;
}

.day-header-cell {
    text-align: center;
    padding: var(--space-2) 0 var(--space-3);
    border-left: 1px solid var(--border);
    position: relative;
}

.day-header-cell .day-name {
    font-size: 11px;
    color: var(--warm-gray);
    text-transform: uppercase;
    font-weight: 500;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-1);
}

.day-header-cell .day-number {
    font-family: var(--font-display);
    font-size: 26px;
    color: var(--charcoal);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    border-radius: var(--radius-lg);
    cursor: pointer;
    font-weight: 400;
    transition: all var(--duration-fast) var(--ease-out);
    position: relative;
}

.day-header-cell .day-number:hover {
    background: var(--cream);
}

.day-header-cell .day-number.today {
    background: var(--ink);
    color: var(--white);
}

.day-header-cell .day-number.today:hover {
    background: var(--charcoal);
}

/* Cycle Phase Indicator Bar under day number */
.day-header-cell .phase-indicator {
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 3px;
    border-radius: var(--radius-full);
}

.day-header-cell .phase-indicator.menstrual { background: var(--phase-menstrual); }
.day-header-cell .phase-indicator.follicular { background: var(--phase-follicular); }
.day-header-cell .phase-indicator.ovulation { background: var(--phase-ovulation); }
.day-header-cell .phase-indicator.luteal { background: var(--phase-luteal); }

/* Weekend styling - keep white background */
.day-header-cell.weekend {
    background: #FFFFFF;
}

.day-header-cell.weekend .day-name {
    color: var(--stone);
}

/* =============================================
   ALL DAY SECTION
   ============================================= */

.all-day-section {
    display: grid;
    grid-template-columns: 56px repeat(7, 1fr);
    border-bottom: 1px solid var(--border);
    min-height: 32px;
}

.all-day-label {
    font-size: 10px;
    color: var(--warm-gray);
    padding: var(--space-2) var(--space-2) var(--space-2) 0;
    text-align: right;
    font-weight: 500;
}

.all-day-cell {
    border-left: 1px solid var(--border);
    padding: var(--space-1);
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease-out);
    min-height: 32px;
}

.all-day-cell:hover {
    background: var(--coral-soft);
}

.all-day-cell.weekend {
    background: #FFFFFF;
}

.all-day-cell.weekend:hover {
    background: var(--cream);
}

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

.time-grid {
    display: grid;
    grid-template-columns: 56px repeat(7, 1fr);
    flex: 1;
}

.time-column {
    border-right: 1px solid var(--border);
    background: #FFFFFF;
}

/* Time slots in the time gutter - clean, no lines */
.time-slot {
    height: 48px;
    border-bottom: none;  /* No horizontal lines in time gutter */
    position: relative;
    background: transparent;
}


.time-label {
    font-size: 10px;
    color: var(--warm-gray);
    text-align: right;
    padding-right: var(--space-2);
    position: relative;
    top: -7px;
    display: block;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

/* Day Columns */
.day-column {
    border-left: 1px solid var(--border);
    position: relative;
    background: #FFFFFF;
}

.day-column.weekend {
    background: #FFFFFF;
}

.hour-slot {
    height: 48px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease-out);
}


.hour-slot:hover {
    background: var(--coral-soft);
}

.day-column.weekend .hour-slot:hover {
    background: var(--cream);
}

/* =============================================
   CURRENT TIME INDICATOR
   ============================================= */

.current-time-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--coral);
    z-index: 20;
    pointer-events: none;
}

.current-time-line::before {
    content: '';
    position: absolute;
    left: -5px;
    top: -4px;
    width: 10px;
    height: 10px;
    background: var(--coral);
    border-radius: var(--radius-full);
    box-shadow: 0 0 0 3px rgba(232, 132, 124, 0.2);
}

/* =============================================
   EVENTS ON CALENDAR
   ============================================= */

.event {
    position: absolute;
    left: 3px;
    right: 3px;
    border-radius: var(--radius-md);
    padding: var(--space-2) var(--space-3);
    font-size: 12px;
    overflow: hidden;
    cursor: pointer;
    z-index: 5;
    transition: all var(--duration-fast) var(--ease-out);
    border: 1px solid transparent;
}

.event:hover {
    box-shadow: var(--shadow-md);
    z-index: 10;
    transform: translateY(-1px) scale(1.01);
}

.event.selected {
    box-shadow: var(--shadow-lg);
    z-index: 15;
    transform: scale(1.02);
}

/* Event Color Variants */
.event-coral {
    background: var(--coral-soft);
    border-color: rgba(232, 132, 124, 0.2);
    color: var(--ink);
}

.event-coral::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--coral);
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.event-sage {
    background: var(--sage-soft);
    border-color: rgba(124, 181, 160, 0.2);
    color: var(--ink);
}

.event-sage::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--sage);
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.event-lavender {
    background: var(--lavender-soft);
    border-color: rgba(155, 142, 196, 0.2);
    color: var(--ink);
}

.event-lavender::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--lavender);
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.event-honey {
    background: var(--honey-soft);
    border-color: rgba(232, 197, 108, 0.2);
    color: var(--ink);
}

.event-honey::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--honey);
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

/* Solid color events (for high-priority) */
.event-solid-coral {
    background: var(--coral);
    color: var(--white);
}

.event-solid-sage {
    background: var(--sage);
    color: var(--white);
}

/* Event Content */
.event .event-title {
    font-weight: 500;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-left: var(--space-1);
    line-height: 1.3;
}

.event .event-time {
    font-size: 11px;
    opacity: 0.75;
    margin-left: var(--space-1);
    margin-top: 2px;
}

/* Short events (less than 1 hour) */
.event.short {
    padding: var(--space-1) var(--space-2);
}

.event.short .event-title {
    font-size: 11px;
}

.event.short .event-time {
    display: none;
}

/* =============================================
   EMPTY STATE
   ============================================= */

.calendar-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-16);
    color: var(--warm-gray);
    text-align: center;
}

.calendar-empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: var(--space-4);
    opacity: 0.5;
}

.calendar-empty-state h3 {
    font-family: var(--font-display);
    font-size: 18px;
    color: var(--charcoal);
    margin-bottom: var(--space-2);
}

.calendar-empty-state p {
    font-size: 14px;
    max-width: 280px;
}

/* =============================================
   RESPONSIVE CALENDAR STYLES
   ============================================= */

/* Tablet: 768px - 1200px */
@media (max-width: 1200px) {
    .day-header-cell .day-number {
        width: 38px;
        height: 38px;
        font-size: 22px;
    }

    .timezone-label {
        font-size: 9px;
    }

    .day-header-cell .day-name {
        font-size: 10px;
    }
}

/* Mobile: < 768px */
@media (max-width: 768px) {
    /* Make calendar horizontally scrollable */
    .calendar-grid-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .calendar-grid {
        min-width: 700px;
    }

    /* Smaller day headers */
    .day-headers {
        grid-template-columns: 48px repeat(7, 1fr);
    }

    .day-header-cell .day-number {
        width: 32px;
        height: 32px;
        font-size: 18px;
    }

    .day-header-cell .day-name {
        font-size: 9px;
        margin-bottom: 2px;
    }

    .timezone-label {
        font-size: 8px;
        padding: var(--space-1);
    }

    /* Smaller time grid */
    .time-grid {
        grid-template-columns: 48px repeat(7, 1fr);
    }

    .time-slot {
        height: 40px;
    }

    .time-label {
        font-size: 9px;
    }

    .hour-slot {
        height: 40px;
    }

    /* All day section */
    .all-day-section {
        grid-template-columns: 48px repeat(7, 1fr);
        min-height: 28px;
    }

    .all-day-label {
        font-size: 8px;
    }

    /* Phase indicator */
    .day-header-cell .phase-indicator {
        width: 18px;
        height: 2px;
        bottom: -6px;
    }

    /* Events */
    .event {
        padding: var(--space-1) var(--space-2);
        font-size: 11px;
    }

    .event .event-title {
        font-size: 11px;
    }

    .event .event-time {
        font-size: 9px;
    }

    .event.short {
        padding: 2px var(--space-1);
    }

    .event.short .event-title {
        font-size: 10px;
    }

    /* Current time indicator */
    .current-time-line::before {
        width: 8px;
        height: 8px;
        left: -4px;
        top: -3px;
    }
}
