/* Calendly-style Calendar Component */

.calendly-container {
    display: flex;
    flex-direction: row;
    background: #fff;
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
    min-height: 450px;
    font-family:
        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
        Arial, sans-serif;
}

/* Left panel - Calendar */
.calendly-calendar-panel {
    flex: 1;
    padding: 24px;
    border-right: 1px solid #e5e5e5;
    border-radius: 0;
}

/* Info message */
.calendly-info-message {
    background: #e7f3ff;
    border: 1px solid #b3d7ff;
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 16px;
    font-size: 0.85rem;
    color: #0066cc;
    display: flex;
    align-items: center;
    gap: 8px;
}

.calendly-info-message i {
    font-size: 1rem;
    flex-shrink: 0;
}

/* Right panel - Time slots */
.calendly-slots-panel {
    width: 280px;
    padding: 24px;
    background: #fff;
    overflow-y: auto;
    border-radius: 0;
    max-height: 600px;
}

/* Calendar header */
.calendly-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.calendly-month-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1a1a1a;
}

.calendly-nav {
    display: flex;
    gap: 8px;
}

.calendly-nav-btn {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    border-radius: 50%;
    color: #666;
    transition: all 0.2s;
}

.calendly-nav-btn:hover {
    background: #f0f0f0;
    color: #0069ff;
}

.calendly-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Calendar grid */
.calendly-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    margin-bottom: 8px;
}

.calendly-weekday {
    font-size: 0.75rem;
    font-weight: 600;
    color: #666;
    padding: 8px 0;
    text-transform: uppercase;
}

.calendly-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendly-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    border-radius: 50%;
    cursor: default;
    color: #ccc;
    position: relative;
}

.calendly-day.available {
    color: #0069ff;
    font-weight: 600;
    cursor: pointer;
    background: #e8f4ff;
}

.calendly-day.available:hover {
    background: #0069ff;
    color: #fff;
}

.calendly-day.selected {
    background: #0069ff;
    color: #fff;
}

.calendly-day.today {
    border: 2px solid #0069ff;
}

.calendly-day.other-month {
    color: #e5e5e5;
}

/* Day range indicator */
.calendly-day .day-range {
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.5rem;
    color: #666;
    white-space: nowrap;
    display: none;
}

.calendly-day.available:hover .day-range,
.calendly-day.selected .day-range {
    display: block;
}

/* Slots panel */
.calendly-slots-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 16px;
}

.calendly-slots-date {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 16px;
}

.calendly-slots-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.calendly-slot {
    padding: 12px 16px;
    border: 1px solid #0069ff;
    border-radius: 4px;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 500;
    color: #0069ff;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
}

.calendly-slot:hover {
    background: #0069ff;
    color: #fff;
}

.calendly-slot.selected {
    background: #0069ff;
    color: #fff;
}

.calendly-slot.disabled {
    border-color: #e5e5e5;
    color: #ccc;
    cursor: not-allowed;
    background: #f5f5f5;
}

.calendly-slot.disabled:hover {
    background: #f5f5f5;
    color: #ccc;
}

/* View-only mode */
.calendly-container.view-only .calendly-slot {
    cursor: pointer;
}

.calendly-container.view-only .calendly-slot:hover {
    background: #fff;
    color: #0069ff;
}

/* Loading state */
.calendly-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #666;
}

.calendly-loading::after {
    content: "";
    width: 20px;
    height: 20px;
    border: 2px solid #e5e5e5;
    border-top-color: #0069ff;
    border-radius: 50%;
    animation: calendly-spin 0.8s linear infinite;
    margin-left: 8px;
}

