/* GLF India - Mobile responsiveness & global optimizations */

/* Base: smoother scrolling + better tap targets */
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { -webkit-tap-highlight-color: rgba(46,125,50,0.15); overflow-x: hidden; }
img, video, iframe { max-width: 100%; height: auto; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }

/* Make all tables horizontally scrollable on mobile */
@media (max-width: 768px) {
    .table-responsive, table { -webkit-overflow-scrolling: touch; }
    .table { font-size: 0.85rem; }
    .table td, .table th { padding: 0.5rem 0.4rem; white-space: nowrap; }
}

/* Dashboard / admin cards */
@media (max-width: 576px) {
    .container, .container-fluid { padding-left: 12px; padding-right: 12px; }
    h1, .h1 { font-size: 1.5rem; }
    h2, .h2 { font-size: 1.3rem; }
    h3, .h3 { font-size: 1.15rem; }
    h4, .h4 { font-size: 1rem; }
    .btn { padding: 0.5rem 0.9rem; font-size: 0.875rem; }
    .btn-sm { padding: 0.25rem 0.6rem; font-size: 0.75rem; }
    .card-body { padding: 1rem; }
    .p-5 { padding: 1.5rem !important; }
    .p-4 { padding: 1rem !important; }
    .py-5 { padding-top: 2rem !important; padding-bottom: 2rem !important; }
    .g-4 { --bs-gutter-x: 1rem; --bs-gutter-y: 1rem; }

    /* Forms */
    .form-control, .form-select { font-size: 16px; /* prevents iOS zoom */ }
    label.form-label { font-size: 0.85rem; }

    /* Modal sizing on mobile */
    .modal-dialog { margin: 0.5rem; }

    /* Hide decorative corners/frames that waste space on tiny screens */
    .corner { display: none !important; }

    /* Navbar collapse spacing */
    .navbar-collapse { margin-top: 0.5rem; }
    .navbar-nav .nav-link { padding: 0.6rem 0.75rem !important; }
}

/* Tenant layout safeguards */
@media (max-width: 768px) {
    .t-page-header h1 { font-size: 1.5rem !important; }
    .t-section { padding: 2rem 0 !important; }
    .t-card { border-radius: 12px !important; }
    .topbar-inner { flex-direction: column; gap: 6px; padding: 8px 0; text-align: center; }
    .topbar-left, .topbar-right { flex-wrap: wrap; justify-content: center; gap: 10px; }

    /* Hide social icons in tenant navbar on mobile (they are shown in footer instead) */
    .nav-socials { display: none !important; }
}

/* A4 pages (receipt, certificate, letter) - shrink preview on mobile but keep print A4 */
@media screen and (max-width: 768px) {
    .cert-page, .a4-page, .receipt-page {
        width: 100% !important;
        min-height: auto !important;
        transform-origin: top left;
    }
    .cert-content { padding: 8mm 6mm !important; min-height: auto !important; }
    .a4-page { padding: 12mm 10mm !important; font-size: 11pt !important; }
    .receipt-frame { margin: 4mm !important; }
    .receipt-frame-inner { padding: 4mm 5mm !important; }
}

/* Global share FAB on very small screens */
@media (max-width: 420px) {
    .glf-share-fab { bottom: 14px !important; right: 14px !important; }
    .glf-share-grid { grid-template-columns: repeat(4, 1fr) !important; gap: 8px !important; }
    .glf-share-item { padding: 8px 2px !important; font-size: 0.65rem !important; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visibility (accessibility) */
:focus-visible { outline: 2px solid #2e7d32; outline-offset: 2px; }

/* Print helper */
@media print {
    .no-print, .glf-share-fab, .glf-share-overlay, #glfPwaBanner { display: none !important; }
}
