.calendar {
  --primary: #7c4dcc;
  --primary-rgb: 124, 77, 204;
}

.calendar,
.mobile-events-list {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    max-width: 1200px;
}

@media screen and (max-width: 1250px) {
    .calendar {
        max-width: 95%;
    }
}

.calendar .header {
    background: var(--primary);
    border-bottom: 1px solid #e5e7eb;
    border-radius: 12px 12px 0 0;
    padding: 32px;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
    z-index: 5;
}

.calendar .header::before,
#eventDetailsModal .modal-header:before,
.mobile-event-card .modal-header:before {
    content: '';
    position: absolute;
    top: 50%;
    right: 0;
    width: 200px;
    aspect-ratio: 1 / 1;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: translate(50px, -50%);
}

.calendar .header::before {
    width: 230px;
}

.calendar .header .month-year {
    font-size: 32px;
    font-weight: 700;
    color: white;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.calendar .header .month-year #calendar-year {
    font-weight: 400;
}

.calendar .header .buttons {
    display: flex;
    gap: 12px;
}

.calendar .header .buttons button,
#eventDetailsModal .modal-header .btn-close,
#eventDetailsModal .modal-nav-arrow {
    width: 44px;
    height: 44px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    backdrop-filter: blur(10px);
    transition: all 0.3s;
}

.calendar .header .buttons button:hover,
#eventDetailsModal .modal-header .btn-close:hover,
#eventDetailsModal .modal-nav-arrow:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.6);
    transform: translateY(-2px);
}

.calendar .calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border-top: 1px solid #e5e7eb;
}

.calendar .weekday-header {
    background: #f9fafb;
    padding: 14px 8px;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-right: 1px solid #e5e7eb;
}

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

.calendar .calendar-day {
    min-height: 120px;
    border-right: 1px solid #e5e7eb;
    border-bottom: 1px solid #e5e7eb;
    padding: 12px;
    position: relative;
    cursor: pointer;
    transition: background-color 0.2s;
}

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

.calendar .calendar-day:hover {
    background-color: #f9fafb;
}

.calendar .day-number {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 8px;
}

.calendar .other-month .day-number {
    color: #d1d5db;
}

.calendar .today {
    background-color: color-mix(in srgb, var(--primary) 5%, white 90%);
    border: 2px solid var(--primary);
}

.calendar .today .day-number {
    color: var(--primary);
}

.calendar .event-banner {
    background: var(--event-color);
    color: #fff;

    font-size: 11px;
    padding: 3px 6px;
    line-height: 1.1;

    border-radius: 6px;
    font-weight: 500;

    margin-bottom: 2px;
    cursor: pointer;

    display: flex;
    align-items: center;
    gap: 4px;

    max-width: 100%;
    max-height: 28px; 
    overflow: hidden;
}


.calendar .event-banner .event-time {
    flex-shrink: 0;
    align-self: stretch;
    display: flex;
    align-items: center;
    padding-right: 4px;
    font-size: 11px;
    opacity: 0.9;
    word-break: break-word;
}

.calendar .event-banner .event-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    /* Clamp to 2 lines and show ellipsis for text only */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    word-break: break-word;
    flex: 1 1 0;
    min-width: 0;
}

.calendar .event-banner:hover {
    transform: translateY(-1px);
}

@media screen and (max-width: 991px) {
    .calendar .event-banner {
        flex-direction: column;
        align-items: flex-start;
        max-height: 80px;
    }

    .calendar .event-banner .event-title {
        flex: none;
    }
}

