/**
 * HD WhatsApp Notify - Universal Responsive Stylesheet
 * Optimized for Mobile (320px+), Tablets (768px+), Laptops (992px+), and Desktop/4K (1200px+)
 */

/* ==============================================================================
   1. Global Mobile & Touch Optimization
   ============================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    overflow-x: hidden;
    width: 100%;
    min-width: 320px;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

/* Prevent iOS Safari auto-zoom when focusing on inputs */
@media screen and (max-width: 767px) {
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="search"],
    input[type="tel"],
    input[type="url"],
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* Touch targets */
.btn, .nav-link, .dropdown-item, .form-check-input, .pagination .page-link {
    touch-action: manipulation;
}

/* ==============================================================================
   2. Responsive Fluid Typography & Spacing
   ============================================================================== */
h1, .h1, .display-4 {
    font-size: clamp(1.85rem, 4.5vw + 0.5rem, 3.25rem);
    line-height: 1.2;
    word-break: break-word;
}

h2, .h2 {
    font-size: clamp(1.5rem, 3vw + 0.5rem, 2.35rem);
    line-height: 1.25;
}

h3, .h3 {
    font-size: clamp(1.25rem, 2vw + 0.4rem, 1.75rem);
    line-height: 1.3;
}

h4, .h4 {
    font-size: clamp(1.1rem, 1.5vw + 0.3rem, 1.35rem);
}

.lead {
    font-size: clamp(0.98rem, 1.2vw + 0.5rem, 1.2rem) !important;
}

/* Code & pre blocks that never break responsive layouts */
pre, code, .code-snippet {
    max-width: 100%;
    overflow-x: auto;
    word-break: break-all;
    white-space: pre-wrap;
    -webkit-overflow-scrolling: touch;
}

/* ==============================================================================
   3. Universal Table Responsiveness
   ============================================================================== */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
    margin-bottom: 0;
}

/* Smooth custom scrollbars for wide data tables */
.table-responsive::-webkit-scrollbar {
    height: 6px;
}
.table-responsive::-webkit-scrollbar-track {
    background: #f1f5f9;
}
.table-responsive::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.table th, .table td {
    white-space: nowrap;
    vertical-align: middle;
}
.table td.allow-wrap {
    white-space: normal;
    min-width: 200px;
}

/* ==============================================================================
   4. Public Website (Main Layout) Responsiveness
   ============================================================================== */
.navbar-saas {
    transition: all 0.3s ease;
}

@media (max-width: 991.98px) {
    .navbar-saas {
        padding: 12px 0;
    }
    .navbar-collapse {
        background: #0f172a;
        padding: 18px;
        border-radius: 12px;
        margin-top: 12px;
        border: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 10px 25px rgba(0,0,0,0.4);
    }
    .navbar-nav .nav-link {
        padding: 10px 12px !important;
        border-radius: 6px;
    }
    .navbar-nav .nav-link:hover {
        background: rgba(255, 255, 255, 0.05);
    }
    .navbar-cta-group {
        display: flex;
        flex-direction: column;
        gap: 10px;
        margin-top: 15px;
        padding-top: 15px;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }
    .navbar-cta-group .btn {
        width: 100%;
        text-align: center;
        padding: 11px 18px;
    }
    
    .hero-section {
        padding: 45px 0 60px !important;
        text-align: center;
    }
    .hero-badge {
        margin-left: auto;
        margin-right: auto;
    }
    .hero-buttons {
        justify-content: center !important;
    }
    .hero-badges-row {
        justify-content: center !important;
    }
}

@media (max-width: 575.98px) {
    .hero-buttons .btn {
        width: 100%;
        margin-bottom: 8px;
    }
    .footer-saas {
        padding: 45px 0 25px;
        text-align: center;
    }
    .footer-saas .col-6 {
        width: 100%;
        margin-bottom: 20px;
    }
    .footer-bottom {
        flex-direction: column !important;
        text-align: center;
        gap: 15px;
    }
}

/* ==============================================================================
   5. Customer Dashboard & Admin Sidebar Drawer System
   ============================================================================== */
/* Modern Sidebar Styling */
.sidebar {
    width: 260px;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1045;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 25px rgba(0,0,0,0.15);
}

/* Sidebar Backdrop overlay for mobile & tablet */
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1040;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-backdrop.active {
    display: block;
    opacity: 1;
}

/* Mobile & Tablet Sidebar State (< 992px) */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .main-wrapper {
        margin-left: 0 !important;
        width: 100% !important;
    }
    .topbar {
        padding: 0 16px !important;
        height: 62px !important;
    }
    .content-body {
        padding: 16px 14px !important;
    }
}

/* Tablet landscape / Desktop (>= 992px) */
@media (min-width: 992px) {
    .sidebar {
        transform: translateX(0) !important;
    }
    .sidebar-backdrop {
        display: none !important;
    }
    .main-wrapper {
        margin-left: 260px !important;
        transition: margin-left 0.3s ease;
    }
    .topbar {
        padding: 0 32px;
        height: 68px;
    }
    .content-body {
        padding: 28px 32px;
    }
    .sidebar-close-btn {
        display: none !important;
    }
}

/* ==============================================================================
   6. Responsive Cards, Grids & Modals
   ============================================================================== */
.card-custom {
    border-radius: 12px;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

@media (max-width: 767.98px) {
    .card-custom-header {
        padding: 14px 16px !important;
        flex-direction: column;
        align-items: flex-start !important;
        gap: 10px;
    }
    .card-custom-body {
        padding: 16px !important;
    }
    .stat-card-value {
        font-size: 1.5rem !important;
    }
}

/* Modals touch safe */
.modal-dialog {
    margin: 1rem auto;
    max-width: calc(100% - 1.5rem);
}
@media (min-width: 576px) {
    .modal-dialog {
        max-width: 500px;
        margin: 1.75rem auto;
    }
    .modal-dialog.modal-lg {
        max-width: 800px;
    }
    .modal-dialog.modal-xl {
        max-width: 1140px;
    }
}

/* QR Code Container Mobile Scaling */
.qr-container {
    width: 100%;
    max-width: 280px;
    aspect-ratio: 1 / 1;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    padding: 14px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.06);
}
.qr-container img, .qr-container svg {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ==============================================================================
   7. Horizontal Scroll Step Indicators & Nav Tabs
   ============================================================================== */
.nav-tabs-responsive {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-bottom: 2px solid #e2e8f0;
    gap: 8px;
    padding-bottom: 4px;
}
.nav-tabs-responsive .nav-link {
    white-space: nowrap;
    flex-shrink: 0;
}
.nav-tabs-responsive::-webkit-scrollbar {
    height: 4px;
}
.nav-tabs-responsive::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
}

/* Responsive Action Header (Heading + Action Buttons) */
.page-action-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}
@media (min-width: 576px) {
    .page-action-header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}
