/* ==============================================================================
   AegisCore - Enterprise Responsive Adaptations (320px - 1440px+)
   Universal Mobile, Tablet & Desktop Optimization
   ============================================================================== */

/* ------------------------------------------------------------------------------
   1. Base Mobile Ergonomics & Safe Area Insets
   ------------------------------------------------------------------------------ */
:root {
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
}

* {
    -webkit-tap-highlight-color: transparent;
}

body {
    padding-left: var(--safe-left);
    padding-right: var(--safe-right);
}

/* Touch-Friendly Action Buttons */
@media (max-width: 767px) {
    .btn {
        min-height: 44px;
        padding: 0.65rem 1rem;
    }
    .btn-sm {
        min-height: 38px;
        padding: 0.45rem 0.75rem;
    }
    
    /* Prevent iOS Safari auto-zooming on focus */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="tel"],
    input[type="search"],
    select,
    textarea,
    .form-control {
        font-size: 16px !important;
    }
}

/* ------------------------------------------------------------------------------
   2. Large Desktop (1280px - 1440px+)
   ------------------------------------------------------------------------------ */
@media (min-width: 1440px) {
    .container {
        max-width: 1360px;
    }
}

/* ------------------------------------------------------------------------------
   3. Tablets & Small Laptops (992px - 1199px)
   ------------------------------------------------------------------------------ */
@media (max-width: 1199px) {
    .footer-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2rem;
    }
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ------------------------------------------------------------------------------
   4. Admin & Medium Screens (Up to 1024px)
   ------------------------------------------------------------------------------ */
@media (max-width: 1024px) {
    /* Admin Off-Canvas Layout */
    .admin-container {
        display: block !important;
        position: relative !important;
        width: 100% !important;
        min-height: 100vh !important;
    }

    .admin-sidebar {
        position: fixed !important;
        top: 0 !important;
        left: -300px !important;
        width: 280px !important;
        height: 100vh !important;
        height: 100dvh !important;
        z-index: 10010 !important;
        overflow-y: auto !important;
        transition: left 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
        box-shadow: 15px 0 40px rgba(0, 0, 0, 0.85) !important;
    }

    .admin-sidebar.open {
        left: 0 !important;
    }

    .admin-sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(4, 6, 12, 0.8);
        backdrop-filter: blur(6px);
        -webkit-backdrop-filter: blur(6px);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
        z-index: 10005;
    }

    .admin-sidebar-overlay.open {
        opacity: 1;
        pointer-events: auto;
    }

    .admin-mobile-toggle {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        background: #0f172a;
        border: 1px solid var(--border-color);
        color: var(--accent-cyan);
        width: 40px;
        height: 40px;
        border-radius: var(--radius-sm);
        cursor: pointer;
        font-size: 1.25rem;
        margin-right: 0.75rem;
    }

    .admin-main {
        padding: 1.5rem 1.25rem !important;
        width: 100% !important;
    }

    .admin-header-bar {
        flex-wrap: wrap;
        gap: 1rem;
    }

    .admin-header-bar > div:last-child {
        flex-wrap: wrap;
        width: 100%;
        justify-content: flex-start;
    }

    /* Studio Grids */
    .sms-studio-grid,
    .voice-studio-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ------------------------------------------------------------------------------
   5. Medium Tablets & Mobile Landscape (768px - 991px)
   ------------------------------------------------------------------------------ */
@media (max-width: 991px) {
    .mobile-menu-toggle {
        display: inline-flex !important;
    }

    .navbar .nav-menu {
        display: none !important;
    }

    /* Hide desktop-only action buttons in top navbar to prevent header overflow */
    .nav-desktop-only {
        display: none !important;
    }

    .hero-graphic {
        display: none;
    }

    .hero-title {
        font-size: 2.45rem;
    }

    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }

    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
    }

    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Dashboard Layout Grid Stacking */
    .dashboard-layout-grid {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }

    .dashboard-sidebar-card {
        position: static !important;
        top: auto !important;
    }

    .dashboard-mobile-nav-toggle {
        display: flex !important;
    }

    .dashboard-nav-collapsible {
        display: none;
    }

    .dashboard-nav-collapsible.open {
        display: flex !important;
    }
}

/* ------------------------------------------------------------------------------
   6. Mobile Devices & Smartphones (320px - 767px)
   ------------------------------------------------------------------------------ */
