/* ==========================================================================
   Smardoo Booking — Frontend CSS
   Primary: #1e3a5f  Accent: #3b82f6  Success: #10b981  Error: #ef4444
   ========================================================================== */

/* ------------------------------------------------------------------
   Reset / base
   ------------------------------------------------------------------ */
.sb-wrap *,
.sb-wrap *::before,
.sb-wrap *::after {
    box-sizing: border-box;
}

.sb-wrap {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: #1e293b;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ------------------------------------------------------------------
   Notices
   ------------------------------------------------------------------ */
.sb-notice {
    padding: 14px 18px;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 16px;
}
.sb-notice--error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}
.sb-notice--success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #15803d;
}

/* ------------------------------------------------------------------
   Global message banner
   ------------------------------------------------------------------ */
.sb-msg {
    padding: 12px 18px;
    border-radius: 6px;
    font-size: 14px;
    margin: 12px 0;
    font-weight: 500;
}
.sb-msg.is-success { background: #f0fdf4; border: 1px solid #86efac; color: #15803d; }
.sb-msg.is-error   { background: #fef2f2; border: 1px solid #fca5a5; color: #b91c1c; }

/* ------------------------------------------------------------------
   Loading bar
   ------------------------------------------------------------------ */
.sb-loading {
    height: 3px;
    background: #e2e8f0;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 4px;
}
.sb-loading__bar {
    height: 100%;
    width: 30%;
    background: #3b82f6;
    border-radius: 2px;
    animation: sb-slide 1.2s ease-in-out infinite;
}
@keyframes sb-slide {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(400%); }
}

/* ------------------------------------------------------------------
   Dashboard tabs
   ------------------------------------------------------------------ */
.sb-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 24px;
    padding: 0;
    flex-wrap: wrap;
}

.sb-tab {
    padding: 10px 20px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    border-radius: 4px 4px 0 0;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
    display: flex;
    align-items: center;
    gap: 6px;
}
.sb-tab:hover {
    color: #1e3a5f;
    background: #f1f5f9;
}
.sb-tab--active {
    color: #1e3a5f;
    border-bottom-color: #3b82f6;
    background: #f8fafc;
}
.sb-tab__icon { font-size: 12px; }

/* ------------------------------------------------------------------
   Tab panels
   ------------------------------------------------------------------ */
.sb-tab-panel { display: none; }
.sb-tab-panel--active { display: block; }

/* ------------------------------------------------------------------
   Panel header
   ------------------------------------------------------------------ */
.sb-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}
.sb-panel-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #1e3a5f;
}
.sb-panel-header__actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.sb-panel-header__actions select {
    padding: 7px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 13px;
    background: #fff;
}

/* ------------------------------------------------------------------
   Buttons
   ------------------------------------------------------------------ */
