/**
 * Month Calendar View Styles
 * Clean, modern calendar grid with responsive design
 */

/* ============================================================================
   MONTH CALENDAR CONTAINER
   ============================================================================ */

.month-calendar-container {
    margin: 20px 0;
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
}

/* ============================================================================
   MONTH GRID WRAPPER
   ============================================================================ */

.month-grid-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ============================================================================
   MONTH GRID
   ============================================================================ */

.month-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: #e0e0e0;
    min-width: 700px;
}

/* Weekday Headers */
.month-grid-header {
    background: #f5f5f5;
    padding: 12px 8px;
    text-align: center;
    font-weight: 600;
    font-size: 12px;
    color: #666;
    border-bottom: 2px solid #e0e0e0;
}

/* ============================================================================
   GRID DAY CELLS
   ============================================================================ */

.month-grid-day {
    background: #fff;
    min-height: 100px;
    max-height: 100px;
    padding: 8px;
    position: relative;
    cursor: pointer;
    transition: background-color 0.2s;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.month-grid-day:hover {
    background: #f9f9f9;
}

/* Day Number */
.month-grid-day .day-number {
    display: inline-block;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 4px;
    flex-shrink: 0;
}

/* Other Month Days */
.month-grid-day.other-month {
    background: #fafafa;
    opacity: 0.5;
}

.month-grid-day.other-month .day-number {
    color: #999;
}

/* Past Days */
.month-grid-day.past {
    opacity: 0.6;
}

/* Today */
.month-grid-day.today .day-number {
    background: #007cff;
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* ============================================================================
   DAY EVENTS
   ============================================================================ */

.day-events {
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin-top: 3px;
    flex: 1;
    overflow: hidden;
}

.day-event {
    display: block;
    padding: 2px 4px;
    /* Background color set via inline style from product settings */
    color: #fff;
    font-size: 11px;
    line-height: 1.2;
    border-radius: 3px;
    text-decoration: none;
    transition: filter 0.2s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
    margin-bottom: 1px;
}

/* Desktop: Show time and title */
.event-content-desktop {
    display: inline;
}

.event-content-mobile {
    display: none;
}

.day-event .event-time {
    font-weight: 600;
    font-size: 10px;
}

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

/* ============================================================================
   MULTI-DAY EVENT SPANS
   ============================================================================ */

/* Event that spans multiple days */
.day-event.event-span {
    position: relative;
    margin-bottom: 0;
}

/* Starting day of span - rounded left only */
.day-event.span-start {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    margin-right: -1px;
}

/* Middle days of span - no rounding, connects on both sides */
.day-event.span-middle {
    border-radius: 0;
    margin-left: -1px;
    margin-right: -1px;
}

/* Ending day of span - rounded right only */
.day-event.span-end {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    margin-left: -1px;
}

/* Single day span (start and end on same day) */
.day-event.span-start.span-end {
    border-radius: 3px;
    margin-left: 0;
    margin-right: 0;
}

/* ============================================================================
   EVENT COLORS - Custom per product
   ============================================================================ */

/* 
 * Event colors are now set per-product in admin via color picker
 * Applied as inline styles: style="background-color: #color;"
 * Default color: #28a745 (green)
 */

/* Universal hover effect - darkens any color */
.day-event:hover {
    filter: brightness(0.9);
}

/* ============================================================================
   SELECTED DAY DETAILS (MOBILE)
   ============================================================================ */

.selected-day-details {
    border-top: 1px solid #e0e0e0;
    background: #fff;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.details-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid #e0e0e0;
}

.details-date {
    font-weight: 600;
    font-size: 16px;
    color: #333;
}

.close-details {
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.close-details:hover {
    background: #f5f5f5;
    color: #333;
}

.details-content {
    padding: 16px;
}

.detail-event {
    padding: 16px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 12px;
    transition: box-shadow 0.2s;
}

.detail-event:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.detail-event:last-child {
    margin-bottom: 0;
}

.detail-event h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
    color: #333;
}

.detail-event-time {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #666;
    margin-bottom: 6px;
}

.detail-event-location {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #666;
    margin-bottom: 6px;
}

.detail-event-price {
    font-size: 14px;
    font-weight: 600;
    color: #007cff;
    margin-bottom: 8px;
}

.detail-event-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.detail-event-status.status-open {
    background: #d4edda;
    color: #155724;
}

.detail-event-status.status-booked {
    background: #e2e3e5;
    color: #383d41;
}

.detail-event-status.status-closed {
    background: #f8d7da;
    color: #721c24;
}

.detail-event-link {
    display: inline-block;
    padding: 8px 16px;
    background: #007cff;
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    transition: background-color 0.2s;
}

.detail-event-link:hover {
    background: #0056b3;
    color: #fff;
}

/* Desktop-specific rich detail styles */
@media (min-width: 769px) {
    .selected-day-details {
        margin-top: 20px;
        border-top: 2px solid #e0e0e0;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    }
    
    .details-header {
        padding: 16px 20px;
        background: #f8f9fa;
    }
    
    .details-date {
        font-size: 18px;
    }
    
    .details-content {
        padding: 20px;
        max-height: 500px;
        overflow-y: auto;
    }
    
    .detail-event {
        background: #f8f9fa;
        border: none;
        border-left: 4px solid #007cff;
        padding: 20px;
        margin-bottom: 16px;
    }
    
    .detail-event h4 {
        font-size: 18px;
        margin-bottom: 12px;
    }
    
    .detail-event-meta {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 12px;
        margin-bottom: 12px;
    }
    
    .detail-event-meta-item {
        display: flex;
        align-items: flex-start;
        gap: 8px;
        font-size: 14px;
        color: #555;
    }
    
    .detail-event-meta-item i {
        color: #007cff;
        margin-top: 2px;
        flex-shrink: 0;
    }
    
    .detail-event-meta-item strong {
        font-weight: 600;
        color: #333;
    }
    
    .detail-event-description {
        font-size: 14px;
        color: #666;
        line-height: 1.6;
        margin: 12px 0;
        padding-top: 12px;
        border-top: 1px solid #e0e0e0;
    }
    
    .detail-event-link {
        padding: 10px 20px;
        font-size: 14px;
    }
}

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

/* Tablet */
@media (max-width: 768px) {
    .month-grid {
        min-width: 600px;
    }
    
    .month-grid-day {
        min-height: 80px;
        max-height: 80px;
        padding: 5px;
    }
    
    .day-events {
        gap: 1px;
        margin-top: 2px;
    }
    
    .day-event {
        font-size: 10px;
        padding: 2px 3px;
        line-height: 1.1;
    }
    
    .day-event .event-time {
        font-size: 9px;
    }
    
    .day-event .event-title {
        font-size: 10px;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .month-grid {
        min-width: 350px;
    }
    
    .month-grid-header {
        padding: 6px 4px;
        font-size: 10px;
    }
    
    .month-grid-day {
        min-height: 70px;
        max-height: 70px;
        padding: 3px;
    }
    
    .month-grid-day .day-number {
        font-size: 12px;
        margin-bottom: 2px;
    }
    
    .day-events {
        gap: 2px;
        margin-top: 3px;
    }
    
    /* Mobile: Show ONLY color bars, no text */
    .day-event {
        padding: 0;
        height: 6px;
        min-height: 6px;
        border-radius: 2px;
        margin-bottom: 2px;
        cursor: pointer;
    }
    
    /* Hide text content on mobile */
    .event-content-desktop {
        display: none;
    }
    
    /* Show empty color bar on mobile */
    .event-content-mobile {
        display: block;
        height: 6px;
        width: 100%;
    }
    
    .day-event .event-time,
    .day-event .event-title {
        display: none;
    }
    
    /* Multi-day spans on mobile - still color bars */
    .day-event.span-start,
    .day-event.span-middle,
    .day-event.span-end {
        height: 6px;
        border-radius: 2px;
    }
    
    .day-event.span-start {
        border-top-right-radius: 0;
        border-bottom-right-radius: 0;
    }
    
    .day-event.span-middle {
        border-radius: 0;
    }
    
    .day-event.span-end {
        border-top-left-radius: 0;
        border-bottom-left-radius: 0;
    }
}

/* Desktop - larger grid cells */
@media (min-width: 1024px) {
    .month-grid {
        min-width: 900px;
    }
    
    .month-grid-day {
        min-height: 120px;
        max-height: 120px;
        padding: 8px;
    }
    
    .day-event {
        font-size: 11px;
        padding: 2px 5px;
    }
    
    .day-event .event-time {
        font-size: 10px;
    }
    
    .day-event .event-title {
        font-size: 11px;
    }
}

/* ============================================================================
   CATEGORY FILTER INTEGRATION
   ============================================================================ */

/* Hide filtered events */
.day-event[style*="display: none"] {
    display: none !important;
}

/* ============================================================================
   PRINT STYLES
   ============================================================================ */

@media print {
    .month-calendar-container {
        box-shadow: none;
    }
    
    .month-grid-day:hover {
        background: #fff;
    }
    
    .selected-day-details {
        display: none !important;
    }
}