.calendar .multiple-events {
    background: #6b7280;
    color: white;
    padding: 2px 6px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.calendar .multiple-events:hover {
    background: #4b5563;
}

@media screen and (max-width: 768px) {

    /* Calendar grid compress */
    .calendar .calendar-grid {
        grid-template-columns: repeat(7, 1fr);
    }

    .calendar .calendar-day {
        aspect-ratio: 1 / 1;
        height: auto;
        min-height: auto;
        padding: 0;
        font-size: 14px;
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        border-radius: 0;
    }

    .calendar .day-number {
        font-size: 15px;
        margin-bottom: 0;
        font-weight: 600;
    }

    .calendar .event-banner,
    .calendar .multiple-events {
        display: none !important;
    }

    .calendar .event-dots {
        display: flex;
        gap: 4px;
        margin-top: 4px;
        justify-content: center;
    }

    .calendar .event-dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        display: inline-block;
        background: var(--event-color);
    }

    /* Dropdown event list for day */
    .calendar .mobile-event-list {
        position: relative;
        left: 0;
        right: 0;
        top: 100%;
        z-index: 10;
        background: #fff;
        border-radius: 0 0 10px 10px;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.10);
        padding: 8px 6px;
        margin-top: 2px;
        min-width: 120px;
    }

    .calendar .mobile-event-list .mobile-event-item {
        background: #f3f4f6;
        border-radius: 6px;
        padding: 6px 8px;
        margin-bottom: 6px;
        font-size: 13px;
        color: #222;
        cursor: pointer;
        display: flex;
        align-items: center;
        gap: 6px;
        border-left: 4px solid var(--primary, #3b82f6);
        transition: background 0.2s;
    }

    .calendar .mobile-event-list .mobile-event-item:last-child {
        margin-bottom: 0;
    }

    .calendar .mobile-event-list .mobile-event-item:hover {
        background: #e0e7ef;
    }

    /* Inline event details panel */
    .calendar .mobile-event-details {
        background: var(--event-color, #3b82f6);
        color: #fff;
        border-radius: 12px;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
        padding: 16px 14px;
        margin-top: 8px;
        position: relative;
        left: 0;
        right: 0;
        z-index: 20;
        font-size: 15px;
        animation: fadeIn 0.2s;
    }

    .calendar .mobile-event-details .event-title {
        font-size: 17px;
        font-weight: 700;
        margin-bottom: 6px;
        color: #fff;
    }

    .calendar .mobile-event-details .event-date,
    .calendar .mobile-event-details .event-time {
        font-size: 13px;
        color: #e0e7ef;
        margin-bottom: 2px;
    }

    .calendar .mobile-event-details .event-description {
        font-size: 14px;
        color: #f3f4f6;
        margin-top: 8px;
    }

    .calendar .mobile-event-details .close-details {
        background: rgba(255, 255, 255, 0.15);
        border: none;
        color: #fff;
        border-radius: 50%;
        width: 28px;
        height: 28px;
        position: absolute;
        top: 8px;
        right: 8px;
        font-size: 18px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: background 0.2s;
    }

    .calendar .mobile-event-details .close-details:hover {
        background: rgba(255, 255, 255, 0.30);
    }

    @keyframes fadeIn {
        from {
            opacity: 0;
            transform: translateY(10px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}

@media screen and (max-width: 576px) {
    .calendar .header {
        padding: 26px;
    }

    .calendar .header .buttons button {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }

    .calendar .header .month-year {
        font-size: 26px;
    }

    .calendar .weekday-header {
        padding: 10px 6px;
        font-size: 10px;
    }

    .calendar .day-number {
        font-size: 14px;
    }

    .calendar .event-dot {
        width: 6px;
        height: 6px;
    }
}

@media screen and (max-width: 400px) {
    .calendar .header {
        flex-direction: column;
        gap: 0.6rem;
        padding: 14px;
    }

    .calendar .header::before {
        width: 0;
    }
}

/* Event Details Modal */
#eventDetailsModal {
    --event-color: var(--primary);
}

#eventDetailsModal .modal-backdrop {
    backdrop-filter: blur(8px);
    background-color: rgba(0, 0, 0, 0.6);
}

#eventDetailsModal .modal-dialog {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: row;
    max-width: 700px;
    gap: 0.5rem;
}

#eventDetailsModal .modal-content {
    background: none;
    border: none;
    box-shadow: none;
}

#eventDetailsModal .modal-flex-arrows {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: auto;
    gap: 1rem;
}

#eventDetailsModal .modal-card,
.mobile-event-card {
    width: 560px;
    border: none;
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.mobile-event-card {
    background: var(--event-color);
}

#eventDetailsModal .modal-header,
.mobile-event-card .modal-header {
    background: var(--event-color);
    color: white;
    border-bottom: none;
    padding: 2rem 2.5rem;
    position: relative;
    overflow: hidden;
}

#eventDetailsModal .modal-header:before,
.mobile-event-card .modal-header:before {
    height: 100%;
    min-height: 200px;
    right: -5%;
}

#eventDetailsModal .modal-header-left {
    max-width: 80%;
}

#eventDetailsModal .modal-header.has-bg-image,
.mobile-event-card .modal-header.has-bg-image {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    min-height: 200px;
    z-index: 1;
}