.sb-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.15s, border-color 0.15s, opacity 0.15s;
    text-decoration: none;
    line-height: 1;
}
.sb-btn--primary {
    background: #1e3a5f;
    color: #fff;
    border-color: #1e3a5f;
}
.sb-btn--primary:hover { background: #2d5082; border-color: #2d5082; }
.sb-btn--ghost {
    background: #fff;
    color: #475569;
    border-color: #cbd5e1;
}
.sb-btn--ghost:hover { background: #f1f5f9; }
.sb-btn--danger {
    background: #fef2f2;
    color: #b91c1c;
    border-color: #fecaca;
}
.sb-btn--danger:hover { background: #fee2e2; }
.sb-btn--success {
    background: #10b981;
    color: #fff;
    border-color: #10b981;
}
.sb-btn--secondary {
    background: #64748b;
    color: #fff;
    border-color: #64748b;
}
.sb-btn--secondary:hover { background: #475569; border-color: #475569; }
.sb-btn--large {
    padding: 13px 28px;
    font-size: 15px;
}
.sb-btn-sm {
    padding: 5px 11px;
    font-size: 12px;
}
.sb-btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ------------------------------------------------------------------
   Forms + fields
   ------------------------------------------------------------------ */
.sb-form-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.sb-form-card h3 {
    margin: 0 0 20px;
    font-size: 16px;
    font-weight: 600;
    color: #1e3a5f;
}

.sb-field-row {
    display: flex;
    gap: 16px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.sb-field-row .sb-field { flex: 1; min-width: 200px; }

.sb-field {
    margin-bottom: 14px;
}
.sb-field label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 5px;
}
.sb-field input[type="text"],
.sb-field input[type="email"],
.sb-field input[type="tel"],
.sb-field input[type="number"],
.sb-field input[type="time"],
.sb-field select,
.sb-field textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 14px;
    color: #1e293b;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
    -webkit-appearance: none;
    appearance: none;
}
.sb-field input:focus,
.sb-field select:focus,
.sb-field textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}
.sb-field small {
    display: block;
    font-size: 12px;
    color: #94a3b8;
    margin-top: 4px;
}
.sb-req { color: #ef4444; margin-left: 2px; }

.sb-form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* ------------------------------------------------------------------
   Tables
   ------------------------------------------------------------------ */
.sb-table-wrap {
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: #fff;
}

.sb-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.sb-table th {
    background: #f8fafc;
    text-align: left;
    padding: 11px 14px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #64748b;
    border-bottom: 1px solid #e2e8f0;
}
.sb-table td {
    padding: 12px 14px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    vertical-align: middle;
}
.sb-table tr:last-child td { border-bottom: none; }
.sb-table tr:hover td { background: #f8fafc; }
.sb-table .sb-actions { white-space: nowrap; }
.sb-table .sb-actions .sb-btn { padding: 5px 10px; font-size: 12px; margin-right: 4px; }

.sb-empty {
    text-align: center;
    padding: 40px 20px;
    color: #94a3b8;
    font-size: 14px;
    margin: 0;
}

/* ------------------------------------------------------------------
   Badges
   ------------------------------------------------------------------ */
.sb-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.sb-badge--accommodation { background: #dbeafe; color: #1d4ed8; }
.sb-badge--appointment   { background: #ede9fe; color: #6d28d9; }
.sb-badge--event         { background: #fef3c7; color: #b45309; }
.sb-badge--confirmed     { background: #d1fae5; color: #065f46; }
.sb-badge--cancelled     { background: #fee2e2; color: #991b1b; }
.sb-badge--verified      { background: #d1fae5; color: #065f46; }
.sb-badge--unverified    { background: #fef9c3; color: #854d0e; }

/* ------------------------------------------------------------------
   QR Scanner
   ------------------------------------------------------------------ */
.sb-scanner-wrap { display: flex; flex-direction: column; gap: 20px; }

.sb-scanner-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

#sb-verify-result .sb-verify-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 24px;
    border-left: 5px solid #10b981;
}
#sb-verify-result .sb-verify-card.is-error {
    border-left-color: #ef4444;
}
.sb-verify-card h3 { margin: 0 0 12px; color: #065f46; font-size: 17px; }
.sb-verify-card.is-error h3 { color: #b91c1c; }
.sb-verify-card dl { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; font-size: 14px; }
.sb-verify-card dt { font-weight: 500; color: #64748b; }
.sb-verify-card dd { margin: 0; color: #1e293b; word-break: break-all; }

/* ------------------------------------------------------------------
   Booking form (visitor)
   ------------------------------------------------------------------ */
.sb-booking-form {
    background: #f8fafc;
    border-radius: 12px;
    padding: 28px;
}

.sb-step {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
.sb-step__title {
    margin: 0 0 18px;
    font-size: 17px;
    font-weight: 600;
    color: #1e3a5f;
}

/* Offering select */
.sb-offering-select {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 15px;
    background: #fff;
}
.sb-offering-desc {
    margin-top: 12px;
    padding: 12px 16px;
    background: #f1f5f9;
    border-radius: 8px;
    font-size: 14px;
    color: #475569;
}

/* Slots grid */
.sb-slots-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}
.sb-slot-btn {
    padding: 9px 16px;
    border: 2px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.sb-slot-btn:hover:not(:disabled) {
    border-color: #3b82f6;
    background: #eff6ff;
}
.sb-slot-btn--selected {
    border-color: #1e3a5f;
    background: #1e3a5f;
    color: #fff;
}
.sb-slot-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    text-decoration: line-through;
}
.sb-slot-remaining {
    font-size: 11px;
    display: block;
    margin-top: 2px;
    opacity: 0.7;
}

/* Nights summary */
.sb-nights-summary {
    margin-top: 12px;
    padding: 12px 16px;
    background: #eff6ff;
    border-radius: 8px;
    font-size: 14px;
    color: #1d4ed8;
    font-weight: 500;
}

/* Price summary */
.sb-price-summary {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 20px;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.sb-price-summary__label { color: #374151; }
.sb-price-summary__amount {
    font-size: 22px;
    font-weight: 700;
    color: #065f46;
}

/* Checkout actions */
.sb-checkout-actions { margin-top: 24px; }

/* Success state */
.sb-booking-success {
    text-align: center;
    padding: 40px 24px;
}
.sb-success-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #10b981;
    color: #fff;
    font-size: 32px;
    line-height: 64px;
    margin: 0 auto 20px;
}
.sb-booking-success h3 {
    margin: 0 0 12px;
    font-size: 22px;
    color: #065f46;
}
.sb-booking-success p { color: #475569; font-size: 15px; }

/* QR code in success screen */
[id^="sb-success-qr-"] img {
    max-width: 200px;
    margin: 20px auto 0;
    display: block;
    border: 4px solid #e2e8f0;
    border-radius: 8px;
}

/* Loading overlay */
.sb-form-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,.65);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sb-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e2e8f0;
    border-top-color: #1e3a5f;
    border-radius: 50%;
    animation: sb-spin .75s linear infinite;
}
@keyframes sb-spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------
   Payment button
   ------------------------------------------------------------------ */
.sb-pay-btn {
    background: #10b981;
    color: #fff;
    border-color: #10b981;
    font-size: 16px;
    padding: 14px 32px;
    box-shadow: 0 4px 12px rgba(16,185,129,.35);
    transition: background 0.15s, box-shadow 0.15s;
}
.sb-pay-btn:hover {
    background: #059669;
    border-color: #059669;
    box-shadow: 0 6px 16px rgba(16,185,129,.45);
    color: #fff;
    text-decoration: none;
}

/* ------------------------------------------------------------------
   Calendar
   ------------------------------------------------------------------ */
.sb-calendar {
    margin-bottom: 20px;
}
.sb-calendar__nav {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}
.sb-calendar__title {
    font-size: 16px;
    font-weight: 600;
    color: #1e3a5f;
    min-width: 120px;
    text-align: center;
}
.sb-cal-header,
.sb-cal-body {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
}
.sb-cal-cell {
    aspect-ratio: 1 / 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 12px;
    position: relative;
    cursor: default;
}
.sb-cal-dow {
    font-weight: 600;
    color: #64748b;
    font-size: 11px;
    text-transform: uppercase;
    aspect-ratio: auto;
    padding: 4px 0;
}
.sb-cal-empty { background: transparent; }
.sb-cal-day {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    transition: background 0.1s;
}
.sb-cal-day:hover { background: #eff6ff; }
.sb-cal-today {
    border-color: #3b82f6;
    background: #eff6ff;
}
.sb-cal-today .sb-cal-day-num { font-weight: 700; color: #1e3a5f; }
.sb-cal-has-bookings { background: #f0fdf4; border-color: #86efac; }
.sb-cal-has-bookings:hover { background: #dcfce7; }
.sb-cal-day-num { font-size: 13px; line-height: 1; }
.sb-cal-dot {
    position: absolute;
    bottom: 4px;
    background: #10b981;
    color: #fff;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 5px;
    line-height: 1.4;
}
.sb-calendar__detail {
    margin-top: 10px;
    padding: 14px 18px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
}

/* ------------------------------------------------------------------
   Availability panel (blocked dates + rate plans)
   ------------------------------------------------------------------ */
.sb-custom-field-row { flex-wrap: wrap; }
.sb-custom-field-row input[type="text"],
.sb-custom-field-row select {
    padding: 6px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 13px;
    background: #fff;
}

/* ------------------------------------------------------------------
   Cancel booking form
   ------------------------------------------------------------------ */
.sb-cancel-booking-wrap { max-width: 540px; margin: 0 auto; }

/* ------------------------------------------------------------------
   Task 12: Event date badge (offerings list)
   ------------------------------------------------------------------ */
.sb-event-date-badge {
    display: inline-block;
    background: #e8f0fe;
    color: #1a56db;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 10px;
    margin-left: 8px;
    vertical-align: middle;
}

/* ------------------------------------------------------------------
   Task 13: Gallery section in tenant dashboard
   ------------------------------------------------------------------ */
.sb-gallery-section {
    margin-top: 12px;
}

.sb-gallery-panel {
    margin-top: 10px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.sb-gallery-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}

.sb-gallery-item {
    position: relative;
    display: inline-block;
}

.sb-gallery-thumb {
    width: 90px;
    height: 68px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #ddd;
    display: block;
}

.sb-gallery-delete {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #e53e3e;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 14px;
    line-height: 18px;
    text-align: center;
    cursor: pointer;
    padding: 0;
}

.sb-gallery-upload-label {
    cursor: pointer;
    display: inline-block;
}

/* ------------------------------------------------------------------
   Task 14: Event date display in visitor booking form
   ------------------------------------------------------------------ */
.sb-event-date-label {
    background: #ebf4ff;
    border: 1px solid #bee3f8;
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 16px;
    font-size: 15px;
    color: #2b6cb0;
}

.sb-event-date-value {
    font-weight: 600;
    margin-left: 6px;
}

.sb-event-passed-notice {
    color: #c53030;
    font-weight: 600;
    padding: 10px 0;
}

/* ------------------------------------------------------------------
   Task 14/15: Gallery strip in visitor booking form
   ------------------------------------------------------------------ */
.sb-gallery-strip-wrap {
    margin-bottom: 16px;
}

.sb-gallery-strip {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 6px;
}

.sb-gallery-strip-thumb {
    width: 120px;
    height: 90px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #ddd;
    flex-shrink: 0;
    cursor: pointer;
    transition: opacity 0.15s;
}

.sb-gallery-strip-thumb:hover {
    opacity: 0.85;
}

/* ------------------------------------------------------------------
   Task 14/15: CSS lightbox overlay
   ------------------------------------------------------------------ */
.sb-lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.82);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sb-lightbox-img {
    max-width: 92vw;
    max-height: 88vh;
    border-radius: 6px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}

.sb-lightbox-close {
    position: absolute;
    top: 16px;
    right: 20px;
    background: none;
    border: none;
    color: #fff;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

/* ------------------------------------------------------------------
   Responsive
   ------------------------------------------------------------------ */
@media (max-width: 640px) {
    .sb-tabs { gap: 2px; }
    .sb-tab  { padding: 8px 12px; font-size: 13px; }

    .sb-field-row { flex-direction: column; gap: 0; }
    .sb-field-row .sb-field { min-width: unset; }

    .sb-panel-header { flex-direction: column; align-items: flex-start; }

    .sb-booking-form { padding: 16px; }
    .sb-step { padding: 16px; }
}

.sb-text-success { color: #10b981; font-weight: 500; }
.sb-text-error { color: #ef4444; font-weight: 500; }
