/* Booking Calendar Styles */

.calendar-container {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    overflow: hidden;
    min-height: 600px;
}

.calendar-header {
    background-color: #f8f9fa;
    padding: 10px;
    border-bottom: 1px solid #dee2e6;
    font-weight: 500;
    position: sticky;
    top: 56px; /* keep below the navbar */
    z-index: 10;
}

.calendar-week-view {
    min-height: 100%;
    overflow-y: auto;
    position: relative;
}

#calendarHeaders {
    position: sticky;
    top: 56px; /* keep below the navbar */
    z-index: 20;
    background-color: #fff;
}

#mobileDayHeader {
    position: sticky;
   
    z-index: 20;
    background-color: #fff;
}

.calendar-grid {
    text-align: center;
}

.calendar-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.calendar-nav h2 {
    margin: 0;
    font-size: 1.5rem;
    color: #333;
}

.nav-buttons {
    display: flex;
    gap: 10px;
}

.day-header {
    background-color: #e9ecef;
    padding: 10px;
    text-align: center;
    font-weight: 600;
    border-bottom: 2px solid #dee2e6;
}

.day-column {
    border-right: 1px solid #dee2e6;
   
    position: relative;
}

.day-column:last-child {
    border-right: none;
}

.event-card {
    position: absolute;
    left: 2px;
    right: 2px;
    padding: 5px;
    border-radius: 4px;
    background: #fff;
    border: 1px solid #dee2e6;
    font-size: 0.875rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    overflow: hidden;
}

.event-card:hover {
    transform: scale(1.02);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    z-index: 100;
}

.event-card.available {
    background: #d4edda;
    border-color: #c3e6cb;
}

.event-card.limited {
    background: #fff3cd;
    border-color: #ffeeba;
}

.event-card.full {
    background: #f8d7da;
    border-color: #f5c6cb;
}

/* Styling for hold bookinger */
.event-card.hold-booking,
.mobile-event-card.hold-booking {
    border-left: 1px solid #333333 !important;
    border-color: #333333;
}

.event-card.hold-booking .event-title,
.mobile-event-card.hold-booking .event-title {
    font-weight: bold;
}

.event-client {
    font-size: 0.75rem;
    font-style: italic;
    margin-top: 2px;
}

.event-title {
    font-weight: 400;
    margin-bottom: 2px;
    white-space: normal;
    overflow-wrap: break-word;
    word-wrap: break-word;
    line-height: 1.3;
}

.event-time {
    font-size: 0.75rem;
    color: #666;
}

.event-instructor {
    font-size: 0.75rem;
    color: #666;
}

.spots-available {
    font-size: 0.75rem;
    color: #28a745;
}

.spots-limited {
    color: #ffc107;
}

.spots-full {
    color: #dc3545;
}

.hour-marker {
    position: absolute;
    left: 0;
    right: 0;
    border-top: 1px solid #f0f0f0;
    pointer-events: none;
    height: 60px; /* 1 hour = 60px */
}

.hour-label {
    position: absolute;
    left: -50px;
    top: -8px;
    width: 45px;
    text-align: right;
    font-size: 0.75rem;
    color: #666;
    pointer-events: none;
}

.current-time-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background-color: #dc3545;
    z-index: 5;
}

.current-time-label {
    position: absolute;
    left: -50px;
    transform: translateY(-50%);
    background: #dc3545;
    color: white;
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 0.75rem;
}

/* Mobile Styles */
.mobile-event-card {
    margin-bottom: 8px;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    z-index: 50; /* Higher than hour markers and hour-events */
    user-select: none;
    -webkit-tap-highlight-color: rgba(0,0,0,0.1);
    touch-action: manipulation; /* Improve touch responsiveness */
    pointer-events: auto; /* Ensure events are captured */
}

