/* /mobile/styles/calendar.css */
/* Calendar grid and day styling with raid day logic - touching top/sides, buffer bottom */

.calendar-container {
    height: calc(100vh - 200px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--mobile-bg);
    display: flex;
    flex-direction: column;
    min-height: auto;
    padding: 16px;
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
    box-sizing: border-box;
    margin: 0;
    max-width: 100vw;
    width: 100vw;
    touch-action: pan-y;
}

.weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: var(--mobile-card);
    border-bottom: 1px solid var(--mobile-border);
    flex-shrink: 0;
    margin-bottom: 8px;
}

.weekday {
    padding: 10px 0;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--mobile-text-muted);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: var(--mobile-bg);
    flex: 1;
    min-height: 0;
    height: 100%;
    gap: 2px;
}

.day {
    border-right: 1px solid var(--mobile-border);
    border-bottom: 1px solid var(--mobile-border);
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 4px 2px 2px;
    cursor: pointer;
    background: var(--mobile-card);
    
    min-height: 0;
    height: 100%;
    border-radius: 4px;
}

/* Empty cells - make them more visually appealing */
.day.empty {
    background: var(--bg-primary);
    cursor: default;
    opacity: 0.4;
    position: relative;
}

.day.empty:hover {
    background: var(--bg-primary);
    opacity: 0.5;
}

.day.empty .day-number {
    color: transparent;
}

/* Empty indicator for visual balance */
.day.empty .empty-indicator {
    width: 4px;
    height: 4px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    margin: 2px auto;
    
}

.day.empty:hover .empty-indicator {
    background: rgba(255,255,255,0.2);
    transform: scale(1.2);
}

/* NON-RAID DAYS - Darker background */
.day:not(.raid-day):not(.empty) {
    background: var(--bg-primary);
    opacity: 0.7;
}

/* RAID DAYS - Lighter background for future dates */
.day.raid-day:not(.past-date) {
    background: var(--bg-tertiary);
    opacity: 1;
}

/* PAST RAID DAYS - Darker background like non-raid days */
.day.raid-day.past-date {
    background: var(--bg-primary);
    opacity: 0.6;
}

.day.today {
    background: var(--status-late-primary);
    color: white;
}

.day.selected {
    background: var(--blue-primary);
    color: white;
}

/* Heroic event styling - mobile optimized */
.day.heroic-event {
    border: 2px solid #FFD700 !important;
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.4) !important;
    position: relative !important;
}

.day.heroic-event::before {
    content: "👑" !important;
    position: absolute !important;
    top: 2px !important;
    right: 2px !important;
    font-size: 10px !important;
    z-index: 10 !important;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7) !important;
}

.day-number {
    font-size: 13px;
    font-weight: 600;
    color: var(--mobile-text);
    margin-bottom: 2px;
    text-align: center;
    flex-shrink: 0;
}

.day.today .day-number {
    background: var(--status-late-secondary);
    color: white;
    width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 2px;
    font-size: 11px;
}

.day.selected .day-number {
    color: white;
}

.callout-indicators {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin-top: 2px;
    min-height: 0;
}

/* Action buttons for days */
.day-action-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    background: var(--mobile-accent);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    
}

.day-action-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 6px rgba(0,0,0,0.3);
}

.day-action-btn.edit-btn {
    font-size: 12px;
}

.day-action-btn.add-btn {
    font-size: 16px;
    font-weight: bold;
}

/* Ensure day elements can contain action buttons */
.day {
    position: relative;
}
@media (max-width: 480px) {
    .calendar-container {
        padding: 12px;
        min-height: auto;
        margin: 0;
    }
    
    .day {
        padding: 3px 1px 1px;
    }
    
    .day-number {
        font-size: 12px;
    }
    
    .weekday {
        padding: 8px 0;
        font-size: 11px;
    }
}

@media (max-width: 360px) {
    .calendar-container {
        padding: 8px;
        min-height: auto;
        margin: 0;
    }
    
    .day-number {
        font-size: 11px;
    }
    
    .weekday {
        padding: 6px 0;
        font-size: 10px;
    }
}

/* iOS-wide safe-area padding (applies to Mobile Safari, including iPhone 16 series) */
@supports (-webkit-touch-callout: none) {
    .calendar-container {
        padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 40px);
    }
}

/* iPhone SE (2nd/3rd gen) – 375 x 667 CSS pixels */
@media (max-width: 375px) and (max-height: 667px) {
    .calendar-container {
        padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 120px);
    }
}

/* iPhone SE (1st gen) – 320 x 568 CSS pixels */
@media (max-width: 320px) and (max-height: 568px) {
    .calendar-container {
        padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 140px);
    }
}

/* Calendar footer for mobile */
.calendar-footer {
    margin-top: 12px;
    padding: 12px 16px;
    text-align: center;
    font-size: 11px;
    color: var(--mobile-text-muted);
    background: var(--mobile-card);
    border: 2px solid var(--mobile-border);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.calendar-footer a {
    color: var(--blue-accent);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.calendar-footer a:hover {
    color: var(--blue-primary);
    text-decoration: underline;
}

.calendar-footer .cc-badge {
    height: 18px;
    margin-left: 10px;
    vertical-align: middle;
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
