/**
 * BeBooked – My Account "My Reservations" styles
 *
 * Scoped under .bebooked-* to avoid collisions with theme styles.
 */

/* -------------------------------------------------------------------------
 * Toolbar (heading + refresh button row)
 * ---------------------------------------------------------------------- */

.bebooked-my-reservations {
    margin-top: 1em;
}

.bebooked-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5em;
    flex-wrap: wrap;
    gap: 0.5em;
}

.bebooked-heading {
    margin: 0;
    font-size: 1.25em;
}

/* -------------------------------------------------------------------------
 * Booking card grid
 * ---------------------------------------------------------------------- */

.bebooked-bookings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25em;
}

/* -------------------------------------------------------------------------
 * Individual booking card
 * ---------------------------------------------------------------------- */

.bebooked-booking-card {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: #fff;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.15s ease;
}

.bebooked-booking-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.09);
}

/* ---- Card header ---- */

.bebooked-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9em 1em;
    background: #f8f8f8;
    border-bottom: 1px solid #e0e0e0;
    gap: 0.5em;
}

.bebooked-business-name {
    font-weight: 600;
    font-size: 0.95em;
    color: #333;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---- Card body ---- */

.bebooked-card-body {
    padding: 0.85em 1em;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.45em;
}

.bebooked-detail {
    display: flex;
    justify-content: space-between;
    font-size: 0.9em;
    gap: 0.5em;
}

.bebooked-detail-label {
    color: #666;
    flex-shrink: 0;
}

.bebooked-detail-value {
    font-weight: 500;
    text-align: right;
}

/* ---- Card footer ---- */

.bebooked-card-footer {
    padding: 0.75em 1em;
    border-top: 1px solid #e9e9e9;
    background: #fafafa;
}

.bebooked-card-footer .button {
    width: 100%;
    text-align: center;
}

/* -------------------------------------------------------------------------
 * Status badges
 * ---------------------------------------------------------------------- */

.bebooked-status-badge {
    display: inline-block;
    padding: 0.2em 0.6em;
    border-radius: 3px;
    font-size: 0.75em;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    white-space: nowrap;
    flex-shrink: 0;
}

.bebooked-status-badge--confirmed {
    background: #d4edda;
    color: #155724;
}

.bebooked-status-badge--provisional {
    background: #fff3cd;
    color: #856404;
}

.bebooked-status-badge--pending {
    background: #cfe2ff;
    color: #084298;
}

.bebooked-status-badge--cancelled {
    background: #f8d7da;
    color: #842029;
}

.bebooked-status-badge--completed {
    background: #e2e3e5;
    color: #41464b;
}

.bebooked-status-badge--unknown {
    background: #e2e3e5;
    color: #41464b;
}

/* Greyed-out card for terminal statuses */

.bebooked-booking-card--cancelled,
.bebooked-booking-card--completed,
.bebooked-booking-card--no-show {
    opacity: 0.72;
}

.bebooked-status-badge--checked-in {
    background: #d1fae5;
    color: #065f46;
}

.bebooked-status-badge--no-show {
    background: #e2e3e5;
    color: #41464b;
}

/* -------------------------------------------------------------------------
 * Connect / re-auth form
 * ---------------------------------------------------------------------- */

.bebooked-connect-wrap {
    max-width: 480px;
}

.bebooked-connect-notice {
    margin-bottom: 1.25em;
}

.bebooked-connect-form .form-row {
    margin-bottom: 1em;
}

.bebooked-connect-form label {
    display: block;
    margin-bottom: 0.35em;
    font-weight: 500;
    font-size: 0.9em;
}

.bebooked-connect-form .input-text {
    width: 100%;
    box-sizing: border-box;
}

.bebooked-connect-error {
    margin-bottom: 0.75em;
}

.bebooked-connect-btn {
    min-width: 160px;
}

/* -------------------------------------------------------------------------
 * Loading / spinner state
 * ---------------------------------------------------------------------- */

.bebooked-is-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.bebooked-is-loading::after {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-left: 8px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: bebooked-spin 0.7s linear infinite;
    vertical-align: middle;
}

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

/* Button spinner variant */

button.bebooked-is-loading {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
}

/* -------------------------------------------------------------------------
 * Responsive adjustments
 * ---------------------------------------------------------------------- */

@media (max-width: 480px) {
    .bebooked-bookings-grid {
        grid-template-columns: 1fr;
    }

    .bebooked-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }
}
