/*
 * IJERT-MRP Mobile Responsive CSS
 * Makes all MRP pages mobile-friendly without changing functionality
 */

/* Global MRP Styles - Apply to all pages */
.box h2 {
    background: white !important;
}

/* Override header.php fixed heights */
#dynhgt, #seheight {
    min-height: auto !important;
    height: auto !important;
}

/* Mobile Responsive Styles - Applies to screens 768px and below */
@media (max-width: 768px) {
    
    /* Main Container */
    body .container_12, 
    body .container_16 {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 5px !important;
        margin: 0 auto !important;
        box-sizing: border-box !important;
    }
    
    /* Grid Columns - Stack Vertically on Mobile with highest priority */
    body .grid_1, body .grid_2, body .grid_3, body .grid_4, 
    body .grid_5, body .grid_6, body .grid_7, body .grid_8, 
    body .grid_9, body .grid_10, body .grid_11, body .grid_12,
    body .container_12 .grid_1, body .container_12 .grid_2, 
    body .container_12 .grid_3, body .container_12 .grid_4,
    body .container_12 .grid_5, body .container_12 .grid_6,
    body .container_12 .grid_7, body .container_12 .grid_8,
    body .container_12 .grid_9, body .container_12 .grid_10,
    body .container_12 .grid_11, body .container_12 .grid_12 {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 0 10px 0 !important;
        padding: 0 5px !important;
        float: none !important;
        display: block !important;
        box-sizing: border-box !important;
    }
    
    /* Box Elements */
    body .box {
        margin: 0 0 15px 0 !important;
        padding: 10px !important;
        min-height: auto !important;
    }
    
    body .box.round {
        min-height: auto !important;
    }
    
    body .box h2 {
        font-size: 16px !important;
        padding: 8px 10px !important;
    }
    
    body .box .block {
        padding: 10px !important;
    }
    
    /* Branding/Header */
    #branding {
        height: auto !important;
        padding: 10px 5px !important;
        font-size: 12px !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    
    #branding img {
        max-width: 100% !important;
        height: auto !important;
    }
    
    /* Remove Fixed Heights */
    #dynhgt, #seheight {
        min-height: auto !important;
        height: auto !important;
    }
    
    /* Header Repeat Section - from re_menu.php */
    body .header-repeat {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    /* Main Menu - from re_menu.php */
    body .main_menu {
        width: 100% !important;
        padding: 0 !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    body .main_menu ul {
        display: flex !important;
        flex-wrap: wrap !important;
        padding: 0 5px !important;
    }
    
    body .main_menu ul li {
        font-size: 11px !important;
        white-space: nowrap !important;
    }
    
    body .main_menu ul li a {
        padding: 8px 10px !important;
        font-size: 11px !important;
    }
    
    /* Navigation Menu (Welcome bar) - from re_menu.php */
    body ul.navmenu {
        width: 100% !important;
        padding: 5px !important;
        margin: 0 !important;
    }
    
    body ul.navmenu.main {
        height: auto !important;
        min-height: 30px !important;
        border-radius: 8px !important;
    }
    
    body ul.navmenu li {
        display: block !important;
        width: 100% !important;
        margin: 2px 0 !important;
        font-size: 11px !important;
    }
    
    body ul.navmenu li a {
        padding: 6px 10px !important;
        font-size: 11px !important;
        display: block !important;
    }
    
    body ul.navmenu li a span {
        font-size: 11px !important;
    }
    
    body ul.navmenu li a span:after {
        content: "" !important;
        padding-left: 0 !important;
    }
    
    /* Float Clearing - re_menu.php has float:left and float:right */
    body div[style*="float:left"],
    body div[style*="float: left"],
    body div[style*="float:right"],
    body div[style*="float: right"] {
        float: none !important;
        width: 100% !important;
        display: block !important;
    }
    
    /* Grid 12 divs with inline styles - re_menu.php line 143 */
    body .grid_12[style] {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding: 5px !important;
    }
    
    /* Tables */
    table {
        font-size: 11px !important;
        width: 100% !important;
        overflow-x: auto !important;
        display: block !important;
    }
    
    table td, table th {
        padding: 6px 3px !important;
        font-size: 11px !important;
    }
    
    table.data {
        white-space: nowrap !important;
    }
    
    /* Forms */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="date"],
    textarea,
    select {
        width: 100% !important;
        max-width: 100% !important;
        font-size: 14px !important;
        padding: 8px !important;
        box-sizing: border-box !important;
    }
    
    /* Buttons */
    button,
    .btn,
    input[type="submit"],
    input[type="button"] {
        padding: 10px 15px !important;
        font-size: 14px !important;
        width: auto !important;
        min-width: 80px !important;
    }
    
    /* Images */
    img {
        max-width: 100% !important;
        height: auto !important;
    }
    
    /* Text */
    h1 {
        font-size: 20px !important;
    }
    
    h2 {
        font-size: 18px !important;
    }
    
    h3 {
        font-size: 16px !important;
    }
    
    h4 {
        font-size: 14px !important;
    }
    
    /* Navigation */
    ul.navmenu,
    ul.section {
        font-size: 12px !important;
    }
    
    ul.navmenu li a,
    ul.section li a {
        padding: 8px 10px !important;
        font-size: 12px !important;
    }
    
    /* Clear Floats */
    .clear {
        clear: both !important;
    }
    
    /* Flex Containers - Stack vertically except MRP menu */
    body div[style*="display: flex"]:not(.mrp-menu-container),
    body div[style*="display:flex"]:not(.mrp-menu-container) {
        flex-direction: column !important;
        gap: 10px !important;
    }
    
    /* Flex items inside stacked containers */
    body div[style*="display: flex"] > div[style*="flex:"],
    body div[style*="display:flex"] > div[style*="flex:"] {
        flex: 1 1 100% !important;
        max-width: 100% !important;
    }
    
    /* Modal/Popup */
    .modal-content {
        width: 95% !important;
        margin: 5% auto !important;
        padding: 15px !important;
    }
    
    /* Stats and Cards */
    .stats-card,
    .earning-box,
    .earning-breakdown {
        padding: 15px !important;
        margin-bottom: 15px !important;
    }
    
    /* Status Badges */
    .status-badge {
        font-size: 10px !important;
        padding: 3px 8px !important;
    }
    
    /* Filters */
    .filter-box,
    .filter-tabs {
        flex-wrap: wrap !important;
    }
    
    /* Footer */
    #site_info {
        font-size: 11px !important;
        padding: 10px !important;
        text-align: center !important;
    }
    
    #site_info p {
        line-height: 20px !important;
    }
    
    /* MRP Menu - Additional Responsive Rules */
    .mrp-menu-container {
        padding: 8px !important;
    }
    
    .mrp-menu-container a,
    .mrp-menu-container div {
        font-size: 11px !important;
        padding: 6px 10px !important;
        margin: 3px !important;
    }
    
    /* Prevent Horizontal Scroll */
    body {
        overflow-x: hidden !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    html {
        overflow-x: hidden !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* Responsive Typography */
    p, li, span, div {
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
    }
    
    /* Icon sizes in navigation */
    body .navmenu i,
    body .main_menu i {
        font-size: 12px !important;
        margin-right: 3px !important;
    }
    
    /* Submenu in main_menu */
    body .main_menu ul ul {
        position: static !important;
        display: block !important;
        padding-left: 15px !important;
    }
    
    body .main_menu ul ul li {
        border-left: 2px solid #ddd !important;
        margin-left: 10px !important;
    }
    
    /* Welcome text truncation */
    body .ico-name a span {
        display: block !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
        max-width: 90vw !important;
    }
    
    /* Better touch targets - but not for navigation */
    input[type="submit"], 
    input[type="button"],
    button:not(.mrp-menu-container button) {
        min-height: 40px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    /* Keep menu links compact */
    body .mrp-menu-container a,
    body .mrp-menu-container button,
    body ul.navmenu a,
    body .main_menu a {
        min-height: auto !important;
    }
    
    /* MRP Menu - Mobile Hamburger Style (already handled in mrp-menu.php) */
    /* Additional mobile menu spacing adjustments only */
    
    /* Dashboard specific - make page content more compact */
    body .box.round h2 {
        font-size: 16px !important;
        padding: 10px !important;
        margin: 0 0 10px 0 !important;
    }
    
    body .earning-box {
        padding: 10px !important;
        margin-bottom: 10px !important;
    }
    
    body .earning-box h2 {
        font-size: 24px !important;
    }
    
    body .earning-box p {
        font-size: 11px !important;
    }
    
    body .stats-container {
        padding: 10px !important;
    }
    
    body .stats-container h6 {
        font-size: 13px !important;
    }
    
    body .stat-item {
        font-size: 11px !important;
        padding: 8px !important;
    }
    
    body .reward-info {
        padding: 10px !important;
        margin-bottom: 10px !important;
    }
    
    body .reward-info h4 {
        font-size: 13px !important;
    }
    
    body .reward-info p {
        font-size: 12px !important;
    }
    
    /* Welcome box and gradient containers */
    body div[style*="linear-gradient"] {
        padding: 12px !important;
        margin-bottom: 12px !important;
    }
    
    body div[style*="linear-gradient"] h3 {
        font-size: 16px !important;
        margin: 0 0 8px 0 !important;
    }
    
    body div[style*="linear-gradient"] p {
        font-size: 12px !important;
        margin: 0 0 10px 0 !important;
    }
    
    body div[style*="linear-gradient"] button {
        padding: 8px 16px !important;
        font-size: 12px !important;
        margin-top: 8px !important;
    }
    
    body #referralCodeDash {
        font-size: 22px !important;
        letter-spacing: 2px !important;
        margin: 10px 0 !important;
    }
    
    /* Stats grid */
    body .stats-grid {
        flex-direction: column !important;
        gap: 8px !important;
    }
    
    /* Earning breakdown table */
    body .earning-box table {
        font-size: 11px !important;
    }
    
    body .earning-box table td {
        padding: 4px !important;
    }
    
    /* Make side-by-side earnings stack */
    body .earning-box div[style*="display: flex"] {
        flex-direction: column !important;
        gap: 10px !important;
    }
    
    body .earning-box div[style*="flex: 1"] {
        border-right: none !important;
        border-bottom: 2px solid rgba(255,255,255,0.3) !important;
        padding-right: 0 !important;
        padding-bottom: 10px !important;
        padding-left: 0 !important;
    }
    
    body .earning-box div[style*="flex: 1"]:last-child {
        border-bottom: none !important;
        padding-bottom: 0 !important;
    }
}

/* Tablet Styles (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .container_12 {
        width: 100% !important;
        padding: 0 20px !important;
    }
    
    .grid_10 {
        width: 75% !important;
    }
    
    .grid_2 {
        width: 23% !important;
    }
    
    table {
        font-size: 12px !important;
    }
}