.mobile-event-card:hover,
.mobile-event-card:active {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.mobile-event-card.available {
    background: #d4edda;
    border-color: #c3e6cb;
}

.mobile-event-card.limited {
    background: #fff3cd;
    border-color: #ffeeba;
}

.mobile-event-card.full {
    background: #f8d7da;
    border-color: #f5c6cb;
}

.mobile-event-card.available {
    border-left: 4px solid #28a745;
}

.mobile-event-card.limited {
    border-left: 4px solid #ffc107;
}

.mobile-event-card.full {
    border-left: 4px solid #dc3545;
}

.hour-marker {
    border-top: 1px solid #f0f0f0;
    padding: 8px;
    min-height: 80px; /* Increased height */
    margin-bottom: 8px;
    background: #fff;
}

.hour-events {
    padding-left: 12px;
    position: relative;
    z-index: 15; /* Between hour markers and event cards */
    pointer-events: none; /* Allow clicks to pass through to event cards */
}

.hour-events > * {
    pointer-events: auto; /* Re-enable clicks on child elements (event cards) */
}

.hour-label {
    font-weight: 500;
    color: #666;
    margin-bottom: 12px;
    font-size: 1rem;
}

/* Mobile Day View Styles */
.calendar-day-view {
    background: #fff;
    height: 100%;
    overflow-y: visible;
    position: relative;
}

#mobileDayGrid {
    min-height: auto;
    position: relative;
    z-index: 1;
}

.mobile-events-container {
    width: 100%;
}

/* Responsive adjustments */
@media (max-width: 767px) {
    .event-card {
        position: relative;
        left: 0;
        right: 0;
        margin: 4px;
    }

    .event-card.available {
        border-left: 4px solid #28a745;
    }

    .event-card.limited {
        border-left: 4px solid #ffc107;
    }

    .event-card.full {
        border-left: 4px solid #dc3545;
    }

    .hour-marker {
        border-top: 1px solid #f0f0f0;
        padding: 8px;
        height: auto;
        min-height: 60px;
        position: relative; /* Override absolute positioning for mobile */
        left: auto;
        right: auto;
        pointer-events: none; /* Don't capture clicks on marker itself */
    }

    .hour-label {
        position: relative;
        left: 0;
        width: auto;
        text-align: left;
        font-weight: 500;
        margin-bottom: 8px;
        pointer-events: none; /* Don't capture clicks on label */
    }

    .mobile-event {
        margin: 4px 0;
        padding: 8px;
        border: 1px solid #dee2e6;
        border-radius: 4px;
        background: #fff;
    }

    .mobile-event:hover {
        background: #f8f9fa;
    }

    .calendar-nav h2 {
        font-size: 1.25rem;
    }
    
    .nav-buttons {
        flex-direction: column;
        gap: 5px;
    }
    
    .event-title {
        font-size: 0.9rem;
        margin-bottom: 4px;
    }

    .event-time, .event-instructor {
        font-size: 0.875rem;
        color: #666;
        margin-bottom: 2px;
    }

    .spots-available, .spots-limited, .spots-full {
        font-size: 0.875rem;
        font-weight: 500;
    }

    .calendar-day-view {
        background: #f8f9fa;
        height: calc(100vh - 200px);
        overflow-y: auto;
        position: relative;
        z-index: 1;
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    }

    #mobileDayGrid {
        padding: 12px;
        min-height: 1020px;
        position: relative;
        z-index: 1;
    }

    /* Ensure mobile event cards are fully interactive */
    .mobile-event-card {
        min-height: 60px; /* Ensure adequate touch target size */
        z-index: 100 !important; /* Ensure it's above everything */
        pointer-events: auto !important;
        touch-action: manipulation !important;
    }
    
    /* Ensure child elements don't block clicks */
    .mobile-event-card * {
        pointer-events: none;
    }
}

/* Hold booking styling */
.hold-booking-event {
    border-left: 4px solid #0d6efd !important;
    font-weight: 500 !important;
}

/* Hold Detaljer (booking summary) refinements */
#holdSummary {
    border: 1px solid #e9ecef;
    border-radius: 4px;
}

#holdSummary .hold-summary-header {
    display: flex;
    align-items: center;
    justify-content: space-between; /* push end item to the right */
    gap: 6px;
}

.guest-item {
    border-radius: 4px;
}

#holdSummary .card-header {
    background-color: #e7f3ff; /* subtle tint of blue */
    padding: 8px 12px;
    border-bottom: 1px solid #b3d9ff;
}

#holdSummary .card-header .d-flex {
    align-items: center;
}

#holdSummary .hold-summary-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: #0a58ca;
}

#holdSummary .hold-summary-spots {
    margin-left: auto;
    font-size: 0.8rem;
    color: #6c757d;
}

#holdSummary .hold-summary-title i {
    font-size: 1rem;
    margin-right: 4px;
    color: #0d6efd;
}

#holdSummary .card-body {
    padding: 12px;
}

#holdSummary p {
    margin-bottom: 6px;
    font-size: 0.85rem;
    line-height: 1.3;
}