@media (max-width: 767px) {
    .container {
        padding: 0 1rem;
    }

    .section {
        padding: 3rem 0;
    }

    .section-title {
        font-size: 1.75rem;
    }

    .hero-slider-wrapper {
        min-height: 480px;
        padding: 2.5rem 0;
    }

    .hero-title {
        font-size: 1.95rem;
    }

    .hero-desc {
        font-size: 0.95rem;
    }

    .hero-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .hero-actions .btn {
        width: 100%;
    }

    .slider-control-prev,
    .slider-control-next {
        display: none !important;
    }

    .grid-3, .grid-4, .grid-2 {
        grid-template-columns: 1fr !important;
    }

    .domain-search-form {
        flex-direction: column !important;
        gap: 0.75rem !important;
    }

    .domain-search-form .btn {
        width: 100% !important;
    }

    .tld-badges {
        gap: 0.75rem;
        justify-content: center;
    }

    .metrics-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.85rem;
    }

    .metric-val {
        font-size: 1.65rem;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .footer-bottom {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    /* Checkout & Cart Single-Column Flow */
    .checkout-flow-grid {
        grid-template-columns: 1fr !important;
    }

    /* Top Ticker Bar on Small Screens */
    .top-ticker-bar .ticker-phone {
        display: none !important;
    }

    .ticker-content {
        justify-content: center;
    }

    /* Modal dialogs */
    .modal-dialog,
    .modal-content,
    .pwa-modal-card {
        width: 95% !important;
        max-width: 95% !important;
        padding: 1.25rem !important;
        margin: 1rem auto !important;
    }
}

/* ------------------------------------------------------------------------------
   7. Ultra-Compact Devices (320px - 420px)
   ------------------------------------------------------------------------------ */
@media (max-width: 420px) {
    .brand-logo {
        font-size: 1.05rem !important;
    }

    .brand-logo svg {
        width: 24px !important;
        height: 24px !important;
    }

    .hero-title {
        font-size: 1.6rem !important;
    }

    .metrics-grid {
        grid-template-columns: 1fr !important;
    }

    .nav-actions {
        gap: 0.35rem !important;
    }

    .currency-selector {
        padding: 0.25rem 0.35rem !important;
        font-size: 0.75rem !important;
        max-width: 90px !important;
    }

    .cart-icon-btn {
        width: 34px !important;
        height: 34px !important;
    }

    .mobile-menu-toggle {
        width: 36px !important;
        height: 36px !important;
        font-size: 1.1rem !important;
    }
}

/* ------------------------------------------------------------------------------
   8. Responsive Tables with Touch Momentum Scrolling
   ------------------------------------------------------------------------------ */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    position: relative;
}

.table-responsive::-webkit-scrollbar {
    height: 6px;
}

.table-responsive::-webkit-scrollbar-track {
    background: #060a14;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: rgba(0, 240, 255, 0.3);
    border-radius: 3px;
}

.table-cyber {
    width: 100%;
    min-width: 580px;
    border-collapse: collapse;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.table-cyber th {
    background: #0d1527;
    border-bottom: 2px solid var(--border-color);
    padding: 0.85rem 1rem;
    text-align: left;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    color: var(--accent-cyan);
    white-space: nowrap;
}

.table-cyber td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.table-cyber tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* ------------------------------------------------------------------------------
   9. Mobile Navigation Drawer & Overlay (Public Site)
   ------------------------------------------------------------------------------ */
.mobile-menu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(4, 6, 12, 0.8);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 10001;
}

.mobile-menu-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.mobile-nav-drawer {
    position: fixed;
    top: 0;
    right: -100%;
    width: min(88%, 380px);
    height: 100vh;
    height: 100dvh;
    background: #080d1a;
    border-left: 1px solid rgba(0, 240, 255, 0.25);
    box-shadow: -15px 0 40px rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    z-index: 10002;
    transition: right 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-top: var(--safe-top);
    padding-bottom: var(--safe-bottom);
}

.mobile-nav-drawer.open {
    right: 0;
}

.mobile-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.mobile-drawer-close {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: #fff;
    font-size: 1.25rem;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.mobile-drawer-close:hover {
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}

.mobile-drawer-nav {
    list-style: none;
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.mobile-drawer-nav a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.mobile-drawer-nav a:hover,
.mobile-drawer-nav a.active {
    background: rgba(0, 240, 255, 0.08);
    color: var(--accent-cyan);
}

.mobile-drawer-actions {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: auto;
    background: #050811;
}

/* ------------------------------------------------------------------------------
   10. Dashboard Layout Responsive Grid
   ------------------------------------------------------------------------------ */
.dashboard-layout-grid {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 2.5rem;
    align-items: start;
}

.dashboard-mobile-nav-toggle {
    display: none;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: #0b1329;
    border: 1px solid var(--accent-cyan);
    color: #fff;
    font-weight: 700;
    border-radius: var(--radius-sm);
    cursor: pointer;
    margin-bottom: 1rem;
}

/* ------------------------------------------------------------------------------
   11. Admin Mobile Bar & Drawer Styles
   ------------------------------------------------------------------------------ */
.admin-mobile-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.25rem;
    background: #0b1120;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 999;
}

@media (max-width: 1024px) {
    .admin-mobile-header {
        display: flex;
    }
}

@media (min-width: 1025px) {
    .admin-sidebar-close-btn,
    .admin-mobile-header,
    .admin-sidebar-overlay {
        display: none !important;
    }
}

/* ------------------------------------------------------------------------------
   12. Universal Mobile Visibility Utilities
   ------------------------------------------------------------------------------ */
.hide-on-mobile {
    display: inherit;
}
.show-on-mobile {
    display: none !important;
}

@media (max-width: 767px) {
    .hide-on-mobile {
        display: none !important;
    }
    .show-on-mobile {
        display: block !important;
    }
}


