/* 
 * Responsive Fixes for CashVers Application
 * Based on RESPONSIVENESS_AUDIT_REPORT.md
 * Priority: Critical fixes first
 */

/* ============================================
   CRITICAL: Remove 76px padding-top from wrapper
   ============================================ */
.wrapper {
    margin-top: 0;
}

/* ============================================
   GLOBAL FIXES - CRITICAL
   ============================================ */

/* Horizontal Scroll Prevention */
* {
    max-width: 100%;
    box-sizing: border-box;
}

body {
    overflow-x: hidden !important;
    width: 100% !important;
}

.container,
.container-fluid,
.container-space,
.wrapper,
.content,
.cover {
    max-width: 100% !important;
    overflow-x: hidden !important;
}

.row {
    margin-left: 0 !important;
    margin-right: 0 !important;
}

[class*="col-"] {
    max-width: 100% !important;
}

/* Fix swiper containers */
.swiper-container,
.swiper-wrapper {
    max-width: 100% !important;
    overflow: hidden !important;
}

/* ============================================
   TYPOGRAPHY SCALING
   ============================================ */

@media (max-width: 480px) {
    .heading-hero {
        font-size: clamp(24px, 6vw, 32px) !important;
    }
    
    .heading-section {
        font-size: clamp(20px, 5vw, 28px) !important;
    }
    
    .text-body {
        font-size: 15px !important;
    }
    
    .text-body-lg {
        font-size: 17px !important;
    }

    h1 { font-size: clamp(28px, 5vw, 48px) !important; line-height: 1.2 !important; }
    h2 { font-size: clamp(24px, 4vw, 36px) !important; line-height: 1.3 !important; }
    h3 { font-size: clamp(20px, 3vw, 28px) !important; line-height: 1.4 !important; }
    h4 { font-size: clamp(18px, 2.5vw, 24px) !important; line-height: 1.4 !important; }
    h5 { font-size: clamp(16px, 2vw, 20px) !important; line-height: 1.5 !important; }
    h6 { font-size: clamp(14px, 1.5vw, 18px) !important; line-height: 1.5 !important; }
}

/* ============================================
   CONTAINER PADDING
   ============================================ */

@media (max-width: 480px) {
    .container-space,
    .cover {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }
    
    .content {
        padding: 16px 12px !important;
        margin-top: 0 !important;
        padding-top: 16px !important;
    }
}

