/* ===================================== */
/* RESPONSIVE OVERFLOW FIX FOR ALL BREAKPOINTS */
/* ===================================== */

/* Global overflow prevention */
html {
    overflow-x: hidden;
    width: 100%;
}

body {
    overflow-x: hidden;
    width: 100%;
    position: relative;
}

/* Ensure all containers respect viewport width */
*, *::before, *::after {
    max-width: 100%;
    box-sizing: border-box;
}

/* Main container responsive behavior */
.container {
    width: 100%;
    max-width: var(--container, 1180px);
    margin: 0 auto;
    padding: 0 15px;
    overflow-x: hidden;
}

.main-content {
    overflow-x: hidden;
    width: 100%;
}

/* Prevent images and media from causing overflow */
img, video, iframe, embed, object {
    max-width: 100%;
    height: auto;
}

/* Prevent tables from overflowing */
table {
    max-width: 100%;
    overflow-x: auto;
}

/* Reduce border-radius for domain cards */
.domain-card {
    border-radius: 12px !important;
}

/* Prevent code blocks from overflowing */
pre, code {
    max-width: 100%;
    overflow-x: auto;
    word-wrap: break-word;
}

/* ===================================== */
/* ULTRA-TINY: 128px - 247px */
/* ===================================== */
@media (min-width: 128px) and (max-width: 247.98px) {
    .container {
        padding: 0 8px;
    }
    
    .hero-title {
        font-size: 1.2rem;
    }
    
    .hero-subtitle {
        font-size: 0.8rem;
    }
    
    .footer-links-line {
        flex-direction: column;
        gap: 4px;
        line-height: 1.2;
    }
    
    .nav-menu {
        display: none;
    }
    
    .legal-content {
        padding: 1rem 0.5rem;
    }
    
    /* Hide non-essential elements */
    .footer-portals-line {
        display: none;
    }
}

/* ===================================== */
/* SMARTWATCH: 248px - 383px */
/* ===================================== */
@media (min-width: 248px) and (max-width: 383.98px) {
    .container {
        padding: 0 10px;
    }
    
    .hero-title {
        font-size: 1.5rem;
    }
    
    .hero-subtitle {
        font-size: 0.9rem;
    }
    
    .footer-links-line {
        flex-wrap: wrap;
        justify-content: center;
        gap: 6px 10px;
        line-height: 1.2;
    }
    
    .footer-links-line a {
        font-size: 0.75rem;
        padding: 0.3rem 0.8rem;
    }
    
    .legal-content {
        padding: 1.5rem 1rem;
    }
    
    .domain-card {
        padding: 1rem;
    }
    
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr !important;
        gap: 0.5rem;
    }
}

/* ===================================== */
/* MOBILE: 384px - 575px */
/* ===================================== */
@media (min-width: 384px) and (max-width: 575.98px) {
    .container {
        padding: 0 15px;
    }
    
    .hero-title {
        font-size: 1.8rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .footer-links-line {
        flex-wrap: wrap;
        gap: 8px 12px;
        line-height: 1.2;
    }
    
    .footer-links-line a {
        font-size: 0.8rem;
        padding: 0.35rem 0.9rem;
    }
    
    .legal-content {
        padding: 2rem 1.25rem;
    }
    
    .domain-card {
        padding: 1.25rem;
    }
    
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr !important;
        gap: 0.75rem;
    }
    
    /* Fix modal width */
    .modal-dialog {
        max-width: calc(100vw - 30px);
        margin: 15px;
    }
}

/* ===================================== */
/* MOBILE LARGE: 576px - 767px */
/* ===================================== */
@media (min-width: 576px) and (max-width: 767.98px) {
    .container {
        padding: 0 20px;
    }
    
    .hero-title {
        font-size: 2.2rem;
    }
    
    .hero-subtitle {
        font-size: 1.1rem;
    }
    
    .grid-2 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .grid-3, .grid-4 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem;
    }
    
    .legal-content {
        padding: 2.5rem 1.5rem;
    }
    
    .modal-dialog {
        max-width: calc(100vw - 40px);
        margin: 20px;
    }
}

/* ===================================== */
/* TABLET: 768px - 991px */
/* ===================================== */
@media (min-width: 768px) and (max-width: 991.98px) {
    .container {
        padding: 0 25px;
        max-width: 750px;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-subtitle {
        font-size: 1.15rem;
    }
    
    .grid-2 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .grid-3 {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    
    .grid-4 {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    
    .nav-menu {
        display: flex;
    }
    
    .mobile-menu-toggle {
        display: none;
    }
}

/* ===================================== */
/* DESKTOP: 992px - 1199px */
/* ===================================== */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .container {
        padding: 0 30px;
        max-width: 970px;
    }
    
    .hero-title {
        font-size: 2.8rem;
    }
    
    .grid-4 {
        grid-template-columns: repeat(4, 1fr) !important;
    }
}

/* ===================================== */
/* LARGE DESKTOP: 1200px - 1535px */
/* ===================================== */
@media (min-width: 1200px) and (max-width: 1535.98px) {
    .container {
        padding: 0 35px;
        max-width: 1170px;
    }
    
    .hero-title {
        font-size: 3rem;
    }
}

/* ===================================== */
/* HD MONITOR: 1536px - 2559px */
/* ===================================== */
@media (min-width: 1536px) and (max-width: 2559.98px) {
    .container {
        padding: 0 40px;
        max-width: 1400px;
    }
    
    .hero-title {
        font-size: 3.5rem;
    }
}

/* ===================================== */
/* 4K TV: 2560px+ */
/* ===================================== */
@media (min-width: 2560px) {
    .container {
        padding: 0 50px;
        max-width: 1920px;
    }
    
    .hero-title {
        font-size: 4rem;
    }
    
    .hero-subtitle {
        font-size: 1.5rem;
    }
}

/* ===================================== */
/* PREVENT HORIZONTAL SCROLL ON ALL ELEMENTS */
/* ===================================== */

/* Navbar overflow fix */
.navbar, .nav-container {
    overflow: hidden;
    width: 100%;
}

.nav-menu {
    overflow-x: hidden;
}

/* Footer overflow fix */
.footer {
    overflow-x: hidden;
    width: 100%;
}

.footer-content-new {
    overflow-x: hidden;
    width: 100%;
}

/* Legal pages overflow fix */
.legal-container {
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
}

.legal-content {
    overflow-x: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Form elements overflow fix */
input, textarea, select, button {
    max-width: 100%;
    box-sizing: border-box;
}

/* Modal overflow fix */
.modal-overlay {
    overflow-x: hidden;
}

.modal-dialog {
    max-width: calc(100vw - 20px);
    overflow-x: hidden;
}

/* Search container fix */
.search-container {
    max-width: 100%;
    overflow-x: hidden;
}

/* Domain cards fix */
.domain-list {
    overflow-x: hidden;
}

.domain-card {
    overflow-x: hidden;
    word-break: break-word;
}

/* Prevent long text from breaking layout */
h1, h2, h3, h4, h5, h6, p, li, a, span, div {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: none;
}

/* Ensure mobile drawer doesn't cause overflow */
.mobile-drawer {
    position: fixed;
    max-width: 100vw;
}

/* Fix for any absolutely positioned elements */
[style*="position: absolute"],
[style*="position: fixed"] {
    max-width: 100vw;
}

/* Emergency overflow prevention */
* {
    min-width: 0;
}

/* Prevent horizontal scroll from appearing */
@media (max-width: 2560px) {
    html, body {
        max-width: 100vw;
        overflow-x: hidden;
    }
}