/**
 * PP Calendar Pro - Scheduler Styles
 * Theme-aware styling with inheritance
 */

/* Popup Overlay */
.pp-calendar-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
}

.pp-calendar-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

/* Popup Content */
.pp-calendar-popup-content {
    position: relative;
    max-width: 800px;
    max-height: 90vh;
    margin: 5vh auto;
    background: #fff;
    border-radius: 8px;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

/* Close Button */
.pp-calendar-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    z-index: 10;
    color: #999;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pp-calendar-close:hover {
    color: #333;
}

/* Header */
.pp-calendar-header {
    padding: 20px 30px;
    border-bottom: 1px solid #eee;
}

.pp-calendar-header h2 {
    margin: 0;
    color: #333;
    font-size: 24px;
}

/* Body */
.pp-calendar-body {
    padding: 30px;
    padding-bottom: 70px; /* 30px base + 40px extra spacing */
}

/* Loading State */
.pp-calendar-loading {
    text-align: center;
    padding: 40px;
}

.pp-calendar-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: pp-calendar-spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes pp-calendar-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Availability Calendar */
.pp-calendar-availability {
    display: grid;
    gap: 20px;
}

.pp-calendar-day {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
}

.pp-calendar-day h4 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 16px;
    font-weight: 600;
}

/* Time Slots */
.pp-calendar-slots {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
}

.pp-calendar-slot {
    padding: 8px 12px;
    background: #f5f5f5;
    border: 2px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    color: #333;
}

.pp-calendar-slot:hover {
    background: #e8e8e8;
    border-color: #3498db;
}

.pp-calendar-slot.selected {
    background: #3498db;
    color: white;
    border-color: #2980b9;
}

/* Booking Form */
.pp-calendar-booking-form {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid #eee;
}

.pp-calendar-booking-form h3 {
    margin-top: 0;
    color: #333;
}

.pp-calendar-booking-form p {
    margin: 10px 0;
    color: #666;
}

.pp-calendar-booking-form .form-group {
    margin: 20px 0;
}

.pp-calendar-booking-form label {
    display: block;
    margin-bottom: 5px;
    color: #333;
    font-weight: 500;
}

.pp-calendar-booking-form textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
}

/* Buttons */
.pp-calendar-trigger {
    display: inline-block;
    padding: 12px 24px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.2s;
}

.pp-calendar-trigger:hover {
    background: #2980b9;
}

#pp-calendar-confirm-booking {
    background: #27ae60;
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: background 0.2s;
}

#pp-calendar-confirm-booking:hover:not(:disabled) {
    background: #229954;
}

#pp-calendar-confirm-booking:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Success/Error States */
.pp-calendar-success,
.pp-calendar-error {
    text-align: center;
    padding: 40px;
}

.pp-calendar-checkmark {
    width: 60px;
    height: 60px;
    background: #27ae60;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    margin: 0 auto 20px;
}

.pp-calendar-success h3 {
    color: #27ae60;
    margin: 15px 0;
}

.pp-calendar-error h3 {
    color: #e74c3c;
    margin: 15px 0;
}

/* Email Form */
.pp-calendar-email-form,
.pp-calendar-confirm-email {
    max-width: 400px;
    margin: 0 auto;
    text-align: center;
}

.pp-calendar-email-form input[type="email"],
.pp-calendar-confirm-email input[type="email"] {
    width: 100%;
    padding: 10px;
    margin: 15px 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.pp-calendar-email-form button,
.pp-calendar-confirm-email button {
    width: 100%;
    padding: 12px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.2s;
}

.pp-calendar-email-form button:hover,
.pp-calendar-confirm-email button:hover {
    background: #2980b9;
}

/* Honeypot Field (Hidden) */
#pp_calendar_hp {
    position: absolute;
    left: -9999px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .pp-calendar-popup-content {
        margin: 0;
        max-height: 100vh;
        border-radius: 0;
    }

    .pp-calendar-body {
        padding: 20px;
    }

    .pp-calendar-slots {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }
}

/* Theme Inheritance */
body.pp-calendar-open {
    overflow: hidden;
}

/* Inherit theme colors if available */
.pp-calendar-slot {
    background-color: var(--pp-cal-slot-bg, #f5f5f5);
    color: var(--pp-cal-slot-color, #333);
}

.pp-calendar-slot:hover {
    background-color: var(--pp-cal-slot-hover-bg, #e8e8e8);
}

.pp-calendar-slot.selected {
    background-color: var(--pp-cal-primary-color, #3498db);
    color: var(--pp-cal-primary-text, white);
}

/* Date Navigation */
.pp-calendar-date-navigation {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 20px;
}

.pp-calendar-date-nav {
    flex: 1;
    padding: 10px 20px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}

.pp-calendar-date-nav:hover:not(:disabled) {
    background: #2980b9;
}

.pp-calendar-date-nav:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    opacity: 0.6;
}