/* Mobile-friendly responsive styles */

/* Mobile menu toggle button */
.mobile-menu-toggle {
    display: none;
    background: #666;
    color: #fff;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
}

.mobile-menu-toggle:hover {
    background: #555;
}

@media screen and (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
    }
    
    .menu {
        display: none;
    }
}

/* Base mobile styles */
@media screen and (max-width: 980px) {
    #wrap, #wraphome {
        width: 100%;
        max-width: 980px;
    }
    
    .header, .headershort, .logo, .logohome {
        width: 100%;
        height: auto;
    }
    
    .header {
        height: auto;
        min-height: 200px;
    }
    
    /* Container adjustments */
    #container {
        margin: 0 20px;
    }
    
    .content {
        width: 100%;
        padding: 0 10px;
        box-sizing: border-box;
    }
}

/* Tablet styles */
@media screen and (max-width: 768px) {
    /* Navigation menu */
    .menu {
        background: #666;
        width: 100%;
    }
    
    .menu ul {
        width: 100%;
        padding: 0;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        height: auto;
    }
    
    .menu ul li {
        margin: 0;
        padding: 10px 0;
    }
    
    .menu ul li a {
        padding: 10px 15px;
        border: none;
        font-size: 13px;
    }
    
    /* Main content area */
    .main {
        width: 100%;
        float: none;
    }
    
    .sidebar {
        width: 100%;
        float: none;
        margin-top: 20px;
    }
    
    /* Adjust main content containers */
    .mainfulltop, .mainfulltop2 {
        width: 100%;
        box-sizing: border-box;
        background-size: 100% 100%;
    }
    
    .mainitemtxt, .mainitemtxt2 {
        width: 100%;
        box-sizing: border-box;
    }
    
    .bottomfull {
        width: 100%;
        background-size: 100% 100%;
    }
    
    /* Middle section adjustments */
    .middle {
        width: 100%;
    }
    
    .midleft {
        float: none;
        padding: 20px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .midright {
        float: none;
        width: 100%;
        padding: 20px;
        box-sizing: border-box;
    }
    
    /* Form adjustments */
    .ipsearch, .whoissearch, .traceroutesearch {
        width: 200px;
        max-width: 100%;
    }
    
    /* Map adjustments */
    #map, #map_desc {
        width: 100%;
        float: none;
        margin-bottom: 20px;
    }
    
    .mapimg {
        width: 100%;
        max-width: 300px;
        height: auto;
        float: none;
        margin: 0 auto 20px;
        display: block;
    }
    
    /* IP list columns */
    .iplist, .iplist2 {
        width: 100%;
        float: none;
        margin: 0;
    }
    
    .iplist2 {
        margin-top: 20px;
    }
}

/* Mobile phone styles */
@media screen and (max-width: 480px) {
    /* Further reduce padding and margins */
    #container {
        margin: 0 10px;
    }
    
    .content {
        padding: 0 5px;
    }
    
    /* Stack menu items vertically */
    .menu ul {
        flex-direction: column;
    }
    
    .menu ul li {
        width: 100%;
        text-align: center;
        border-bottom: 1px solid #444;
    }
    
    .menu ul li a {
        display: block;
        padding: 12px 10px;
    }
    
    /* Logo adjustments */
    .logo, .logohome {
        height: 100px;
        background-size: contain;
    }
    
    /* Font size adjustments */
    .maptitle {
        font-size: 20px;
    }
    
    .maptitle2 {
        font-size: 16px;
    }
    
    .mainfulltop {
        font-size: 16px;
    }
    
    /* Form inputs full width */
    .complaintform, .complaintform2 {
        width: 100%;
        box-sizing: border-box;
    }
    
    /* Sidebar adjustments */
    .sidebartop {
        width: 100%;
        background-size: 100% 100%;
    }
    
    .sidebartxt {
        width: 100%;
        box-sizing: border-box;
        background: #fff8ee;
    }
    
    .sidebarbottom {
        width: 100%;
        background-size: 100% 100%;
    }
    
    /* Footer adjustments */
    .footer {
        width: 100%;
        padding: 10px;
        box-sizing: border-box;
    }
    
    .footerleft, .footerright {
        float: none;
        text-align: center;
        padding: 10px;
    }
    
    /* Complaint boxes */
    .complainttop327, .complainttop527, .complainttopfull {
        width: 100%;
        box-sizing: border-box;
        background-size: 100% 100%;
    }
    
    .complainttxt, .complainttxt2 {
        width: 100%;
        box-sizing: border-box;
        padding: 10px;
    }
    
    .complaintbottom {
        width: 100%;
        box-sizing: border-box;
        background-size: 100% 100%;
    }
    
    /* Hide search button margin */
    .searchbutton {
        margin: 10px auto;
        text-align: center;
    }
}

/* Utility classes for mobile */
@media screen and (max-width: 768px) {
    .clear {
        clear: both;
    }
    
    /* Ensure tables are responsive */
    table {
        width: 100%;
        overflow-x: auto;
        display: block;
    }
    
    /* Ensure images don't overflow */
    img {
        max-width: 100%;
        height: auto;
    }
    
    /* Text should not overflow */
    * {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
}

/* Fix for old IE7 specific styles */
@media screen and (max-width: 768px) {
    .home {
        background: none;
    }
    
    #wraphome {
        background: none;
    }
}

/* Ensure form elements are touch-friendly */
@media screen and (max-width: 768px) {
    input[type="text"],
    input[type="email"],
    input[type="submit"],
    textarea,
    select {
        min-height: 44px;
        font-size: 16px;
    }
    
    input[type="submit"] {
        padding: 10px 20px;
        cursor: pointer;
    }
}