/**
 * Smart Solve Token (SST 2.0) - Comprehensive Mobile & Responsive Engine
 * Engineered for iPhones, Android phones, iPads, Foldables, Tablets, and Desktops.
 */

/* ==========================================================
   MOBILE HAMBURGER & DRAWER NAVIGATION
   ========================================================== */
.menu-toggle-btn {
    display: none;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem 0.65rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.menu-toggle-btn:hover {
    background: rgba(0, 210, 255, 0.15);
    border-color: var(--primary-blue);
    color: var(--primary-blue);
}

.mobile-nav-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 320px;
    max-width: 85vw;
    height: 100vh;
    height: 100dvh;
    background: rgba(4, 7, 20, 0.98);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-left: 1px solid rgba(0, 210, 255, 0.2);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 10000;
    overflow-y: auto;
    box-shadow: -15px 0 40px rgba(0, 0, 0, 0.8);
}

.mobile-nav-drawer.open {
    transform: translateX(0);
}

.drawer-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: rgba(2, 4, 12, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.drawer-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.mobile-nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    margin-top: 1.5rem;
}

.mobile-nav-links a {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid transparent;
    transition: all var(--transition-fast);
}

.mobile-nav-links a:hover,
.mobile-nav-links a.active {
    background: rgba(0, 210, 255, 0.1);
    border-color: rgba(0, 210, 255, 0.3);
    color: var(--primary-blue);
    transform: translateX(4px);
}

/* Horizontal Scroll Hint for Tables on Mobile */
.table-scroll-hint {
    display: none;
    font-size: 0.75rem;
    color: var(--primary-blue);
    margin-bottom: 0.6rem;
    align-items: center;
    gap: 0.4rem;
}

/* ==========================================================
   BREAKPOINTS: TABLETS & LARGE PHONES (max-width: 992px)
   ========================================================== */
@media (max-width: 992px) {
    .nav-links {
        display: none !important;
    }

    .menu-toggle-btn {
        display: inline-flex;
    }

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

    .tree-level-wrapper {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .tree-connector-vertical {
        display: none;
    }

    .tree-node.root-node {
        width: 100%;
        max-width: 100%;
    }
}

/* ==========================================================
   BREAKPOINTS: STANDARD MOBILE PHONES (max-width: 768px)
   ========================================================== */
@media (max-width: 768px) {
    :root {
        --header-height: 70px;
    }

    body {
        font-size: 15px;
    }

    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .section {
        padding: 3.5rem 0;
    }

    .section-header {
        margin-bottom: 2.5rem;
    }

    .section-header h2 {
        font-size: 1.75rem;
    }

    .section-header p {
        font-size: 0.95rem;
    }

    /* Brand Logo on Mobile */
    .brand-logo img {
        height: 36px;
        width: 36px;
    }

    .brand-name .brand-title {
        font-size: 1.05rem;
    }

    .brand-name .brand-sub {
        font-size: 0.6rem;
    }

    .header-actions {
        gap: 0.5rem;
    }

    .network-indicator {
        padding: 0.35rem 0.6rem;
        font-size: 0.75rem;
    }

    .network-indicator .network-name {
        display: none;
    }

    .btn-wallet {
        padding: 0.45rem 0.75rem;
        font-size: 0.8rem;
    }

    /* Hero Section Mobile */
    .home-hero {
        padding: 3.5rem 0 2.5rem;
    }

    .home-hero .hero-emblem {
        width: min(15rem, 66vw);
        height: auto;
    }

    .home-hero .hero-title {
        font-size: clamp(2.15rem, 10vw, 3.35rem);
        margin-bottom: 1rem;
    }

    .hero-tagline {
        font-size: 0.95rem;
        margin-bottom: 2rem;
    }

    .hero-buttons {
        flex-direction: column;
        width: 100%;
        gap: 0.75rem;
    }

    .hero-buttons .btn {
        width: 100%;
        padding: 0.85rem 1.25rem;
    }

    /* Stats Grid: Modern 2-Column Mobile App Layout */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.85rem;
    }

    .stat-card {
        padding: 1.15rem 1rem;
        border-radius: var(--radius-md);
    }

    .stat-title {
        font-size: 0.725rem;
    }

    .stat-icon {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
        border-radius: var(--radius-sm);
    }

    .stat-value {
        font-size: 1.35rem;
        margin-bottom: 0.2rem;
    }

    .stat-meta {
        font-size: 0.7rem;
    }

    /* Horizontal scroll on tables */
    .table-scroll-hint {
        display: flex;
    }

    .table-wrapper,
    .tech-table-container {
        border-radius: var(--radius-md);
        -webkit-overflow-scrolling: touch;
    }

    .web3-table th,
    .web3-table td,
    .tech-table th,
    .tech-table td {
        padding: 0.85rem 1rem;
        font-size: 0.825rem;
        white-space: nowrap;
    }

    /* Stepper on Mobile */
    .stepper {
        margin-bottom: 1.75rem;
        max-width: 100%;
    }

    .step-circle {
        width: 32px;
        height: 32px;
        font-size: 0.85rem;
    }

    .step-label {
        font-size: 0.65rem;
        margin-top: 0.35rem;
    }

    /* Referral link sharing box */
    .card {
        padding: 1.35rem 1.15rem;
        border-radius: var(--radius-md);
    }

    /* Modals on Mobile */
    .modal-overlay {
        padding: 1rem;
        align-items: flex-end;
    }

    .modal-box {
        max-width: 100%;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        transform: translateY(100%);
        max-height: 85vh;
        max-height: 85dvh;
        overflow-y: auto;
    }

    .modal-overlay.active .modal-box {
        transform: translateY(0);
    }

    .modal-header {
        padding: 1.25rem 1.25rem 1rem;
    }

    .modal-body {
        padding: 1.25rem;
    }

    .modal-footer {
        padding: 1rem 1.25rem;
        flex-direction: column-reverse;
        gap: 0.5rem;
    }

    .modal-footer .btn {
        width: 100%;
    }

    /* Toasts on Mobile */
    #toast-container {
        bottom: 1rem;
        left: 1rem;
        right: 1rem;
        width: calc(100vw - 2rem);
        max-width: 100%;
    }

    .toast {
        padding: 0.85rem 1rem;
        font-size: 0.825rem;
    }

    /* Footer on Mobile */
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

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

