/* Modal Base */
.bc-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99999; /* Ensure it is on top */
    padding: 1rem;
    font-family: 'Spartan', sans-serif;
}

.bc-modal.open {
    display: flex;
}

.bc-modal-backdrop {
    position: fixed;
    inset: 0;
    background-color: rgba(9, 9, 11, 0.6);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease-out;
    z-index: -1; /* Behind dialog but within modal container */
}

.bc-modal-dialog {
    position: relative;
    background: #ffffff;
    border-radius: 24px;
    max-width: 500px;
    width: 100%;
    height: 600px; 
    max-height: 90vh;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    z-index: 10;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.bc-modal-close {
    position: absolute;
    top: 1.5rem;
    right: 2rem;
    background: #f1f3f5;
    border: none;
    font-size: 1.25rem;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.bc-modal-close:hover {
    background: #ffe3e3;
    color: #e03131;
}

.bc-modal-title {
    padding: 1.5rem 2rem;
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a1a1a;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.bc-modal-title i {
    color: #3CB8E6;
}

.bc-modal-body {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
    color: #495057;
}

.bc-week-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.bc-nav-btn {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    color: #495057;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.bc-nav-btn:hover {
    background: #3CB8E6;
    color: #fff;
    border-color: #3CB8E6;
    box-shadow: 0 4px 12px rgba(60, 184, 230, 0.35);
}

.bc-current-week {
    font-weight: 600;
    font-size: 1rem;
    color: #111827;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    background: #f3f4f6;
    border: none;
    cursor: pointer;
}

.bc-date-picker {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}

.bc-calendar-container {
    overflow-x: auto;
}

.bc-calendar-grid {
    display: block;
}

.bc-day-column {
    background: #fff;
    border-radius: 16px;
    border: 1px solid #f1f3f5;
    padding: 1rem 1.25rem 1.25rem;
}

.bc-day-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #f1f3f5;
    margin-bottom: 0.75rem;
}

.bc-day-header.bc-today {
    background: #e7f5ff;
    color: #1971c2;
    border-bottom-color: #d0ebff;
}

.bc-day-name {
    font-weight: 600;
    color: #343a40;
    text-transform: capitalize;
}

.bc-day-date {
    font-size: 0.9rem;
    color: #868e96;
}

.bc-slots-list {
    padding-top: 0.25rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.bc-time-slot {
    padding: 0.5rem 0.75rem;
    text-align: center;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 999px;
    font-size: 0.9rem;
    color: #495057;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 70px;
}

.bc-slot-disabled {
    background: #f1f5f9;
    border-color: #e2e8f0;
    color: #cbd5e1;
    cursor: not-allowed;
    pointer-events: none;
    text-decoration: line-through;
}

.bc-time-slot:hover {
    background: #3CB8E6;
    color: white;
    border-color: #3CB8E6;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(60, 184, 230, 0.2);
}

.bc-no-slots {
    color: #adb5bd;
    font-size: 1.1rem;
    padding: 1rem 0 0.25rem;
    text-align: center;
}

.bc-modal-actions {
    padding: 1.5rem 2rem;
    border-top: 1px solid rgba(0,0,0,0.05);
    background: #f8f9fa;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
}

.bc-day-closed {
    display: block;
    margin-top: 4px;
    font-size: 0.75rem;
    color: #dc3545;
}

.bc-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: background 0.2s;
}

.bc-btn-primary {
    background: linear-gradient(135deg, #3CB8E6, #2a9fd6);
    color: white;
}

.bc-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(60, 184, 230, 0.3);
}

.bc-btn-secondary {
    background: transparent;
    color: #3CB8E6;
    border: 1px solid #3CB8E6;
}

.bc-btn-secondary:hover {
    background: #3CB8E6;
    color: #ffffff;
}

.bc-loading {
    padding: 2rem;
    text-align: center;
    color: #868e96;
    font-size: 1.1rem;
    width: 100%;
    grid-column: 1 / -1;
}

.bc-loading-error {
    color: #ef4444;
}

.bc-slot-closing-violation {
    background-color: #fff5f5;
    border-color: #ffc9c9;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.bc-slot-break {
    background-color: #fef08a;
    border-color: #facc15;
    color: #854d0e;
    cursor: not-allowed;
    pointer-events: none;
    opacity: 0.9;
}

@media (max-width: 768px) {
    .bc-modal-dialog {
        width: 100%;
        height: 100%;
        margin: 0;
        border-radius: 0;
        max-height: 100vh;
    }

    .bc-modal-title {
        padding: 1.25rem 1.5rem;
        font-size: 1.25rem;
    }

    .bc-modal-body {
        padding: 1rem 1rem 1.25rem;
    }

    .bc-week-nav {
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 0.75rem;
        padding: 0.75rem 0.75rem 0.85rem;
    }

    .bc-week-nav .bc-current-week {
        text-align: center;
        font-size: 1rem;
    }

    .bc-week-nav .bc-nav-btn {
        width: 36px;
        height: 36px;
    }

    .bc-calendar-container {
        margin-top: 0.75rem;
        overflow-x: auto;
        padding-bottom: 0.5rem;
    }

    .bc-calendar-grid {
        display: flex;
        flex-wrap: nowrap;
        gap: 0.75rem;
        min-width: auto;
    }

    .bc-day-column {
        min-width: 220px;
        flex: 0 0 80%;
    }

    .bc-slots-list {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .bc-time-slot,
    .bc-slot-disabled,
    .bc-slot-closing-violation,
    .bc-slot-break {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 calc(50% - 8px);
        margin-right: 0;
        padding: 0.5rem 0.25rem;
        font-size: 0.85rem;
        min-height: 40px;
        box-sizing: border-box;
    }
}
