/* ===========================
   ESB Frontend - Popup Styles
   =========================== */

/* CSS Variables (injected dynamically) */
:root {
    --esb-primary: #e74c3c;
    --esb-secondary: #2c3e50;
    --esb-accent: #27ae60;
}

/* ===========================
   Booking Button
   =========================== */
.esb-booking-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 32px;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    letter-spacing: 0.5px;
}

.esb-btn-primary {
    background: var(--esb-primary);
    color: #fff;
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
}

.esb-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.4);
}

.esb-btn-secondary {
    background: var(--esb-secondary);
    color: #fff;
}

.esb-btn-outline {
    background: transparent;
    color: var(--esb-primary);
    border: 2px solid var(--esb-primary);
}

/* ===========================
   Booking Link
   =========================== */
.esb-booking-link {
    cursor: pointer;
    text-decoration: underline;
    font-weight: 600;
    transition: opacity 0.2s;
}

.esb-booking-link:hover {
    opacity: 0.8;
}

.esb-link-primary {
    color: var(--esb-primary);
}

.esb-link-secondary {
    color: var(--esb-secondary);
}

.esb-link-accent {
    color: var(--esb-accent);
}

/* ===========================
   Popup Overlay
   =========================== */
.esb-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    animation: esb-fade-in 0.3s ease;
}

@keyframes esb-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.esb-popup {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 35px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: esb-slide-up 0.4s ease;
}

@keyframes esb-slide-up {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.esb-popup-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.esb-popup-close:hover {
    background: #f0f0f0;
    color: #333;
}

/* ===========================
   Header
   =========================== */
.esb-popup-header {
    text-align: center;
    margin-bottom: 25px;
}

.esb-popup-header h2 {
    margin: 0;
    font-size: 24px;
    color: var(--esb-secondary);
    font-weight: 700;
}

.esb-popup-header p {
    margin: 8px 0 0;
    color: #888;
    font-size: 14px;
}

/* ===========================
   Progress Steps
   =========================== */
.esb-steps-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 30px;
    gap: 0;
}

.esb-step-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    position: relative;
}

.esb-step-num {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    background: #e8e8e8;
    color: #999;
    transition: all 0.3s;
}

.esb-step-indicator.active .esb-step-num {
    background: var(--esb-primary);
    color: #fff;
    box-shadow: 0 3px 10px rgba(231, 76, 60, 0.3);
}

.esb-step-indicator.completed .esb-step-num {
    background: var(--esb-accent);
    color: #fff;
}

.esb-step-label {
    font-size: 11px;
    color: #999;
    white-space: nowrap;
    font-weight: 500;
}

.esb-step-indicator.active .esb-step-label {
    color: var(--esb-primary);
    font-weight: 600;
}

.esb-step-indicator.completed .esb-step-label {
    color: var(--esb-accent);
}

.esb-step-line {
    flex: 1;
    height: 3px;
    background: #e8e8e8;
    margin: 0 8px;
    margin-bottom: 20px;
    border-radius: 2px;
    min-width: 30px;
    transition: background 0.3s;
}

.esb-step-line.active {
    background: var(--esb-accent);
}

/* ===========================
   Form Groups
   =========================== */
.esb-form-group {
    margin-bottom: 18px;
}

.esb-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--esb-secondary);
    margin-bottom: 6px;
}

.esb-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e8e8e8;
    border-radius: 10px;
    font-size: 15px;
    transition: border-color 0.2s;
    outline: none;
    box-sizing: border-box;
    font-family: inherit;
}

.esb-input:focus {
    border-color: var(--esb-primary);
}

.esb-input.esb-invalid {
    border-color: #e74c3c;
}

.esb-error {
    display: block;
    color: #e74c3c;
    font-size: 12px;
    margin-top: 4px;
    min-height: 16px;
}

/* ===========================
   Step 2 - Services
   =========================== */
.esb-popup .esb-services-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 15px;
}

.esb-service-option {
    border: 2px solid #e8e8e8;
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.esb-service-option:hover {
    border-color: #ccc;
    background: #fafafa;
}

.esb-service-option.selected {
    border-color: var(--esb-primary);
    background: rgba(231, 76, 60, 0.03);
}

.esb-service-option .esb-svc-check {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 22px;
    height: 22px;
    border: 2px solid #ddd;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.esb-service-option.selected .esb-svc-check {
    background: var(--esb-primary);
    border-color: var(--esb-primary);
    color: #fff;
}

.esb-service-option .esb-svc-check::after {
    content: '';
}

.esb-service-option.selected .esb-svc-check::after {
    content: '\2713';
    font-size: 14px;
    font-weight: 700;
}

.esb-service-option .esb-svc-icon {
    font-size: 28px;
    margin-bottom: 8px;
    display: block;
}

.esb-service-option .esb-svc-name {
    font-weight: 700;
    font-size: 14px;
    color: var(--esb-secondary);
    margin-bottom: 4px;
}

.esb-service-option .esb-svc-desc {
    font-size: 12px;
    color: #888;
    margin-bottom: 8px;
    line-height: 1.4;
}

.esb-service-option .esb-svc-price {
    font-weight: 700;
    font-size: 16px;
    color: var(--esb-primary);
}

.esb-total-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #f8f9fa;
    border-radius: 10px;
    font-size: 16px;
}

.esb-total-bar strong {
    font-size: 22px;
    color: var(--esb-primary);
}

/* ===========================
   Step 3 - Calendar
   =========================== */
.esb-calendar-widget {
    margin-bottom: 15px;
}

.esb-cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.esb-cal-header button {
    background: none;
    border: 2px solid #e8e8e8;
    border-radius: 8px;
    width: 38px;
    height: 38px;
    cursor: pointer;
    font-size: 18px;
    color: #666;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.esb-cal-header button:hover {
    border-color: var(--esb-primary);
    color: var(--esb-primary);
}

