/* ===================================================================
   TRATOK HOSPITALITY: phone layer shared by every portal page.
   Loaded by header.php after each page's own stylesheets, so it refines
   them without touching every page. Added 2026-10-16 (mobile pass).
   Bump the ?v= in header.php whenever this file changes: the portal's
   stylesheets are cached for hours, also at the Cloudflare edge.
   =================================================================== */

/* One wide element must never widen a phone page: mobile browsers then
   zoom the whole page out. clip, not hidden: hidden would turn the page into
   a scroll container and break anything sticky. */
@media (max-width: 900px) {
    html, body { overflow-x: clip; }
}

@media (max-width: 640px) {
    /* Page frame: 16px gutters, and room at the bottom so the Tara button
       never sits on top of the last button of a page. */
    .container { padding: 18px 16px 104px; }
    .breadcrumb { margin-bottom: 14px; font-size: 0.8rem; row-gap: 6px; }
    .breadcrumb .current { min-width: 0; overflow-wrap: anywhere; }
    .page-title { font-size: 1.55rem; line-height: 1.2; gap: 10px; }
    .page-title i { font-size: 1.15rem; }
    .page-subtitle { margin-bottom: 20px; font-size: 0.85rem; }
    .flash-message { padding: 12px 14px; align-items: flex-start; font-size: 0.85rem; line-height: 1.45; margin-bottom: 16px; }
    .flash-message > i { margin-top: 3px; flex-shrink: 0; }
    .card { padding: 18px 16px; }
    .empty-state { padding: 40px 12px; }
    .empty-state h2 { font-size: 1.25rem; }

    /* 16px text stops iPhones from zooming into a field when it is tapped. */
    .container input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="color"]),
    .container select,
    .container textarea,
    .tara-agent-input { font-size: 16px; }
    .form-group { margin-bottom: 16px; }
    .form-group label { font-size: 0.84rem; }
    .form-group input, .form-group select, .form-group textarea { padding: 12px 14px; }
    .form-row { row-gap: 0; }

    /* Comfortable touch targets. */
    .btn { min-height: 44px; }
    .btn-sm { min-height: 38px; }

    /* The browser's own file picker button is tiny; give it the portal's look. */
    input[type="file"] { max-width: 100%; font-size: 0.85rem; color: var(--text-muted); }
    input[type="file"]::file-selector-button {
        margin-right: 12px; padding: 10px 14px; border-radius: 10px; cursor: pointer;
        border: 1px solid rgba(212, 168, 67, 0.35); background: rgba(212, 168, 67, 0.1);
        color: var(--gold-300, #f0c850); font: 600 0.85rem var(--font-body);
    }
    [dir="rtl"] input[type="file"]::file-selector-button { margin-right: 0; margin-left: 12px; }

    /* Tab rows that scroll sideways: keep the swipe, hide the bar. */
    .feature-tabs, .notif-tabs { scrollbar-width: none; -webkit-overflow-scrolling: touch; }
    .feature-tabs::-webkit-scrollbar, .notif-tabs::-webkit-scrollbar { display: none; }

    /* Filter bars: full-width controls, not a narrow centred column. */
    .feature-filters { align-items: stretch; padding: 14px; }
    .feature-filters > *,
    .feature-filters select,
    .feature-filters input { width: 100%; }
    .feature-filters .btn { justify-content: center; }

    /* Figures: two tiles per row instead of one tall column. */
    .feature-kpis, .promo-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .feature-kpi { padding: 14px; }
    .feature-kpi-value { font-size: 1.25rem; overflow-wrap: anywhere; }
    .stats-grid { gap: 10px; }
    .stat-card { padding: 14px; }
    .stat-card .stat-label { padding-right: 26px; line-height: 1.35; }
    .stat-card .stat-value { font-size: 1.2rem; overflow-wrap: anywhere; }

    /* Guide field tables stack: the field name above its explanation. They
       were 380 to 454px wide on a 375px phone and widened the whole page. */
    .guide-fields, .guide-fields tbody, .guide-fields tr, .guide-fields td { display: block; width: 100%; }
    .guide-fields thead { display: none; }
    .guide-fields tbody td { border-bottom: 0; }
    .guide-fields tbody td:first-child { white-space: normal; width: auto; padding: 12px 14px 2px; }
    .guide-fields tbody td:last-child { padding: 0 14px 12px; }
    .guide-fields tbody tr + tr { border-top: 1px solid var(--border-subtle); }

    /* Other data tables scroll inside themselves. */
    .s-table, .data-table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

@media (max-width: 360px) {
    .feature-kpis, .promo-stats { grid-template-columns: minmax(0, 1fr); }
}
