/* World-Class Mobile Responsive CSS Framework
   =========================================== */

/* Base Mobile Optimizations */
* {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    touch-action: manipulation;
}

html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    -webkit-overflow-scrolling: touch;
    overflow-scrolling: touch;
}

/* Improved Touch Targets */
button,
a,
input,
textarea,
select {
    min-height: 44px;
    min-width: 44px;
}

/* Hide mobile elements on desktop */
@media (min-width: 769px) {
    .mobile-close {
        display: none !important;
    }
}

/* Mobile Navigation Hamburger Menu */
.mobile-menu-toggle {
    display: none;
    width: 48px;
    height: 48px;
    position: relative;
    background: transparent;
    border: 2px solid rgba(245, 158, 11, 0.2);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1001;
}

.mobile-menu-toggle:hover {
    border-color: #F59E0B;
    background: rgba(245, 158, 11, 0.05);
}

.mobile-menu-toggle:active {
    transform: scale(0.95);
}

.hamburger {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 18px;
}

.hamburger span {
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: #1A1F3A;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hamburger span:nth-child(1) {
    top: 0;
}

.hamburger span:nth-child(2) {
    top: 50%;
    transform: translateY(-50%);
}

.hamburger span:nth-child(3) {
    bottom: 0;
}

.mobile-menu-toggle.active .hamburger span:nth-child(1) {
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
}