.esb-cal-month-year {
    font-size: 18px;
    font-weight: 700;
    color: var(--esb-secondary);
}

.esb-cal-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
    font-size: 12px;
    color: #888;
}

.esb-cal-legend span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.esb-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.esb-dot-available { background: #27ae60; }
.esb-dot-limited { background: #f39c12; }
.esb-dot-full { background: #e74c3c; }
.esb-dot-blocked { background: repeating-linear-gradient(45deg, #ccc, #ccc 2px, #999 2px, #999 4px); }

.esb-cal-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.esb-cal-table th {
    padding: 10px 5px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
}

.esb-cal-table td {
    padding: 0;
    text-align: center;
    vertical-align: middle;
}

.esb-cal-cell {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin: 2px auto;
    max-width: 42px;
    max-height: 42px;
}

.esb-cal-cell:hover:not(.esb-cal-disabled) {
    transform: scale(1.1);
}

.esb-cal-cell.esb-cal-available {
    background: #eafaf1;
    color: #27ae60;
}

.esb-cal-cell.esb-cal-limited {
    background: #fef9e7;
    color: #f39c12;
}

.esb-cal-cell.esb-cal-full {
    background: #e74c3c;
    color: #fff;
    cursor: not-allowed;
    opacity: 0.9;
}

.esb-cal-cell.esb-cal-blocked {
    background: repeating-linear-gradient(45deg, #f0f0f0, #f0f0f0 3px, #ddd 3px, #ddd 6px);
    color: #999;
    cursor: not-allowed;
}

.esb-cal-cell.esb-cal-past,
.esb-cal-cell.esb-cal-disabled {
    color: #ddd;
    cursor: default;
}

.esb-cal-cell.esb-cal-selected {
    background: var(--esb-primary) !important;
    color: #fff !important;
    box-shadow: 0 3px 10px rgba(231, 76, 60, 0.3);
}

.esb-cal-cell.esb-cal-empty {
    cursor: default;
}

.esb-selected-date-display {
    text-align: center;
    font-size: 15px;
    color: #666;
    margin: 10px 0 0;
}

.esb-selected-date-display strong {
    color: var(--esb-primary);
}

/* ===========================
   Step 4 - Summary
   =========================== */
.esb-summary {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
}

.esb-summary h3 {
    margin: 0 0 18px;
    font-size: 18px;
    color: var(--esb-secondary);
}

.esb-summary-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.esb-summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.esb-summary-item label {
    font-size: 13px;
    color: #888;
    font-weight: 500;
}

.esb-summary-item span,
.esb-summary-item strong {
    color: #333;
    font-size: 14px;
}

.esb-summary-total {
    border-bottom: none;
    border-top: 2px solid #ddd;
    padding-top: 12px;
    margin-top: 5px;
}

.esb-summary-total strong {
    font-size: 20px;
    color: var(--esb-primary);
}

/* GDPR */
.esb-gdpr {
    padding: 15px;
    background: #fff3cd;
    border-radius: 10px;
    border: 1px solid #ffc107;
}

.esb-gdpr label {
    font-size: 13px !important;
    color: #666 !important;
    font-weight: 400 !important;
    display: flex;
    gap: 10px;
    align-items: flex-start;
    cursor: pointer;
}

.esb-gdpr input[type="checkbox"] {
    margin-top: 2px;
    flex-shrink: 0;
}

/* ===========================
   Navigation
   =========================== */
.esb-popup-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 25px;
    gap: 12px;
}

.esb-btn {
    padding: 12px 28px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.esb-popup-nav .esb-btn-primary {
    background: var(--esb-primary);
    color: #fff;
    margin-left: auto;
}

.esb-popup-nav .esb-btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.esb-popup-nav .esb-btn-secondary {
    background: #f0f0f0;
    color: #666;
}

.esb-popup-nav .esb-btn-secondary:hover {
    background: #e0e0e0;
}

/* ===========================
   Messages & Loading
   =========================== */
.esb-message {
    text-align: center;
    padding: 20px;
    border-radius: 10px;
    margin-top: 15px;
    font-weight: 500;
}

.esb-message.esb-success {
    background: #eafaf1;
    color: #27ae60;
    border: 1px solid #27ae60;
}

.esb-message.esb-error {
    background: #fdedec;
    color: #e74c3c;
    border: 1px solid #e74c3c;
}

.esb-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    z-index: 10;
}

.esb-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e8e8e8;
    border-top-color: var(--esb-primary);
    border-radius: 50%;
    animation: esb-spin 0.8s linear infinite;
}

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

.esb-loading p {
    margin-top: 12px;
    color: #888;
    font-size: 14px;
}

/* ===========================
   Responsive
   =========================== */
@media (max-width: 600px) {
    .esb-popup {
        padding: 20px;
        max-height: 95vh;
        border-radius: 12px;
    }

    .esb-popup-header h2 {
        font-size: 20px;
    }

    .esb-step-label {
        display: none;
    }

    .esb-step-num {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }

    .esb-popup .esb-services-grid {
        grid-template-columns: 1fr;
    }

    .esb-cal-cell {
        max-width: 36px;
        max-height: 36px;
        font-size: 12px;
    }

    .esb-summary-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 3px;
    }

    .esb-popup-nav {
        flex-direction: column;
    }

    .esb-popup-nav .esb-btn {
        width: 100%;
        text-align: center;
    }

    .esb-popup-nav .esb-btn-primary {
        margin-left: 0;
    }
}

@media (max-width: 400px) {
    .esb-popup {
        padding: 15px;
    }

    .esb-steps-progress {
        gap: 0;
    }

    .esb-step-line {
        min-width: 15px;
    }
}
