/**
 * ListingBridges — Schedule Showing Modal
 * Developed by: Stark Create
 */

/* =========================================================
   MODAL OVERLAY
   ========================================================= */
.lb-showing-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0,0,0,0.55);
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.lb-showing-modal.lb-showing-modal--open {
    display: flex;
}

/* =========================================================
   MODAL PANEL
   ========================================================= */
.lb-showing-modal__panel {
    background: #fff;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 8px 48px rgba(0,0,0,0.22);
    animation: lb-modal-in 0.2s ease;
}
@keyframes lb-modal-in {
    from { opacity: 0; transform: translateY(-16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.lb-showing-modal__header {
    background: #0d1741;
    color: #fff;
    padding: 18px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1;
}
.lb-showing-modal__title {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
    line-height: 1.3;
}
.lb-showing-modal__subtitle {
    font-size: 12px;
    color: rgba(255,255,255,0.7);
    margin: 2px 0 0;
}
.lb-showing-modal__close {
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.15s;
}
.lb-showing-modal__close:hover { opacity: 1; }

.lb-showing-modal__body {
    padding: 24px;
}

/* =========================================================
   CALENDAR
   ========================================================= */
.lb-cal-section {
    margin-bottom: 20px;
}
.lb-cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.lb-cal-month-label {
    font-size: 14px;
    font-weight: 700;
    color: #0d1741;
}
.lb-cal-nav {
    background: none;
    border: 1px solid #ddd;
    width: 30px;
    height: 30px;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    color: #0d1741;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.lb-cal-nav:hover:not(:disabled) { background: #eef0f8; }
.lb-cal-nav:disabled { color: #ccc; cursor: default; }

.lb-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 2px;
}
.lb-cal-dow {
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: #888;
    padding: 4px 0;
    text-transform: uppercase;
}

.lb-cal-days-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
}
.lb-cal-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    border: 2px solid transparent;
    cursor: default;
    font-weight: 500;
    background: none;
    transition: background 0.12s, border-color 0.12s;
}
.lb-cal-day--empty { visibility: hidden; }
.lb-cal-day--past,
.lb-cal-day--unavailable {
    color: #ccc;
    cursor: default;
}
.lb-cal-day--available {
    background: #eef2ff;
    color: #0d1741;
    border-color: #c0cbf0;
    cursor: pointer;
    font-weight: 700;
}
.lb-cal-day--available:hover {
    background: #d0d9f7;
    border-color: #0d1741;
}
.lb-cal-day--selected {
    background: #0d1741 !important;
    color: #fff !important;
    border-color: #0d1741 !important;
}
.lb-cal-loading {
    font-size: 13px;
    color: #888;
    padding: 10px 0;
    text-align: center;
}

/* =========================================================
   TIME PICKER
   ========================================================= */
.lb-time-section {
    margin-bottom: 20px;
    padding: 14px 16px;
    background: #f8f9ff;
    border: 1px solid #dce3f8;
}
.lb-time-label {
    font-size: 13px;
    font-weight: 700;
    color: #0d1741;
    margin: 0 0 10px;
}
.lb-time-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.lb-time-btn {
    background: #fff;
    border: 2px solid #c0cbf0;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #0d1741;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
}
.lb-time-btn:hover { background: #eef2ff; border-color: #0d1741; }
.lb-time-btn--selected {
    background: #0d1741;
    border-color: #0d1741;
    color: #fff;
}

/* =========================================================
   SELECTED SLOT CONFIRMATION
   ========================================================= */
.lb-selected-slot {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f0fff4;
    border: 1px solid #b2dfdb;
    padding: 12px 16px;
    margin-bottom: 20px;
    font-size: 14px;
}
.lb-selected-slot__icon {
    color: #1a7a1a;
    font-size: 18px;
    flex-shrink: 0;
}
.lb-selected-slot__text {
    font-weight: 600;
    color: #1a7a1a;
    flex: 1;
}
.lb-selected-slot__change {
    background: none;
    border: 1px solid #1a7a1a;
    color: #1a7a1a;
    font-size: 12px;
    padding: 4px 10px;
    cursor: pointer;
    flex-shrink: 0;
}
.lb-selected-slot__change:hover { background: #e8f5e9; }

/* Free-text fallback */
#lb-slot-freetext {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    font-size: 14px;
    box-sizing: border-box;
    margin-top: 6px;
}
.lb-slot-picker__label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin-bottom: 6px;
}

/* =========================================================
   FORM FIELDS
   ========================================================= */
.lb-showing-form__row {
    margin-bottom: 14px;
}
.lb-showing-form__row label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}
.lb-showing-form__row label .lb-req {
    color: #bb2125;
    margin-left: 2px;
}
.lb-showing-form__row input[type="text"],
.lb-showing-form__row input[type="email"],
.lb-showing-form__row input[type="tel"],
.lb-showing-form__row textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    font-size: 14px;
    font-family: inherit;
    color: #222;
    background: #fff;
    box-sizing: border-box;
    transition: border-color 0.15s;
}
.lb-showing-form__row input:focus,
.lb-showing-form__row textarea:focus {
    outline: none;
    border-color: #0d1741;
}
.lb-showing-form__row textarea {
    resize: vertical;
    min-height: 72px;
}

.lb-showing-form__slot-hidden {
    display: none;
}

/* =========================================================
   SUBMIT BUTTON
   ========================================================= */
.lb-showing-submit {
    width: 100%;
    padding: 14px;
    background: #0d1741;
    color: #fff;
    border: none;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
    margin-top: 4px;
}
.lb-showing-submit:hover  { background: #1a2a6e; }
.lb-showing-submit:disabled { background: #999; cursor: not-allowed; }

/* =========================================================
   STATUS MESSAGES
   ========================================================= */
.lb-showing-status {
    display: none;
    padding: 12px 16px;
    font-size: 14px;
    margin-top: 14px;
}
.lb-showing-status--error {
    background: #fff0f0;
    border: 1px solid #f5c6cb;
    color: #a02020;
}
.lb-showing-status--success {
    background: #f0fff4;
    border: 1px solid #c3e6cb;
    color: #1a7a1a;
}

/* =========================================================
   TRIGGER BUTTON STATE OVERRIDES
   (when modal is open from a card vs. sidebar)
   ========================================================= */
.lb-btn--schedule[data-lb-showing-trigger],
.lb-sidebar__btn--schedule[data-lb-showing-trigger] {
    cursor: pointer;
}

/* =========================================================
   MOBILE
   ========================================================= */
@media (max-width: 600px) {
    .lb-showing-modal__panel {
        max-height: 100vh;
        margin: 0;
        align-self: flex-end;
        animation: lb-modal-slide-up 0.22s ease;
    }
    @keyframes lb-modal-slide-up {
        from { transform: translateY(100%); }
        to   { transform: translateY(0); }
    }
    .lb-slot-picker__grid {
        grid-template-columns: 1fr;
    }
}