@keyframes calendly-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Empty state */
.calendly-empty {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.calendly-empty-icon {
    font-size: 2rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

/* Confirm button */
.calendly-confirm-btn {
    width: 100%;
    padding: 12px;
    background: #0069ff;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 16px;
    transition: background 0.2s;
}

.calendly-confirm-btn:hover {
    background: #0052cc;
}

.calendly-confirm-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Confirm button en modo waitlist - mantiene estilo azul */
.calendly-confirm-btn.waitlist-mode {
    background: #0069ff;
    color: #fff;
}

.calendly-confirm-btn.waitlist-mode:hover {
    background: #0052cc;
}

/* Responsive */
@media (max-width: 768px) {
    .calendly-container {
        flex-direction: column;
    }

    .calendly-calendar-panel {
        border-right: none;
        border-bottom: 1px solid #e5e5e5;
    }

    .calendly-slots-panel {
        width: 100%;
        max-height: 300px;
    }
}

/* Modal wrapper */
.calendly-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

.calendly-modal-content {
    background: #fff;
    border-radius: 0;
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    overflow: auto;
    border: none;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.15);
}

.calendly-modal-content.with-questions {
    max-width: 980px;
}

/* Ensure calendar panels maintain their size with questions */
.calendly-modal-content.with-questions .calendly-calendar-panel {
    min-width: 380px;
}

.calendly-modal-content.with-questions .calendly-slots-panel {
    min-width: 280px;
}

.calendly-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 24px 24px 0;
    border-bottom: none;
    background: #fff;
}

.calendly-modal-header-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.calendly-modal-title {
    font-family: "Raleway", sans-serif;
    font-weight: 300;
    font-size: 1.75rem;
    color: #000;
    margin: 0;
    letter-spacing: -0.02em;
}

.calendly-modal-duration {
    font-size: 0.8rem;
    color: #666;
    display: flex;
    align-items: center;
    gap: 4px;
}

.calendly-modal-duration i {
    font-size: 0.75rem;
}

.calendly-modal-close {
    cursor: pointer;
    line-height: 1;
}

.calendly-modal-close:hover {
    color: #1a1a1a;
}

/* Questions panel */
.calendly-questions-panel {
    width: 280px;
    padding: 24px;
    border-right: 1px solid #e5e5e5;
    background: #fff;
    overflow-y: auto;
    border-radius: 0;
}

.calendly-questions-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 16px;
}

.calendly-questions-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.calendly-question-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.calendly-question-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: #333;
}

.calendly-question-input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #e8e8e8;
    border-radius: 8px;
    font-size: 0.85rem;
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
    transition: all 0.2s ease;
    background: #fafafa;
}

.calendly-question-input:hover {
    border-color: #d0d0d0;
    background: #fff;
}

.calendly-question-input:focus {
    outline: none;
    border-color: #0069ff;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(0, 105, 255, 0.1);
}

.calendly-question-input::placeholder {
    color: #999;
}

.calendly-questions-empty {
    text-align: center;
    padding: 20px;
    color: #666;
    font-size: 0.85rem;
}

/* Modal body with questions */
.calendly-modal-body-wrapper {
    display: flex;
    flex-direction: row;
}

/* Responsive for questions panel */
@media (max-width: 992px) {
    .calendly-modal-body-wrapper {
        flex-direction: column;
    }

    .calendly-questions-panel {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e5e5e5;
        max-height: 200px;
    }
}

/* =================================================================
   WAITLIST STYLES
   ================================================================= */

/* Slot ocupado clickeable para waitlist */
.calendly-slot.waitlist-clickable.occupied {
    border-color: #e5e5e5;
    color: #999;
    cursor: pointer !important;
    background: #f5f5f5;
    position: relative;
}

.calendly-slot.waitlist-clickable.occupied:hover {
    background: #e5e5e5;
    color: #666;
}

.calendly-slot.waitlist-clickable.occupied.selected {
    background: #d5d5d5;
    color: #333;
    border-color: #999;
    font-weight: 600;
}

.calendly-slot.waitlist-clickable.occupied:hover::after {
    content: "Lista de espera";
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    z-index: 1000;
}

/* Mensaje overlay de waitlist */
.waitlist-message-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.waitlist-message-box {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    max-width: 500px;
    text-align: center;
}