#eventDetailsModal .modal-header .btn-close {
    border-radius: 50%;
    padding: 0 !important;
    color: #fff !important;
    opacity: 1 !important;
}

#eventDetailsModal .event-title,
.mobile-event-card .event-title {
    font-size: 28px;
    font-weight: 700;
    word-wrap: break-word;
    margin-bottom: 8px;
    color: #fff;
    position: relative;
    z-index: 2;
}

#eventDetailsModal .event-category,
.mobile-event-card .event-category {
    background: rgba(255, 255, 255, 0.25);
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-block;
    position: relative;
    z-index: 2;
}

#eventDetailsModal .modal-body,
.mobile-event-card .modal-body {
    padding: 2rem 2.5rem;
}

#eventDetailsModal .detail-row,
.mobile-event-card .detail-row {
    margin-bottom: 1.5rem;
}

#eventDetailsModal .detail-icon,
.mobile-event-card .detail-icon {
    width: 20px;
    height: 20px;
    color: var(--event-color);
    margin-top: 2px;
}

#eventDetailsModal .detail-label,
.mobile-event-card .detail-label {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

#eventDetailsModal .detail-value,
.mobile-event-card .detail-value {
    font-size: 16px;
    color: #1e293b;
    font-weight: 500;
    line-height: 1.5;
}

#eventDetailsModal .description-box,
.mobile-event-card .description-box {
    background: #f8fafc;
    padding: 20px;
    border-radius: 16px;
    border-left: 4px solid var(--event-color);
    margin-top: 8px;
}

#eventDetailsModal .modal-footer,
.mobile-event-card .modal-footer {
    padding: 1.5rem 2.5rem;
    border-top: 1px solid #e2e8f0;
    background: white;
}

#eventDetailsModal .modal-header,
.mobile-event-card .modal-header {
    position: relative;
}

#eventDetailsModal .modal-nav-arrow {
    font-size: 20px;
    margin: 0 8px;
    position: static;
    box-shadow: none;
}

#eventDetailsModal .modal-nav-arrow.hidden {
    opacity: 0 !important;
    pointer-events: none !important;
    visibility: hidden !important;
}

@media screen and (max-width: 576px) {

    /* Event Details Modal */
    #eventDetailsModal .modal-dialog {
        margin: 0.5rem;
    }

    #eventDetailsModal .modal-header {
        padding: 1.5rem;
    }

    #eventDetailsModal .modal-body {
        padding: 1.5rem;
    }

    #eventDetailsModal .modal-footer {
        padding: 1.25rem 1.5rem;
    }

    #eventDetailsModal .event-title {
        font-size: 24px;
    }
}

/* Mobile Events List */
@media (min-width: 769px) {
    #mobile-events-list {
        display: none !important;
    }
}

@media (max-width: 768px) {
    #mobile-events-list {
        display: block;
        background: #fff;
        border-radius: 12px;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.10);
        padding: 1.5rem;
    }

    .mobile-events-heading {
        color: var(--primary);
        font-size: 24px;
        font-weight: 700;
        text-align: center;
    }

    .mobile-events-list-inner {
        padding: 24px 16px;
    }

    .mobile-event-card {
        background: #fff;
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
        border-bottom: 3px solid var(--event-color);
        margin-bottom: 16px;
        transition: box-shadow 0.2s;
        position: static;
        width: 100%;
    }

    .mobile-event-card .toggle-card {
        position: relative;
        background: none;
        border: none;
        color: #fff;
        font-size: 22px;
        cursor: pointer;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: 32px;
        z-index: 2;
    }

    .mobile-event-card .modal-header,
    .mobile-event-card .modal-body {
        padding: 1rem 1.5rem;
    }

    .mobile-event-card .event-title {
        font-size: 20px;
    }

    .mobile-event-card .event-category,
    .mobile-event-card .detail-label {
        font-size: 10px;
    }

    .mobile-event-card .detail-value {
        font-size: 14px;
    }

    .mobile-event-card .modal-header.has-bg-image {
        min-height: 100px;
    }
}

#createAppointmentModal {
    --event-color: var(--primary);
}

#createAppointmentModal .modal-dialog {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: row;
    max-width: 700px;
    gap: 0.5rem;
}

#createAppointmentModal .modal-content {
    background: none;
    border: none;
    box-shadow: none;
}

#createAppointmentModal .modal-flex-arrows {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: auto;
    gap: 1rem;
}

#createAppointmentModal .modal-card {
    width: 560px;
    border: none;
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