/* Remove excessive top margin from main content */
main.content,
.content {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Remove excessive top padding from wrapper - OVERRIDE 76px */
.wrapper {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

/* Nuclear override for any wrapper padding-top */
.wrapper[style*="padding-top"],
.wrapper {
    padding-top: 0 !important;
}

/* Remove gap between wrapper and content */
.wrapper > main.content,
.wrapper > .content,
.wrapper main.content,
.wrapper .content {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Remove gap from first child of content */
.wrapper > main.content > *:first-child,
.wrapper > .content > *:first-child,
main.content > *:first-child,
.content > *:first-child,
.wrapper > main.content > div:first-child,
.wrapper > .content > div:first-child {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Remove gap from widgets row if it's first */
.widgets-compact-row,
div[style*="padding: 12px"],
div[style*="padding: 8px"] {
    margin-top: 0 !important;
}

/* Force remove all top spacing from wrapper and its first children */
.wrapper,
.wrapper *:first-child {
    margin-top: 0 !important;
}

.wrapper > main.content,
.wrapper > main.content > *:first-child {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

/* Aggressively remove gap - target all possible sources */
body > .wrapper,
body .wrapper,
.nav-space ~ .wrapper,
.nav-space + .wrapper {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

.wrapper > main.content,
.wrapper > main.content > div:first-child,
.wrapper > main.content > div[style*="padding"]:first-child,
.wrapper > main.content > *:first-child {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Remove padding from widgets row */
.widgets-compact-row,
div[style*="padding: 12px"],
div[style*="padding: 8px"],
div[style*="padding: 4px"] {
    margin-top: 0 !important;
}

div[style*="padding: 12px 0"],
div[style*="padding: 8px 0"],
div[style*="padding: 4px 0"],
div[style*="padding: 2px 0"],
div[style*="padding: 0"] {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

/* Specifically target widgets row and its parent containers */
.widgets-compact-row,
div[style*="widgets-compact-row"],
div[style*="background: rgba(0, 0, 0, 0.2)"]:first-child,
.wrapper > main.content > div[style*="background: rgba(0, 0, 0, 0.2)"]:first-child,
.wrapper > main.content > div:first-child[style*="background: rgba(0, 0, 0, 0.2)"] {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Remove gap from cosmic-bg if it's first */
.cosmic-bg:first-child,
.wrapper > main.content > .cosmic-bg:first-child,
.wrapper > main.content > div:first-child > .cosmic-bg {
    margin-top: 0 !important;
    padding-top: 0 !important;
    margin-bottom: 0 !important;
}

/* Remove any spacing from container-space when it's first */
.container-space:first-child,
.wrapper > main.content > div:first-child > .container-space:first-child {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Nuclear option - remove ALL top spacing from first elements */
.wrapper > main.content > *:first-child,
.wrapper > .content > *:first-child,
main.content > *:first-child,
.content > *:first-child,
.wrapper > main.content > div:first-child,
.wrapper > main.content > div:first-child > *:first-child,
.wrapper > main.content > div:first-child > div:first-child {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Remove gap from cosmic-bg if it's first */
.cosmic-bg:first-child,
.wrapper > main.content > .cosmic-bg:first-child {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Target the widgets row div specifically */
.wrapper > main.content > div[style*="padding"]:first-child,
.wrapper > main.content > div[style*="background: rgba(0, 0, 0, 0.2)"]:first-child {
    margin-top: 0 !important;
    padding-top: 2px !important;
    padding-bottom: 2px !important;
}

/* Ensure no gap between header and wrapper */
.nav-space + .wrapper,
.nav-space ~ .wrapper {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Remove gap between header and first section */
.nav-space + *,
.nav-space ~ section:first-of-type,
.nav-space ~ .wrapper > main.content > section:first-of-type,
.nav-space ~ .wrapper > .content > section:first-of-type,
.wrapper > main.content > section:first-of-type,
.wrapper > .content > section:first-of-type,
main.content > section:first-of-type,
.content > section:first-of-type {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Remove any spacing after header */
.nav-space {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

/* Remove padding from section-space when it's the first section */
section.section-space:first-of-type,
.section-space:first-of-type,
.wrapper > main.content > section.section-space:first-of-type,
.wrapper > .content > section.section-space:first-of-type,
main.content > section.section-space:first-of-type,
.content > section.section-space:first-of-type,
.wrapper section.section-space:first-of-type {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

/* Remove any inline padding-top from first sections */
section.section-space[style*="padding-top"]:first-of-type {
    padding-top: 0 !important;
}

@media (max-width: 768px) {
    main.content,
    .content {
        padding-top: 0 !important;
    }
    
    .wrapper {
        padding-top: 0 !important;
    }
}

@media (max-width: 480px) {
    main.content,
    .content {
        padding-top: 0 !important;
    }
    
    .wrapper {
        padding-top: 0 !important;
    }
}

/* ============================================
   FORMS & INPUTS - CRITICAL (Prevent iOS Zoom)
   ============================================ */

@media (max-width: 768px) {
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="tel"],
    input[type="url"],
    textarea,
    select {
        font-size: 16px !important;
        padding: 14px 16px !important;
        min-height: 48px !important;
    }
    
    .form-control {
        border-radius: 12px !important;
        font-size: 16px !important;
        padding: 14px 16px !important;
        min-height: 48px !important;
    }
    
    .form-label {
        font-size: 14px !important;
        margin-bottom: 8px !important;
        font-weight: 500 !important;
    }
    
    .invalid-feedback {
        font-size: 12px !important;
        margin-top: 6px !important;
    }
    
    select.form-control {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ffffff' d='M6 9L1 4h10z'/%3E%3C/svg%3E") !important;
        background-repeat: no-repeat !important;
        background-position: right 16px center !important;
        padding-right: 40px !important;
        appearance: none !important;
        -webkit-appearance: none !important;
    }
    
    input[type="checkbox"],
    input[type="radio"] {
        width: 20px !important;
        height: 20px !important;
        min-width: 20px !important;
        min-height: 20px !important;
    }
}

/* Force single column on mobile */
@media (max-width: 768px) {
    .row > [class*="col-"] {
        padding-left: 0 !important;
        padding-right: 0 !important;
        margin-bottom: 16px !important;
    }
    
    .form-row .col-md-6,
    .form-row .col-lg-4,
    .form-row .col-lg-6 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
}

/* ============================================
   BUTTONS - CRITICAL (Touch Targets)
   ============================================ */

@media (max-width: 768px) {
    .btn,
    .primary-btn,
    .btn-space,
    .btn-space-primary,
    button {
        min-height: 48px !important;
        min-width: 48px !important;
        padding: 12px 20px !important;
        font-size: 16px !important;
        font-weight: 600 !important;
        border-radius: 12px !important;
    }
    
    .btn-sm,
    .btn-sm-space {
        min-height: 40px !important;
        padding: 10px 16px !important;
        font-size: 14px !important;
    }
    
    .btn-icon,
    .chat-input-icon-btn {
        min-width: 44px !important;
        min-height: 44px !important;
        padding: 10px !important;
    }
}

@media (max-width: 480px) {
    .btn,
    .primary-btn {
        width: 100% !important;
        margin-bottom: 12px !important;
    }
    
    .btn:last-child {
        margin-bottom: 0 !important;
    }
}

/* ============================================
   TABLES - CRITICAL (Horizontal Scroll)
   ============================================ */

@media (max-width: 768px) {
    table {
        display: block !important;
        width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    table thead {
        display: table-header-group !important;
    }
    
    table tbody {
        display: table-row-group !important;
    }
    
    table tr {
        display: table-row !important;
    }
    
    table th,
    table td {
        display: table-cell !important;
        padding: 10px 8px !important;
        font-size: 12px !important;
        white-space: nowrap !important;
    }
    
    table th {
        font-size: 11px !important;
        font-weight: 600 !important;
        background: rgba(0, 0, 0, 0.2) !important;
        position: sticky !important;
        top: 0 !important;
        z-index: 10 !important;
    }
}

/* Leaderboard Table */
@media (max-width: 768px) {
    .leaderboard-container {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        margin: 0 -12px !important;
        padding: 0 12px !important;
    }
    
    .leaderboard-table {
        min-width: 600px !important;
        font-size: 12px !important;
    }
    
    .leaderboard-table th,
    .leaderboard-table td {
        padding: 10px 8px !important;
        white-space: nowrap !important;
    }
}

/* Affiliate Table */
@media (max-width: 768px) {
    .affiliate-table-container {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        margin: 0 -12px !important;
        padding: 0 12px !important;
    }
    
    .affiliate-table {
        min-width: 500px !important;
        font-size: 12px !important;
    }
}

/* ============================================
   MODALS - CRITICAL
   ============================================ */

@media (max-width: 768px) {
    .modal-dialog {
        margin: 8px !important;
        max-width: calc(100% - 16px) !important;
    }
    
    .modal-content {
        border-radius: 16px !important;
    }
    
    .modal-header {
        padding: 20px 16px !important;
    }
    
    .modal-header .modal-title {
        font-size: 20px !important;
    }
    
    .modal-header .btn-close {
        width: 28px !important;
        height: 28px !important;
    }
    
    .modal-body {
        padding: 24px 16px !important;
    }
    
    .modal-footer {
        padding: 16px !important;
        flex-direction: column !important;
        gap: 12px !important;
    }
    
    .modal-footer .btn {
        width: 100% !important;
        margin: 0 !important;
    }
}

/* ============================================
   NAVIGATION
   ============================================ */

@media (max-width: 480px) {
    .nav-space-content {
        padding: 0 8px !important;
    }
    
    .logo-enhanced {
        font-size: 16px !important;
    }
    
    .site-logo-img {
        max-height: 50px !important;
        max-width: 150px !important;
    }
    
    .nav-space-links {
        gap: 4px !important;
    }
    
    .balance-display-space,
    .level-display-space {
        display: none !important;
    }
    
    .user-dropdown-toggle {
        padding: 6px 8px !important;
    }
    
    .user-avatar {
        width: 24px !important;
        height: 24px !important;
        font-size: 10px !important;
    }
    
    .chat-header-btn {
        width: 32px !important;
        height: 32px !important;
        padding: 4px !important;
        margin-right: 4px !important;
    }
    
    .user-dropdown-menu {
        position: fixed !important;
        left: 12px !important;
        right: 12px !important;
        min-width: 0 !important;
        width: auto !important;
        max-height: min(70vh, 420px) !important;
        overflow-y: auto !important;
    }
    .user-dropdown-menu.show {
        top: 56px !important;
        transform: none !important;
    }
}

/* Bottom Menu */
@media (max-width: 1199px) {
    /* Fixed bottom nav sits above the footer — reserve space so footer links stay clickable */
    body:has(nav.bottom-menu) footer.footer-sticky {
        margin-bottom: calc(78px + env(safe-area-inset-bottom, 0px)) !important;
    }

    nav.bottom-menu {
        position: fixed !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        z-index: 10050 !important;
        background: rgba(10, 10, 15, 0.98) !important;
        backdrop-filter: blur(12px) !important;
        -webkit-backdrop-filter: blur(12px) !important;
        border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
        box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.35) !important;
    }

    .bottom-menu {
        height: 70px !important;
        padding-bottom: env(safe-area-inset-bottom) !important;
    }

    body:has(nav.bottom-menu) .wrapper main.content,
    body:has(nav.bottom-menu) main.content {
        padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)) !important;
    }
    
    .bottom-menu .nav-link {
        min-height: 44px !important;
        padding: 8px 4px !important;
    }
    
    .bottom-menu .nav-link svg {
        width: 24px !important;
        height: 24px !important;
    }
    
    .bottom-menu .nav-link small {
        font-size: 11px !important;
        margin-top: 2px !important;
    }
}

/* ============================================
   HERO SECTION
   ============================================ */

@media (max-width: 480px) {
    .hero-modern {
        padding: 80px 0 60px !important;
        min-height: calc(100vh - 60px) !important;
    }
    
    .hero-title-modern {
        font-size: clamp(28px, 8vw, 42px) !important;
        margin-bottom: 16px !important;
    }
    
    .hero-subtitle-modern {
        font-size: 16px !important;
        margin-bottom: 24px !important;
    }
    
    .hero-cta-group {
        flex-direction: column !important;
        gap: 12px !important;
    }
    
    .hero-cta-group .btn {
        width: 100% !important;
    }
}

/* ============================================
   OFFER CARDS - Unified Responsive System
   ============================================ */

/* Offer cards - Clean responsive grid */
.offers-grid-space {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    width: 100%;
    max-width: 100%;
    justify-items: stretch;
    align-items: start;
}

@media (min-width: 1400px) {
    .offers-grid-space {
        grid-template-columns: repeat(4, 1fr);
        gap: 12px;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .offers-grid-space {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

@media (max-width: 767px) {
    .offers-grid-space {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .offers-grid-space {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

.offer-card-space {
    min-height: auto;
    padding: 0;
    width: 100%;
    max-width: 180px;
    min-width: 0;
    height: auto;
    align-self: start;
}

.offer-card-space .offer-image-space,
.offer-card-space img.offer-image-space {
    aspect-ratio: 1 / 1;
    width: 100%;
    height: auto;
    object-fit: cover;
    object-position: center;
    display: block;
}

.offer-card-space .offer-content-space {
    padding: 10px;
    gap: 6px;
    min-width: 0;
}

.offer-card-space .offer-title-space {
    font-size: 12px;
    line-height: 1.3;
    word-wrap: break-word;
    word-break: break-word;
}

.offer-card-space .offer-desc-space {
    font-size: 10px;
    line-height: 1.3;
    word-wrap: break-word;
    word-break: break-word;
}

.offer-card-space .offer-reward-space {
    font-size: 14px;
    line-height: 1.2;
    white-space: nowrap;
    flex-shrink: 1;
    min-width: 0;
}

.offer-card-space .offer-footer-space {
    padding-top: 6px;
    gap: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    min-width: 0;
}

.offer-card-space .offer-footer-space .btn-space-primary,
.offer-card-space .offer-footer-space .btn-sm-space {
    padding: 6px 12px;
    font-size: 11px;
    white-space: nowrap;
    flex-shrink: 0;
    border-radius: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Network cards - smaller */
.networks-grid-space {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) !important;
    gap: 16px !important;
}

.network-card-space {
    padding: 16px !important;
}

.network-image-container {
    height: 60px !important;
    margin-bottom: 12px !important;
}

.network-card-space h4 {
    font-size: 15px !important;
}

.network-card-space p {
    font-size: 12px !important;
}

/* General card-float reduction */
.card-float {
    padding: 20px !important;
}

@media (min-width: 768px) and (max-width: 1023px) {
    .offers-grid-space {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 12px;
    }
    
    .offer-card-space {
        width: 100%;
        max-width: 100%;
    }
    
    .offer-card-space .offer-content-space {
        padding: 10px;
        gap: 6px;
    }
    
    .offer-card-space .offer-title-space {
        font-size: 13px;
    }
    
    .offer-card-space .offer-desc-space {
        font-size: 11px;
    }
    
    .offer-card-space .offer-reward-space {
        font-size: 16px;
    }
    
    .offer-card-space .offer-footer-space .btn-space-primary,
    .offer-card-space .offer-footer-space .btn-sm-space {
        padding: 6px 12px;
        font-size: 11px;
    }
}

@media only screen and (min-device-width: 1024px) and (max-device-width: 1366px) and (-webkit-min-device-pixel-ratio: 2) {
    .offers-grid-space {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 12px;
    }
    
    .offer-card-space {
        width: 100%;
        max-width: 100%;
    }
    
    .offer-card-space .offer-content-space {
        padding: 12px;
        gap: 8px;
    }
    
    .offer-card-space .offer-title-space {
        font-size: 14px;
    }
    
    .offer-card-space .offer-desc-space {
        font-size: 12px;
    }
    
    .offer-card-space .offer-reward-space {
        font-size: 18px;
    }
    
    .offer-card-space .offer-footer-space {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    .offer-card-space .offer-footer-space .btn-space-primary,
    .offer-card-space .offer-footer-space .btn-sm-space {
        padding: 7px 14px;
        font-size: 12px;
    }
}

@media (max-width: 767px) {
    .offers-grid-space {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 8px;
    }
    
    .offer-card-space {
        width: 100%;
        max-width: 100%;
    }
    
    .offer-card-space .offer-image-space {
        aspect-ratio: 1 / 1;
        width: 100%;
        height: auto;
    }
    
    .offer-card-space .offer-content-space {
        padding: 8px;
        gap: 5px;
    }
    
    .offer-card-space .offer-title-space {
        font-size: 12px;
    }
    
    .offer-card-space .offer-desc-space {
        font-size: 10px;
    }
    
    .offer-card-space .offer-reward-space {
        font-size: 15px;
    }
    
    .offer-card-space .offer-footer-space {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }
    
    .offer-card-space .offer-footer-space .btn-space-primary,
    .offer-card-space .offer-footer-space .btn-sm-space {
        padding: 6px 10px;
        font-size: 10px;
        width: 100%;
    }
}
    
    .networks-grid-space {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)) !important;
        gap: 12px !important;
    }
    
    .network-card-space {
        padding: 12px !important;
    }
    
    .network-image-container {
        height: 50px !important;
    }
    
    .card-float {
        padding: 16px !important;
    }
    
    .slid-button {
        gap: 8px !important;
    }
    
    .prev, .next {
        width: 36px !important;
        height: 36px !important;
        font-size: 18px !important;
        padding: 0 !important;
    }
    
    .sec-title {
        flex-wrap: wrap !important;
        gap: 12px !important;
    }
    
    .sec-title h2 {
        font-size: 18px !important;
    }
    
    .sec-title a {
        font-size: 12px !important;
        padding: 8px 12px !important;
    }
}

@media (max-width: 480px) {
    .offers-grid-space {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .offer-card-space {
        width: 100%;
        max-width: 100%;
    }
    
    .offer-card-space .offer-image-space,
    .offer-card-space .offer-image-space.offer-placeholder-space {
        aspect-ratio: 1 / 1;
        width: 100%;
        height: auto;
        object-fit: cover;
    }
    
    .offer-card-space .offer-content-space {
        padding: 5px;
        gap: 3px;
    }
    
    .offer-card-space .offer-title-space {
        font-size: 9px;
        min-height: 23px;
    }
    
    .offer-card-space .offer-desc-space {
        display: block;
        font-size: 7px;
        min-height: 18px;
    }
    
    .offer-card-space .offer-reward-space {
        font-size: 11px;
    }
    
    .offer-card-space .offer-footer-space {
        padding-top: 5px;
        gap: 3px;
    }
    
    .offer-card-space .offer-footer-space .btn-space-primary,
    .offer-card-space .offer-footer-space .btn-sm-space {
        padding: 3px 5px;
        font-size: 7px;
    }
    
    .networks-grid-space {
        grid-template-columns: 1fr !important;
    }
    
    .card-float {
        padding: 12px !important;
    }
}


/* ============================================
   NETWORK CARDS
   ============================================ */

@media (max-width: 768px) {
    .networks-grid-space {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }
    
    .network-card-space {
        padding: 16px !important;
    }
    
    .network-image-container {
        height: 80px !important;
        margin-bottom: 12px !important;
    }
    
    .network-card-space h4 {
        font-size: 14px !important;
    }
    
    .network-card-space p {
        font-size: 12px !important;
    }
}

@media (max-width: 480px) {
    .networks-grid-space {
        grid-template-columns: 1fr !important;
    }
}

/* ============================================
   PROFILE PAGE
   ============================================ */

@media (max-width: 992px) {
    .profile-card {
        flex-direction: column !important;
        text-align: center !important;
    }
    
    .profile-card .avatar {
        margin: 0 auto 16px auto !important;
    }
    
    .profile-details {
        margin-left: 0 !important;
        width: 100% !important;
    }
}

@media (max-width: 768px) {
    #earningsChart {
        height: 200px !important;
        max-height: 200px !important;
    }
    
    .statistics .row {
        gap: 12px !important;
    }
    
    .statistics .col-md-6 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
    
    .stat-item {
        padding: 12px !important;
    }
    
    .stat-item svg {
        width: 20px !important;
        height: 20px !important;
    }
    
    .stat-title {
        font-size: 11px !important;
    }
    
    .stat-value {
        font-size: 18px !important;
    }
    
    .nav-tabs {
        flex-wrap: wrap !important;
    }
    
    .nav-tabs .nav-link {
        font-size: 12px !important;
        padding: 10px 8px !important;
        white-space: nowrap !important;
    }
    
    .profile-transaction-card {
        width: 100% !important;
        margin: 0 0 12px 0 !important;
    }
    
    .account-info .col-md-6 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        margin-bottom: 16px !important;
    }
}

/* ============================================
   CASHOUT PAGE
   ============================================ */

@media (max-width: 768px) {
    .my-balance {
        padding: 16px !important;
        margin-bottom: 16px !important;
    }
    
    .my-balance h6 {
        font-size: 12px !important;
        margin-bottom: 8px !important;
    }
    
    .my-balance p {
        font-size: 20px !important;
    }
    
    .redeem-container {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
    
    .payment-card {
        min-height: 120px !important;
        padding: 16px !important;
    }
    
    .payment-card img {
        max-width: 80px !important;
        max-height: 50px !important;
    }
}

@media (max-width: 480px) {
    .cashout .row {
        margin: 0 !important;
    }
    
    .cashout .col-12,
    .cashout .col-md-4,
    .cashout .col-md-6 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        padding: 0 0 16px 0 !important;
    }
}

/* Classic leaderboard (garnet cover.leaderboard): mobile spacing for fixed bottom nav */
@media (max-width: 991px) {
    .leaderboard .leaderboard-container {
        padding-bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px));
    }
}

@media (max-width: 768px) {
    .leaderboard .leaderboard-table-header {
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
        gap: 8px;
    }
}

/* ============================================
   LEADERBOARD
   ============================================ */

@media (max-width: 992px) {
    .leaderboard .row.justify-content-center {
        flex-direction: column !important;
        align-items: center !important;
    }
    
    .leaderboard-card {
        width: 100% !important;
        max-width: 300px !important;
        margin-bottom: 20px !important;
    }
}

@media (max-width: 768px) {
    .leaderboard-card {
        max-width: 100% !important;
        padding: 20px !important;
    }
    
    .profile-img {
        width: 80px !important;
        height: 80px !important;
    }
}

/* ============================================
   AFFILIATES PAGE
   ============================================ */

@media (max-width: 768px) {
    .affiliate .row {
        margin: 0 !important;
    }
    
    .affiliate .col-12,
    .affiliate .col-md-6,
    .affiliate .col-lg-4 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        margin-bottom: 16px !important;
        padding: 0 !important;
    }
    
    #referralLink {
        font-size: 12px !important;
        padding: 12px !important;
        word-break: break-all !important;
    }
}

/* ============================================
   IMAGES
   ============================================ */

img {
    max-width: 100% !important;
    height: auto !important;
}

/* ============================================
   SAFE AREA INSETS (iOS)
   ============================================ */

@supports (padding: max(0px)) {
    .nav-space {
        padding-top: max(8px, env(safe-area-inset-top)) !important;
    }
    
    .bottom-menu {
        padding-bottom: max(8px, env(safe-area-inset-bottom)) !important;
    }
    
    .content {
        padding-left: max(16px, env(safe-area-inset-left)) !important;
        padding-right: max(16px, env(safe-area-inset-right)) !important;
    }
    
    .modal-content {
        padding-bottom: max(24px, env(safe-area-inset-bottom)) !important;
    }
}

/* ============================================
   FOOTER & COOKIE BAR
   ============================================ */

@media (max-width: 480px) {
    body:has(.cookie-bar.show) footer {
        margin-bottom: 160px !important;
    }
    
    .cookie-bar {
        padding: 12px 0 !important;
    }
    
    .cookie-bar .container {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }
    
    .cookie-bar p,
    .cookie-bar .text-muted {
        font-size: 13px !important;
        line-height: 1.4 !important;
        margin-bottom: 10px !important;
    }
    
    .cookie-bar .btn {
        padding: 8px 14px !important;
        font-size: 13px !important;
    }
}

@media (max-width: 1199px) {
    body:has(.cookie-bar.show) {
        padding-bottom: 250px !important;
    }
    
    .cookie-bar {
        bottom: 70px !important;
    }
}

/* ============================================
   ACCESSIBILITY - FOCUS STATES
   ============================================ */

*:focus-visible {
    outline: 2px solid #00B8D4 !important;
    outline-offset: 2px !important;
}

/* ============================================
   PERFORMANCE OPTIMIZATIONS
   ============================================ */

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

/* ============================================
   REMOVE 76px padding-top from wrapper - Clean approach
   This file loads LAST, so it will override any previous rules
   ============================================ */

/* Remove padding-top from wrapper - clean CSS without !important */
/* This rule comes AFTER all other CSS files, so it naturally overrides */
.wrapper {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

.wrapper > main.content,
.wrapper > .content {
    padding-top: 0;
    margin-top: 0;
}

.wrapper > main.content > *:first-child,
.wrapper > .content > *:first-child {
    padding-top: 0;
    margin-top: 0;
}

/* Ensure widgets section has no top spacing */
.wrapper > main.content > div[style*="background: rgba(0, 0, 0, 0.2)"]:first-child {
    padding-top: 0;
    margin-top: 0;
}