.mobile-menu-toggle.active .hamburger span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active .hamburger span:nth-child(3) {
    bottom: 50%;
    transform: translateY(50%) rotate(-45deg);
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-menu-overlay.active {
    display: block;
    opacity: 1;
}

/* Tablet Landscape - 1024px */
@media (max-width: 1024px) {
    .container, .hero-container, .nav-container {
        padding-left: 32px;
        padding-right: 32px;
    }

    .hero-grid {
        gap: 40px;
    }

    .section {
        padding: 80px 32px;
    }

    h1 {
        font-size: clamp(36px, 8vw, 56px);
    }

    h2 {
        font-size: clamp(28px, 6vw, 40px);
    }

    .price-amount {
        font-size: clamp(42px, 8vw, 64px);
    }
}

/* Tablet Portrait - 768px */
@media (max-width: 768px) {
    /* Show mobile menu */
    .mobile-menu-toggle {
        display: flex;
    }

    /* Hide desktop navigation - support both .active and .mobile-open classes */
    .nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: min(320px, 85vw);
        height: 100vh;
        height: 100dvh;
        background: linear-gradient(180deg, #FFFFFF 0%, #FDFBF7 100%);
        box-shadow: -4px 0 24px rgba(0, 0, 0, 0.1);
        padding: 80px 24px 24px;
        overflow-y: auto;
        transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 999;
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .nav-menu.active,
    .nav-menu.mobile-open {
        right: 0;
    }

    .nav-menu a {
        display: block;
        padding: 16px 20px;
        margin: 0;
        border-radius: 12px;
        font-size: 16px;
        font-weight: 500;
        color: #1A1F3A;
        transition: all 0.3s ease;
        position: relative;
    }

    .nav-menu a:hover {
        background: rgba(245, 158, 11, 0.08);
        transform: translateX(4px);
    }

    .nav-menu a::after {
        content: '';
        position: absolute;
        left: 12px;
        top: 50%;
        transform: translateY(-50%);
        width: 3px;
        height: 0;
        background: #F59E0B;
        transition: height 0.3s ease;
        border-radius: 3px;
    }

    .nav-menu a:hover::after {
        height: 20px;
    }

    /* Mobile close button - ONLY visible on mobile */
    .mobile-close {
        display: flex;
        position: absolute;
        top: 20px;
        right: 20px;
        width: 40px;
        height: 40px;
        align-items: center;
        justify-content: center;
        background: rgba(0, 0, 0, 0.05);
        border: none;
        border-radius: 10px;
        cursor: pointer;
        font-size: 24px;
        color: #1A1F3A;
        transition: all 0.3s ease;
    }

    .mobile-close:hover {
        background: rgba(0, 0, 0, 0.1);
        transform: rotate(90deg);
    }

    /* Layout adjustments */
    .container, .hero-container {
        padding-left: 24px;
        padding-right: 24px;
    }

    .hero {
        padding-top: 100px;
        padding-bottom: 60px;
    }

    .hero-grid, .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .hero-left, .hero-right {
        text-align: center;
    }

    .hero-left h1 {
        font-size: clamp(32px, 9vw, 48px);
        line-height: 1.1;
    }

    .tagline {
        font-size: 18px;
        margin-bottom: 32px;
    }

    .cta-buttons {
        flex-direction: column;
        gap: 16px;
        width: 100%;
    }

    .btn {
        width: 100%;
        justify-content: center;
        padding: 16px 24px;
        font-size: 16px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .stat-card {
        padding: 20px;
    }

    .price-card {
        padding: 32px 24px;
    }

    .price-amount {
        font-size: clamp(36px, 10vw, 48px);
    }

    .features-list {
        gap: 12px;
    }

    .feature-item {
        padding: 12px;
        font-size: 14px;
    }

    .contact-methods {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .section {
        padding: 60px 24px;
    }

    .section-title {
        font-size: clamp(28px, 7vw, 36px);
    }

    .domain-card {
        padding: 20px;
    }

    .footer {
        padding: 48px 24px 24px;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 32px;
        text-align: center;
    }
}

/* Mobile Landscape & Large Phones - 640px */
@media (max-width: 640px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding: 80px 24px 40px;
    }

    .hero-grid {
        grid-template-columns: 1fr 1fr;
        gap: 24px;
    }

    .price-card {
        padding: 24px;
    }
}

/* Mobile Portrait - 480px */
@media (max-width: 480px) {
    /* Ultra compact navigation */
    .nav {
        height: 64px;
    }

    .nav-container {
        height: 64px;
        padding: 0 20px;
    }

    .nav-logo {
        font-size: 20px;
    }

    .mobile-menu-toggle {
        width: 40px;
        height: 40px;
    }

    /* Typography scale */
    h1, .hero-title {
        font-size: clamp(28px, 10vw, 40px);
        line-height: 1.15;
        font-weight: 700;
    }

    h2 {
        font-size: clamp(24px, 8vw, 32px);
    }

    h3 {
        font-size: clamp(20px, 6vw, 24px);
    }

    body {
        font-size: 15px;
        line-height: 1.6;
    }

    /* Spacing adjustments */
    .container, .hero-container {
        padding-left: 20px;
        padding-right: 20px;
    }

    .hero {
        padding: 80px 20px 48px;
        min-height: calc(100vh - 64px);
    }

    .section {
        padding: 48px 20px;
    }

    /* Single column for all grids */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .stat-card {
        padding: 16px;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .stat-label {
        font-size: 13px;
    }

    .stat-value {
        font-size: 24px;
    }

    /* Buttons */
    .btn {
        padding: 14px 20px;
        font-size: 15px;
        font-weight: 600;
    }

    .cta-buttons {
        gap: 12px;
    }

    /* Price card optimizations */
    .price-card {
        padding: 24px 20px;
        border-radius: 16px;
    }

    .price-label {
        font-size: 12px;
    }

    .price-amount {
        font-size: 32px;
        margin-bottom: 8px;
    }

    .price-note {
        font-size: 14px;
    }

    /* Features */
    .features-list {
        gap: 8px;
    }

    .feature-item {
        padding: 10px;
        font-size: 13px;
    }

    .feature-icon {
        width: 16px;
        height: 16px;
        font-size: 12px;
    }

    /* Domain cards */
    .domain-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .domain-card {
        padding: 16px;
    }

    .domain-name {
        font-size: 18px;
    }

    .domain-price {
        font-size: 20px;
    }

    /* Contact methods */
    .contact-method {
        padding: 16px;
    }

    /* Modals */
    .modal-content {
        margin: 20px;
        padding: 24px 20px;
        border-radius: 16px;
    }

    .modal h2 {
        font-size: 20px;
        margin-bottom: 16px;
    }

    .modal input,
    .modal textarea {
        padding: 12px;
        font-size: 15px;
    }

    /* Footer */
    .footer {
        padding: 40px 20px 20px;
    }

    .footer-logo {
        font-size: 20px;
        margin-bottom: 16px;
    }

    .footer-links {
        gap: 8px;
    }

    .footer-link {
        padding: 8px;
        font-size: 14px;
    }

    /* Tables for mobile */
    table {
        font-size: 14px;
    }

    th, td {
        padding: 8px 4px;
    }

    /* Forms */
    .form-group {
        margin-bottom: 16px;
    }

    label {
        font-size: 14px;
        margin-bottom: 6px;
    }

    input, select, textarea {
        padding: 12px;
        font-size: 15px;
    }

    /* Trust badges */
    .trust-badges {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }

    .trust-badge {
        padding: 8px 12px;
        font-size: 12px;
    }
}

/* Small Mobile - 360px */
@media (max-width: 360px) {
    .container {
        padding-left: 16px;
        padding-right: 16px;
    }

    h1 {
        font-size: 26px;
    }

    .hero {
        padding: 72px 16px 40px;
    }

    .btn {
        padding: 12px 16px;
        font-size: 14px;
    }

    .price-amount {
        font-size: 28px;
    }

    .price-card {
        padding: 20px 16px;
    }

    .stat-value {
        font-size: 20px;
    }

    .nav-menu {
        width: 100%;
    }
}

/* iPhone X/XS/11 Pro Safe Area */
@supports (padding: max(0px)) {
    .nav, .footer {
        padding-left: max(24px, env(safe-area-inset-left));
        padding-right: max(24px, env(safe-area-inset-right));
    }

    .nav-menu {
        padding-bottom: max(24px, env(safe-area-inset-bottom));
    }
}

/* High Resolution Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .btn, .domain-card, .price-card {
        border-width: 0.5px;
    }
}

/* Landscape Orientation Fixes */
@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding: 60px 24px 40px;
    }

    .modal-content {
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* Print Styles */
@media print {
    .nav, .footer, .mobile-menu-toggle, .cta-buttons {
        display: none !important;
    }

    .hero {
        padding: 20px;
    }

    body {
        font-size: 12pt;
        line-height: 1.5;
    }
}

/* Accessibility - Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .mobile-menu-toggle {
        border-color: rgba(245, 158, 11, 0.3);
    }

    .hamburger span {
        background: #F59E0B;
    }

    .nav-menu {
        background: linear-gradient(180deg, #1A1F3A 0%, #0A0E27 100%);
    }

    .nav-menu a {
        color: #FFFFFF;
    }

    .mobile-close {
        background: rgba(255, 255, 255, 0.1);
        color: #FFFFFF;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .btn:hover {
        transform: none;
    }

    .domain-card:hover {
        transform: none;
        box-shadow: none;
    }

    /* Increase tap targets */
    a, button {
        min-height: 48px;
        display: inline-flex;
        align-items: center;
    }
}

/* Loading States for Mobile */
.mobile-loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 10000;
}

.mobile-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(245, 158, 11, 0.2);
    border-top-color: #F59E0B;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Mobile-Specific Animations */
@media (max-width: 768px) {
    /* Simpler animations for better performance */
    .fade-in {
        animation: mobileFadeIn 0.3s ease-out;
    }

    @keyframes mobileFadeIn {
        from {
            opacity: 0;
            transform: translateY(10px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    /* Disable complex animations on mobile */
    .parallax, .animate-on-scroll {
        animation: none !important;
        transform: none !important;
    }
}

/* Sticky Mobile CTA for Landing Pages */
@media (max-width: 768px) {
    .mobile-sticky-cta {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 16px;
        background: linear-gradient(180deg, transparent 0%, rgba(253, 251, 247, 0.95) 20%, rgba(253, 251, 247, 1) 100%);
        backdrop-filter: blur(20px);
        z-index: 100;
        display: flex;
        gap: 12px;
        border-top: 1px solid rgba(245, 158, 11, 0.1);
        transform: translateY(100%);
        transition: transform 0.3s ease;
    }

    .mobile-sticky-cta.show {
        transform: translateY(0);
    }

    .mobile-sticky-cta .btn {
        flex: 1;
        padding: 14px;
        font-size: 15px;
    }
}