#createAppointmentModal .modal-header {
    background: var(--event-color);
    color: #763ebf !important;
    padding: 2rem 2.5rem;
    border-bottom: none;
    position: relative;
    overflow: hidden;
}

#createAppointmentModal .modal-header::before {
    content: '';
    position: absolute;
    top: 50%;
    right: 0;
    width: 200px;
    aspect-ratio: 1 / 1;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: translate(50px, -50%);
}

#createAppointmentModal .event-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #fff;
}

#createAppointmentModal .event-category {
    background: rgba(255, 255, 255, 0.25);
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-block;
}

#createAppointmentModal .modal-body {
    padding: 2rem 2.5rem;
}

#createAppointmentModal .modal-footer {
    padding: 1.5rem 2.5rem;
    border-top: 1px solid #e2e8f0;
    background: white;
}

/* Create Appointment Modal Header Override */
#createAppointmentModal .modal-header {
    background-color: #6f42c1 !important; /* purple */
    color: #fff !important;               /* white text */
    border-bottom: none !important;
}

#createAppointmentModal .modal-header .modal-title,
#createAppointmentModal .modal-header .event-category {
    color: #fff !important;
}

/* Decorative header circles must not block clicks */
#createAppointmentModal .modal-header::before {
    pointer-events: none;
}

/* Ensure close button is always above */
#createAppointmentModal .modal-header .btn-close {
    position: relative;
    z-index: 5;
}

#eventDetailsModal .modal-header {
    background: var(--event-color);
    position: relative;
    z-index: 1;
}

#eventDetailsModal .event-title {
    background: transparent !important;
    position: relative;
    z-index: 2;
}

.ew-calendar-modal-header {
    background-color: #6f42c1 !important;
    color: #fff !important;
    border-bottom: none !important;
    position: relative;
    overflow: hidden;
}

.ew-calendar-modal-header .modal-title,
.ew-calendar-modal-header .event-title,
.ew-calendar-modal-header .event-category {
    color: #fff !important;
}

.ew-calendar-modal-header::before {
    content: '';
    position: absolute;
    top: 50%;
    right: 0;
    width: 200px;
    aspect-ratio: 1 / 1;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: translate(50px, -50%);
    pointer-events: none;
}

.ew-calendar-modal-header * {
    position: relative;
    z-index: 2;
}

.ew-calendar-modal-header .btn-close {
    position: relative;
    z-index: 5;
}

#eventDetailsModal .ew-calendar-modal-header.has-bg-image {
    background-image: none !important;
}

#createAppointmentModal .modal-dialog {
    max-height: 90vh;
}

#createAppointmentModal .modal-body {
    max-height: 60vh;
    overflow-y: auto;
}

#createAppointmentModal .modal-body {
    padding: 1rem;
}

.calendar-day.past-day {
    background-color: #f5f5f5;
    color: #aaa;
    cursor: not-allowed;
}

.calendar-day.past-day .day-number {
    color: #aaa;
}

.calendar-day.past-day .event-banner {
    opacity: 0.6;
    cursor: pointer;
}

.availability-slot {
    background: #198754;
    color: #fff;
    font-size: 11px;
    padding: 4px 6px;
    margin-top: 4px;
    border-radius: 6px;
    text-align: center;
    cursor: pointer;
    line-height: 1.2;
    transition: background 0.15s ease;
}

.availability-slot:hover {
    background: #157347;
}

.calendar-day {
    position: relative;
}

.availability-slot {
    position: relative;
    z-index: 5;
    pointer-events: auto;
}


/* availible appointment spot */
.availability-slot.available {
    background: #198754;
    cursor: pointer;
}

.availability-slot.available:hover {
    background: #157347;
}

/* unnavailible appointment spot */
.availability-slot.unavailable {
    background: #dc3545;
    cursor: not-allowed;
    opacity: 0.75;
    pointer-events: none;
}

.btn-purple {
    --bs-btn-color: #fff;
    --bs-btn-bg: #6f42c1;
    --bs-btn-border-color: #6f42c1;

    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #5a32a3;
    --bs-btn-hover-border-color: #5a32a3;

    --bs-btn-focus-shadow-rgb: 111, 66, 193;

    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #4e2a8a;
    --bs-btn-active-border-color: #4e2a8a;

    --bs-btn-disabled-color: #fff;
    --bs-btn-disabled-bg: #b39ddb;
    --bs-btn-disabled-border-color: #b39ddb;
}