.waitlist-message-box h4 {
    margin-top: 0;
    color: #333;
}

.waitlist-message-box p {
    color: #666;
    margin: 10px 0;
}

.waitlist-message-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

/* Botón directo de lista de espera */
.waitlist-direct-btn {
    width: 100%;
    margin-top: 15px;
    padding: 12px;
    background: #ffc107;
    border: none;
    border-radius: 6px;
    color: #333;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s;
}

.waitlist-direct-btn:hover {
    background: #ffb300;
}

.waitlist-direct-btn i {
    font-size: 18px;
}

/* Skeleton Loading */
@keyframes calendly-pulse {
    0% {
        opacity: 0.6;
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 0.6;
    }
}

.calendly-days-skeleton {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px; /* Mismo gap que .calendly-days */
    width: 100%; /* Asegurar ancho completo */
    min-height: 300px; /* Asegurar altura mínima para evitar colapso */
    animation: calendly-pulse 1.5s infinite ease-in-out;
}

.calendly-day-skeleton {
    width: 100%; /* Ocupar el ancho de la celda del grid */
    aspect-ratio: 1; /* Mantener proporción cuadrada/circular */
    background: #f0f0f0;
    border-radius: 50%;
    min-height: 40px; /* Tamaño mínimo por si el width falla */
}

.calendly-slots-skeleton {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    animation: calendly-pulse 1.5s infinite ease-in-out;
}

.calendly-slot-skeleton {
    width: 100%;
    height: 48px;
    background: #f0f0f0;
    border-radius: 4px;
}

/* Pantallas grandes (2K+) */
@media (min-width: 2200px) {
    .calendly-modal-content {
        max-width: 1000px;
    }
    .calendly-modal-content.with-questions {
        max-width: 1300px;
    }
    .calendly-modal-title {
        font-size: 2.2rem;
    }
    .calendly-modal-duration {
        font-size: 1rem;
    }
    .calendly-month-title {
        font-size: 1.4rem;
    }
    .calendly-weekday {
        font-size: 0.95rem;
    }
    .calendly-day {
        font-size: 1.15rem;
    }
    .calendly-slots-panel {
        width: 360px;
    }
    .calendly-slots-title {
        font-size: 1.3rem;
    }
    .calendly-slots-date {
        font-size: 1.05rem;
    }
    .calendly-slot {
        padding: 16px 20px;
        font-size: 1.1rem;
    }
    .calendly-confirm-btn {
        padding: 16px;
        font-size: 1.1rem;
    }
    .calendly-calendar-panel {
        padding: 32px;
    }
    .calendly-slots-panel {
        padding: 32px;
    }
    .calendly-info-message {
        font-size: 1.05rem;
    }
    .calendly-modal-header {
        padding: 32px 32px 0;
    }
}

@media (min-width: 2800px) {
    .calendly-modal-content {
        max-width: 1400px;
    }
    .calendly-modal-content.with-questions {
        max-width: 1700px;
    }
    .calendly-modal-title {
        font-size: 2.8rem;
    }
    .calendly-modal-duration {
        font-size: 1.2rem;
    }
    .calendly-month-title {
        font-size: 1.8rem;
    }
    .calendly-weekday {
        font-size: 1.15rem;
    }
    .calendly-day {
        font-size: 1.4rem;
    }
    .calendly-slots-panel {
        width: 440px;
    }
    .calendly-slots-title {
        font-size: 1.6rem;
    }
    .calendly-slots-date {
        font-size: 1.25rem;
    }
    .calendly-slot {
        padding: 20px 24px;
        font-size: 1.3rem;
    }
    .calendly-confirm-btn {
        padding: 20px;
        font-size: 1.3rem;
    }
    .calendly-calendar-panel {
        padding: 40px;
    }
    .calendly-slots-panel {
        padding: 40px;
    }
    .calendly-info-message {
        font-size: 1.25rem;
    }
    .calendly-modal-header {
        padding: 40px 40px 0;
    }
}