/* ==========================================================
   BREAKPOINTS: SMALL MOBILE SCREENS (max-width: 480px)
   ========================================================= */
@media (max-width: 480px) {
    .container {
        padding-left: 0.85rem;
        padding-right: 0.85rem;
    }

    .section-header h2 {
        font-size: 1.55rem;
    }

    .brand-logo {
        gap: 0.5rem;
    }

    .brand-logo img {
        width: 32px;
        height: 32px;
    }

    .brand-name .brand-title {
        font-size: 0.88rem;
        white-space: nowrap;
    }

    .brand-name .brand-sub {
        display: none;
    }

    .header-actions {
        gap: 0.35rem;
    }

    #header-wallet-btn {
        padding: 0.4rem 0.6rem;
    }

    .home-hero .hero-title {
        font-size: clamp(1.9rem, 10vw, 2.45rem);
    }

    /* Force 1 column on very narrow screens for wide stats if needed */
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-value {
        font-size: 1.4rem;
    }

    /* Form Inputs on Mobile */
    .form-input {
        font-size: 16px !important; /* Prevents auto-zoom in iOS Safari */
        padding: 0.75rem 1rem;
    }

    .btn-lg {
        max-width: 100%;
        padding-left: 1rem;
        padding-right: 1rem;
        white-space: normal;
        text-align: center;
    }

    /* Stepper labels compact */
    .stepper .step-item .step-label {
        font-size: 0.6rem;
    }

    /* Dashboard Action Buttons stacked */
    #dash-authenticated-content .card .btn {
        width: 100%;
    }

    .address-cell {
        gap: 0.4rem;
    }
}

@media (max-width: 360px) {
    #header-wallet-btn {
        display: none;
    }

    .home-hero .hero-title {
        font-size: 1.72rem;
        letter-spacing: -0.04em;
    }

    .home-hero .badge {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
        font-size: 0.72rem !important;
    }
}
