/* --- SCOPED CSS FOR FRONT OFFICE PAGE --- */

.fo-wrapper {
    font-family: 'Inter', sans-serif;
    max-width: 1400px;
    margin: auto;
}

/* Header */
.fo-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 15px;
}

/* The shared PageHeader is the wrapper's only child now: as a flex item it would shrink to its
   content and pull the actions next to the title - make it span the row so they stay right-aligned. */
.fo-header > .shell-page-header {
    width: 100%;
}

.fo-header-text h1 {
    font-size: 24px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 8px 0;
}

.fo-header-text p {
    font-size: 14px;
    color: #64748b;
    margin: 0;
}

.fo-header-actions {
    display: flex;
    gap: 10px;
}

/* Buttons */
.fo-btn {
    font-family: inherit;
    font-weight: 600;
    font-size: 13px;
    padding: 8px 16px;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.fo-btn-checkin  { background-color: #2563eb; color: #ffffff; }
.fo-btn-checkin:hover { background-color: #1d4ed8; }
.fo-btn-checkout { background-color: #7c3aed; color: #ffffff; }
.fo-btn-checkout:hover { background-color: #6d28d9; }
.fo-btn-secondary { background-color: #ffffff; border-color: #cbd5e1; color: #475569; }
.fo-btn-secondary:hover { background-color: #f8fafc; border-color: #94a3b8; color: #1e293b; }
.fo-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* --- Summary Stat Cards --- */
.fo-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 28px;
}

.fo-stat-card {
    background-color: #ffffff;
    border-radius: 8px;
    padding: 16px;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.fo-stat-title {
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
    margin-bottom: 8px;
}

.fo-stat-value {
    font-size: 26px;
    font-weight: 700;
    color: #1e293b;
    line-height: 1;
}

.fo-stat-icon {
    position: absolute;
    top: 50%;
    right: 16px;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    background-color: #ffffff;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    font-size: 20px;
}

.fo-stat-total {
    background: linear-gradient(90deg, #FAFAFF 0%, #E6E4FF 100%);
    border-bottom: 3px solid #4F46E5;
}
    .fo-stat-total .fo-stat-icon { color: #4F46E5; }

.fo-stat-available {
    background: linear-gradient(90deg, #F0FDF4 0%, #D1FAE5 100%);
    border-bottom: 3px solid #059669;
}
    .fo-stat-available .fo-stat-icon { color: #059669; }

.fo-stat-reserved {
    background: linear-gradient(90deg, #FFFBEB 0%, #FEF3C7 100%);
    border-bottom: 3px solid #B45309;
}
    .fo-stat-reserved .fo-stat-icon { color: #B45309; }

.fo-stat-checkedin {
    background: linear-gradient(90deg, #EFF6FF 0%, #DBEAFE 100%);
    border-bottom: 3px solid #1D4ED8;
}
    .fo-stat-checkedin .fo-stat-icon { color: #1D4ED8; }

/* --- Segmented status filter --- */
.fo-tabs-container {
    display: inline-flex;
    background-color: #F1F5F9;
    padding: 6px;
    border-radius: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.fo-tab {
    font-family: inherit;
    padding: 9px 20px;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}
    .fo-tab:hover { color: #1e293b; }
    .fo-tab.active {
        background-color: #ffffff;
        color: #0f172a;
        font-weight: 700;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
    }

/* --- Room table cells (table shell itself is the shared SpicDataTable / .spic-table) --- */
.fo-room-no {
    display: inline-block;
    background-color: #f1f5f9;
    color: #334155;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 3px 10px;
    font-weight: 700;
    font-size: 13px;
}

.fo-room-type { font-weight: 600; color: #1f2937; font-size: 14px; }
.fo-room-capacity { color: #9ca3af; font-size: 12px; margin-top: 2px; }

/* Status badges — same shape as LocationMaster's .status-pill, existing status colors kept */
.fo-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}
.fo-badge-available { background-color: #D1FAE5; color: #059669; }
.fo-badge-reserved  { background-color: #FEF3C7; color: #B45309; }
.fo-badge-checkedin { background-color: #DBEAFE; color: #1D4ED8; }
.fo-badge-completed { background-color: #E2E8F0; color: #475569; }
.fo-badge-paid      { background-color: #D1FAE5; color: #059669; }
.fo-badge-pending   { background-color: #FEF3C7; color: #B45309; }

.fo-guest-strong { font-weight: 600; color: #1f2937; font-size: 13.5px; }
.fo-guest-muted, .fo-muted { color: #9ca3af; font-size: 12.5px; }

.fo-date-value { font-size: 13px; color: #334155; }

.fo-empty {
    padding: 40px 20px;
    text-align: center;
    color: #64748b;
    font-size: 14px;
}

.fo-loading, .fo-error-card {
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    color: #6b7280;
    font-size: 14px;
}
.fo-error-card {
    background-color: #fef2f2;
    border-color: #fecaca;
    color: #b91c1c;
    font-weight: 500;
}

/* --- Modal helpers (unchanged behaviour, refined visuals) --- */
.fo-alert-success {
    background-color: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #047857;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 12px;
}
.fo-alert-warning {
    background-color: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 12px;
}
.fo-modal-message { margin-bottom: 12px; font-size: 0.85rem; }

.fo-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 16px 0;
}
.fo-field-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}
.fo-input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #1f2937;
}
.fo-input:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37,99,235,0.15); }

.fo-kv { display: flex; justify-content: space-between; padding: 8px 0; font-size: 0.85rem; }
.fo-kv-label { color: #6b7280; }
.fo-kv-value { font-weight: 600; color: #1f2937; }
.fo-divider { height: 1px; background: #e5e7eb; margin: 12px 0; }
.fo-total-value { color: #2563eb; font-size: 1.05rem; font-weight: 700; }

.fo-room-pick {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}
.fo-room-chip {
    min-width: 56px;
    text-align: center;
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 12px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: 0.2s;
}
.fo-room-chip:hover { border-color: #2563eb; color: #2563eb; }
.fo-room-chip.selected { background: #2563eb; color: #ffffff; border-color: #2563eb; }

/* --- Responsive (table itself follows LocationMaster's .table-responsive behavior) --- */
@media (max-width: 1024px) {
    .fo-summary-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
    .fo-header { flex-direction: column; align-items: stretch; }
    .fo-header-actions { justify-content: flex-end; }
    .fo-summary-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Front office tablet/mobile additions ── */
@media (max-width: 900px) {
    .fo-wrapper .table-controls { flex-wrap: wrap; row-gap: 8px; }
    .fo-wrapper .table-controls .search-box { min-width: 100%; margin-left: 0; }
}

@media (max-width: 768px) {
    /* Pagination: one row - Items Per Page left, pager right - same as the
       other list pages. Only prev / current / next stay visible. */
    .fo-wrapper .pagination-container {
        flex-direction: row;
        flex-wrap: nowrap;
        justify-content: space-between;
        align-items: center;
        gap: 8px;
    }

    .fo-wrapper .items-per-page {
        gap: 6px;
        white-space: nowrap;
    }

    .fo-wrapper .spic-page-status {
        display: none;
    }

    .fo-wrapper .pagination-controls {
        flex-wrap: nowrap;
        justify-content: flex-end;
        gap: 4px;
    }

    .fo-wrapper .page-btn {
        width: 28px;
        height: 28px;
        flex: 0 0 auto;
    }

    .fo-wrapper .page-btn.ellipsis,
    .fo-wrapper .page-btn.spic-pg-far,
    .fo-wrapper .page-btn.spic-pg-near:not(.active) {
        display: none;
    }

    .fo-tabs-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .fo-tab { white-space: nowrap; }
}

@media (max-width: 640px) {
    .fo-form-grid { grid-template-columns: 1fr; }
    .fo-kv { flex-wrap: wrap; gap: 6px; }
    .fo-header-actions { flex-wrap: wrap; gap: 8px; }
    .fo-header-actions .fo-btn { flex: 1 1 auto; }
}

@media (max-width: 480px) {
    .fo-summary-grid { grid-template-columns: 1fr; }
    .fo-tab { padding: 10px 12px; font-size: 0.78rem; }
}

/* native: phone */
.fo-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 8px;
}

    .fo-card-head .fo-room-no {
        margin-right: 8px;
    }

.fo-card-rows .fo-kv {
    padding: 6px 0;
    border-bottom: 1px dashed #eef0f3;
}

    .fo-card-rows .fo-kv:last-child {
        border-bottom: 0;
    }

@media (max-width: 1199.98px) {
    .fo-summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 767.98px) {
    .fo-header {
        margin-bottom: 8px;
    }

    .fo-btn {
        min-height: 44px;
    }

    .fo-summary-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        margin-bottom: 14px;
    }

    .fo-stat-card {
        padding: 12px 14px;
    }

    .fo-stat-value {
        font-size: 22px;
    }

    .fo-stat-icon {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }

    /* Status tabs scroll sideways instead of wrapping */
    .fo-tabs-container {
        display: flex;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        margin-bottom: 14px;
    }

    .fo-tabs-container::-webkit-scrollbar {
        display: none;
    }

    .fo-tab {
        flex: 0 0 auto;
        min-height: 40px;
        white-space: nowrap;
    }

    .fo-input {
        min-height: 44px;
        font-size: 16px; /* prevents iOS zoom on focus */
    }

    .fo-form-grid {
        grid-template-columns: 1fr;
    }

    .fo-room-chip {
        min-height: 44px;
        min-width: 56px;
    }

    /* Check-in / check-out dialogs (.fo-modal): bottom sheets on phones */
    .fo-modal .modal-dialog {
        max-width: none;
        margin: 0;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        align-items: flex-end;
        min-height: 0;
    }

    .fo-modal .modal-content {
        border-radius: 16px 16px 0 0 !important;
        max-height: 92vh;
    }

    .fo-modal .modal-body {
        padding: 16px !important;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .fo-modal .modal-footer {
        padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
        flex-wrap: wrap;
        gap: 8px;
    }

    .fo-modal .modal-footer .fo-btn {
        flex: 1 1 0;
        margin: 0;
        justify-content: center;
    }

    .fo-modal .btn-close {
        width: 44px;
        height: 44px;
        padding: 0;
        margin: -10px -10px -10px auto;
        background-size: 14px;
    }
}

@media (max-width: 480px) {
    .fo-btn-text {
        display: none;
    }
}