#holdSummary p strong {
    color: #6c757d;
    font-weight: 600;
    width: 110px;
    display: inline-block;
}

/* Modal specific styles */
.modal-body .bi-check-circle {
    font-size: 4rem;
}

.modal-body .bi-exclamation-triangle {
    font-size: 4rem;
}

#retryBookingBtn {
    display: none;
}

/* Guest capacity note */
#guestCapacityNote {
    font-size: 0.875rem;
    color: #6c757d;
    font-style: italic;
}

@media (max-width: 767px) {
    #holdSummary .card-body { 
        padding: 10px; 
    }
    #holdSummary p { 
        font-size: 0.875rem; 
    }
    #holdSummary p strong { 
        width: 96px; 
    }
}

/* Calendar Table View Styles */
.calendar-grid-container {
    width: 100%;
}

.calendar-table {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.calendar-header-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #fff;
    border-bottom: 2px solid #dee2e6;
    position: sticky;
    top: 0;
    z-index: 10;
}

.calendar-day-header {
    padding: 12px 8px;
    text-align: center;
    border-right: 1px solid #dee2e6;
}

.calendar-day-header:last-child {
    border-right: none;
}

.calendar-day-header .day-name {
    font-size: 0.9rem;
    color: #666;
    text-transform: capitalize;
}

.calendar-day-header .day-date {
    font-weight: 600;
    font-size: 1rem;
    color: #333;
    margin-top: 2px;
}

.calendar-columns-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    width: 100%;
}

.calendar-day-column {
    border-right: 1px solid #dee2e6;
    min-height: 200px;
    background: #fff;
}

.calendar-day-column:last-child {
    border-right: none;
}

.day-events-container {
    padding: 0;
    min-height: 100px;
}

.event-item {
    margin-bottom: 0;
    min-height: 160px;
    position: relative;
    border-bottom: 1px solid #f0f0f0;
}

.event-link {
    display: block;
    padding: 16px;
    text-decoration: none;
    color: inherit;
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
    position: relative;
}

.event-link:hover {
    background-color: #f8f9fa;
    text-decoration: none;
}

.event-color-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: rgb(240, 235, 222);
}

.event-time {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 8px;
    margin-top: 4px;
}

.event-title {
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    color: #333;
    margin-bottom: 8px;
    line-height: 1.3;
}

.event-description {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 8px;
    line-height: 1.4;
}

.event-instructor {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 12px;
}

.event-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: auto;
}

.event-spots {
    font-size: 0.85rem;
    font-weight: 500;
}

.event-spots.spots-available {
    color: #28a745;
}

.event-spots.spots-limited {
    color: #856404;
}

.event-spots.spots-full {
    color: #dc3545;
}

.event-action {
    margin-left: auto;
}

.btn-signup {
    background: #333;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-signup:hover {
    background: #555;
    color: #fff;
}

.no-events {
    padding: 20px;
    text-align: center;
}

.no-events-message {
    color: #999;
    font-size: 0.9rem;
    font-style: italic;
}

/* Responsive adjustments */
@media (max-width: 991px) {
    .calendar-header-row,
    .calendar-columns-row {
        grid-template-columns: 1fr;
    }
    
    .calendar-day-header,
    .calendar-day-column {
        border-right: none;
        border-bottom: 1px solid #dee2e6;
    }
    
    .calendar-day-column:last-child {
        border-bottom: none;
    }
}

@media (max-width: 767px) {
    .event-item {
        min-height: 140px;
    }
    
    .event-link {
        padding: 12px;
    }
    
    .event-title {
        font-size: 0.95rem;
    }
    
    .event-time,
    .event-instructor {
        font-size: 0.8rem;
    }
    
    .btn-signup {
        padding: 6px 12px;
        font-size: 0.85rem;
    }
}

/* Medium screen (tablet) view - show only days with events */
.medium-events-container {
    width: 100%;
}

.medium-day-header {
    padding: 16px 12px 8px 12px;
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    margin-top: 20px;
}

.medium-day-header:first-child {
    margin-top: 0;
}

.medium-day-header .day-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    text-transform: capitalize;
}

.medium-day-header .day-date {
    font-size: 0.9rem;
    color: #666;
    margin-top: 4px;
}

@media (min-width: 768px) and (max-width: 991px) {
    .calendar-table {
        display: none; /* Hide default week view structure on medium screens */
    }
    
    .medium-events-container {
        display: block;
    }
}
