/* ========================================
   COMPREHENSIVE RESPONSIVE STYLES
   Ultimate WP Audit SaaS - Mobile First
   ======================================== */

/* ========================================
   CRITICAL MOBILE OVERRIDES
   These use !important to override landing.css
   ======================================== */

@media (max-width: 768px) {

    /* Hero Section Mobile Fix */
    .hero {
        padding-top: 120px !important;
        padding-bottom: 40px !important;
    }

    .hero-title {
        font-size: 32px !important;
        line-height: 1.2 !important;
        margin-bottom: 16px !important;
    }

    .hero-subtitle {
        font-size: 16px !important;
        max-width: 100% !important;
        padding: 0 16px !important;
    }

    .hero-actions {
        flex-direction: column !important;
        gap: 12px !important;
        width: 100% !important;
        padding: 0 16px !important;
    }

    .hero-actions .btn {
        width: 100% !important;
        padding: 14px 24px !important;
        font-size: 15px !important;
    }

    .hero-stats-pill {
        flex-direction: column !important;
        gap: 16px !important;
        padding: 16px 24px !important;
        width: calc(100% - 32px) !important;
        margin: 0 16px !important;
    }

    .stat-divider {
        display: none !important;
    }

    .stat-item {
        align-items: center !important;
    }

    /* Navigation Mobile */
    .landing-nav {
        width: calc(100% - 32px) !important;
        max-width: calc(100vw - 32px) !important;
        padding: 10px 16px !important;
        top: 10px !important;
        left: 16px !important;
        transform: none !important;
        z-index: 10001 !important;
    }

    .nav-container {
        max-width: 100% !important;
    }

    .nav-brand {
        max-width: 50% !important;
        overflow: hidden !important;
    }

    .nav-brand img,
    .nav-logo {
        max-height: 40px !important;
        width: auto !important;
    }

    /* Hide desktop nav links */
    .nav-links {
        position: fixed !important;
        top: 0 !important;
        right: -100% !important;
        width: 280px !important;
        height: 100vh !important;
        background: white !important;
        padding: 80px 24px 24px !important;
        box-shadow: -2px 0 20px rgba(0, 0, 0, 0.1) !important;
        transition: right 0.3s ease !important;
        z-index: 9998 !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
        overflow-y: auto !important;
    }

    .nav-links.active {
        right: 0 !important;
    }

    .nav-links li {
        list-style: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .nav-links .nav-link {
        display: block !important;
        padding: 12px 16px !important;
        font-size: 16px !important;
        color: var(--lp-text) !important;
        text-decoration: none !important;
        border-radius: 8px !important;
        transition: all 0.2s !important;
    }

    .nav-links .nav-link:hover {
        background: var(--lp-light) !important;
        color: var(--lp-primary) !important;
    }

    /* Mobile menu toggle button (hamburger) */
    .nav-mobile-toggle {
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        gap: 4px !important;
        width: 40px !important;
        height: 40px !important;
        background: transparent !important;
        border: none !important;
        cursor: pointer !important;
        padding: 8px !important;
        z-index: 9999 !important;
        position: relative !important;
    }

    .nav-mobile-toggle span {
        display: block !important;
        width: 24px !important;
        height: 2px !important;
        background: var(--lp-dark) !important;
        transition: all 0.3s ease !important;
        border-radius: 2px !important;
    }

    .nav-mobile-toggle.active span:nth-child(1) {
        transform: translateY(6px) rotate(45deg) !important;
    }

    .nav-mobile-toggle.active span:nth-child(2) {
        opacity: 0 !important;
    }

    .nav-mobile-toggle.active span:nth-child(3) {
        transform: translateY(-6px) rotate(-45deg) !important;
    }

    /* Mobile menu overlay */
    .mobile-menu-overlay {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100vh !important;
        background: rgba(0, 0, 0, 0.5) !important;
        opacity: 0 !important;
        visibility: hidden !important;
        transition: all 0.3s ease !important;
        z-index: 9997 !important;
    }

    .mobile-menu-overlay.active {
        opacity: 1 !important;
        visibility: visible !important;
    }

    /* Hide desktop nav actions on mobile if needed - Actually keep them visible */
    .nav-actions {
        display: flex !important;
        gap: 6px !important;
    }

    .nav-actions .btn {
        padding: 8px 12px !important;
        font-size: 13px !important;
        white-space: nowrap !important;
    }

    /* Add nav actions to mobile menu */
    .nav-links::after {
        content: '' !important;
        display: block !important;
        margin-top: 24px !important;
        padding-top: 24px !important;
        border-top: 1px solid rgba(0, 0, 0, 0.1) !important;
    }

    /* Bento Grid Mobile */
    .bento-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
        padding: 0 16px !important;
    }

    .bento-card {
        min-height: 180px !important;
        padding: 24px !important;
    }

    .span-2,
    .span-1 {
        grid-column: span 1 !important;
    }

    .bento-title {
        font-size: 18px !important;
    }

    .bento-desc {
        font-size: 14px !important;
    }

    /* Section Headers Mobile */
    .section-header {
        padding: 0 16px !important;
        margin-bottom: 40px !important;
    }

    .section-title {
        font-size: 28px !important;
        line-height: 1.2 !important;
    }

    .section-desc {
        font-size: 16px !important;
        max-width: 100% !important;
    }

    /* Steps Mobile */
    .steps-row {
        flex-direction: column !important;
        gap: 20px !important;
        padding: 0 16px !important;
    }

    .step-arrow {
        display: none !important;
    }

    .step-card {
        width: 100% !important;
    }

    /* Features Section */
    .features {
        padding: 60px 0 !important;
    }

    /* How It Works */
    .how-it-works {
        padding: 60px 0 !important;
    }

    /* Pricing Preview */
    .pricing-preview {
        padding: 60px 0 !important;
    }

    .pricing-cards-full {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
        padding: 0 16px !important;
    }

    .pricing-card-full {
        padding: 24px !important;
    }

    .plan-name {
        font-size: 20px !important;
    }

    .plan-price {
        font-size: 32px !important;
    }

    /* Benefits Section */
    .uas-benefits-section {
        padding: 60px 0 !important;
    }

    .uas-benefits-grid {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
        padding: 0 16px !important;
    }

    .uas-benefit-item {
        flex-direction: column !important;
        text-align: center !important;
    }

    .uas-action-cta-box {
        flex-direction: column !important;
        padding: 32px 24px !important;
        margin: 0 16px !important;
    }

    .uas-cta-visual {
        margin-top: 24px !important;
    }

    /* Testimonials */
    .testimonials {
        padding: 60px 0 !important;
    }

    .testimonial-slider {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
        padding: 0 16px !important;
    }

    /* FAQ */
    .faq {
        padding: 60px 0 !important;
    }

    .faq-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
        padding: 0 16px !important;
    }

    /* CTA Banner */
    .cta-banner {
        padding: 60px 16px !important;
    }

    .cta-box,
    .uas-action-cta-box,
    .cta-banner .cta-box,
    .final-cta-box {
        padding: 40px 24px !important;
        margin: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .cta-head {
        font-size: 28px !important;
        line-height: 1.2 !important;
    }

    .cta-sub {
        font-size: 16px !important;
        line-height: 1.5 !important;
    }

    .cta-btn,
    .cta-box .btn {
        width: 100% !important;
        max-width: 300px !important;
        margin: 0 auto !important;
    }
}

/* ========== Mobile First Base Styles ========== */
/* These apply to all screen sizes unless overridden */


* {
    -webkit-tap-highlight-color: transparent;
}

/* CRITICAL: Prevent horizontal overflow */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    overflow-x: hidden;
    max-width: 100%;
}

body {
    overflow-x: hidden;
    min-width: 320px;
    max-width: 100vw;
    position: relative;
}

/* Fix any element that might cause overflow */
section,
div,
header,
footer,
nav {
    max-width: 100%;
}

.container {
    max-width: 100%;
}

img,
video,
iframe {
    max-width: 100%;
    height: auto;
}

/* ========== Container Responsive ========== */
.container {
    width: 100%;
    padding-left: 16px;
    padding-right: 16px;
}

@media (min-width: 640px) {
    .container {
        padding-left: 20px;
        padding-right: 20px;
    }
}

@media (min-width: 1024px) {
    .container {
        padding-left: 24px;
        padding-right: 24px;
    }
}

/* ========== Typography Responsive ========== */
h1 {
    font-size: clamp(1.75rem, 5vw, 2.75rem);
}

h2 {
    font-size: clamp(1.5rem, 4vw, 2.25rem);
}

h3 {
    font-size: clamp(1.25rem, 3vw, 1.75rem);
}

h4 {
    font-size: clamp(1.125rem, 2.5vw, 1.5rem);
}

h5 {
    font-size: clamp(1rem, 2vw, 1.25rem);
}

.text-lead {
    font-size: clamp(1rem, 2vw, 1.25rem);
}

/* ========== Button Responsive ========== */
@media (max-width: 640px) {
    .btn {
        padding: 10px 18px;
        font-size: 14px;
    }

    .btn-lg {
        padding: 14px 24px;
        font-size: 15px;
    }

    .btn-sm {
        padding: 6px 12px;
        font-size: 12px;
    }

    /* Stack buttons on mobile */
    .btn-group {
        flex-direction: column;
        gap: 10px;
    }

    .btn-group .btn {
        width: 100%;
    }
}

/* ========== Form Responsive ========== */
@media (max-width: 640px) {

    .form-input,
    .form-select,
    .form-textarea {
        padding: 10px 14px;
        font-size: 16px;
        /* Prevents zoom on iOS */
    }

    .form-label {
        font-size: 13px;
    }

    .form-group {
        margin-bottom: 20px;
    }
}

/* ========== Card Responsive ========== */
@media (max-width: 768px) {

    .card-header,
    .card-body,
    .card-footer {
        padding: 20px;
    }
}

@media (max-width: 640px) {

    .card-header,
    .card-body,
    .card-footer {
        padding: 16px;
    }
}

/* ========== Table Responsive ========== */
@media (max-width: 768px) {

    .table th,
    .table td {
        padding: 12px 16px;
        font-size: 14px;
    }

    .table th {
        font-size: 12px;
    }
}

@media (max-width: 640px) {

    .table th,
    .table td {
        padding: 10px 12px;
        font-size: 13px;
    }

    /* Hide less important columns on mobile */
    .table .hide-mobile {
        display: none;
    }
}

/* ========== Modal Responsive ========== */
@media (max-width: 640px) {
    .modal {
        max-width: 100%;
        margin: 0;
        border-radius: var(--uas-radius-lg) var(--uas-radius-lg) 0 0;
        max-height: 95vh;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 20px;
    }

    .modal-title {
        font-size: 1.125rem;
    }
}

/* ========== Grid Responsive ========== */
.grid {
    display: grid;
    gap: 24px;
}

.grid-cols-1 {
    grid-template-columns: repeat(1, 1fr);
}

.grid-cols-2 {
    grid-template-columns: repeat(1, 1fr);
}

.grid-cols-3 {
    grid-template-columns: repeat(1, 1fr);
}

.grid-cols-4 {
    grid-template-columns: repeat(1, 1fr);
}

@media (min-width: 640px) {
    .grid-cols-2 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) {
    .grid-cols-3 {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid-cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .grid-cols-3 {
        grid-template-columns: repeat(3, 1fr);
    }

    .grid-cols-4 {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ========== Flex Responsive ========== */
@media (max-width: 768px) {
    .flex-between {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .flex-between.keep-row {
        flex-direction: row;
    }
}

/* ========== Spacing Responsive ========== */
@media (max-width: 640px) {
    .mb-6 {
        margin-bottom: 2rem;
    }

    .mt-6 {
        margin-top: 2rem;
    }

    .gap-4 {
        gap: 1.5rem;
    }

    .gap-3 {
        gap: 1rem;
    }
}

/* ========== Utility Classes ========== */
/* Hide on mobile */
@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }
}

/* Hide on tablet */
@media (min-width: 769px) and (max-width: 1024px) {
    .hide-tablet {
        display: none !important;
    }
}

/* Hide on desktop */
@media (min-width: 1025px) {
    .hide-desktop {
        display: none !important;
    }
}

/* Show only on mobile */
.show-mobile {
    display: none !important;
}

@media (max-width: 768px) {
    .show-mobile {
        display: block !important;
    }

    .show-mobile-flex {
        display: flex !important;
    }
}

/* ========== Text Alignment Responsive ========== */
@media (max-width: 640px) {
    .text-center-mobile {
        text-align: center;
    }

    .text-left-mobile {
        text-align: left;
    }
}

/* ========== Dashboard Specific Responsive ========== */
@media (max-width: 992px) {
    .dashboard-wrapper {
        flex-direction: column;
    }

    .dashboard-sidebar {
        width: 100%;
        position: relative;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--uas-border);
    }

    .dashboard-main {
        margin-left: 0;
        width: 100%;
    }
}

@media (max-width: 768px) {
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .header-actions {
        width: 100%;
        flex-direction: column;
        gap: 10px;
    }

    .header-actions .btn {
        width: 100%;
    }

    .page-title {
        font-size: 1.5rem;
    }
}

/* ========== Admin Panel Responsive ========== */
@media (max-width: 992px) {
    .admin-wrapper {
        flex-direction: column;
    }

    .admin-sidebar {
        width: 100%;
        position: relative;
        height: auto;
    }

    .admin-main {
        margin-left: 0;
        width: 100%;
    }
}

/* ========== Landing Page Responsive ========== */
@media (max-width: 768px) {
    .hero-section {
        padding: 60px 0 40px;
    }

    .hero-title {
        font-size: 2rem;
        line-height: 1.2;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .feature-grid {
        grid-template-columns: 1fr;
    }

    .pricing-grid {
        grid-template-columns: 1fr;
    }
}

/* ========== Auth Pages Responsive ========== */
@media (max-width: 992px) {
    .auth-container {
        flex-direction: column;
    }

    .auth-sidebar {
        display: none;
        /* Hide sidebar on mobile for cleaner look */
    }

    .auth-main {
        width: 100%;
        max-width: 100%;
    }
}

@media (max-width: 640px) {
    .auth-form-container {
        padding: 24px;
    }

    .auth-form-title {
        font-size: 1.5rem;
    }
}

/* ========== Navigation Responsive ========== */
@media (max-width: 992px) {
    .navbar {
        padding: 12px 0;
    }

    .nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background: var(--uas-white);
        box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
        padding: 80px 24px 24px;
        transition: right 0.3s ease;
        z-index: 1000;
        flex-direction: column;
        align-items: flex-start;
    }

    .nav-menu.active {
        right: 0;
    }

    .nav-menu-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }

    .nav-menu-overlay.active {
        display: block;
    }

    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        border: none;
        background: transparent;
        cursor: pointer;
        z-index: 1001;
    }

    .mobile-menu-toggle span {
        width: 24px;
        height: 2px;
        background: var(--uas-secondary);
        display: block;
        position: relative;
        transition: all 0.3s ease;
    }

    .mobile-menu-toggle span::before,
    .mobile-menu-toggle span::after {
        content: '';
        position: absolute;
        width: 100%;
        height: 2px;
        background: var(--uas-secondary);
        transition: all 0.3s ease;
    }

    .mobile-menu-toggle span::before {
        top: -8px;
    }

    .mobile-menu-toggle span::after {
        bottom: -8px;
    }

    .mobile-menu-toggle.active span {
        background: transparent;
    }

    .mobile-menu-toggle.active span::before {
        top: 0;
        transform: rotate(45deg);
    }

    .mobile-menu-toggle.active span::after {
        bottom: 0;
        transform: rotate(-45deg);
    }
}

/* ========== Tabs Responsive ========== */
@media (max-width: 768px) {
    .nav-tabs {
        overflow-x: auto;
        overflow-y: hidden;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .nav-tabs::-webkit-scrollbar {
        display: none;
    }

    .nav-tab {
        flex-shrink: 0;
        white-space: nowrap;
        font-size: 14px;
        padding: 10px 16px;
    }
}

/* ========== Stats Cards Responsive ========== */
@media (max-width: 640px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-value {
        font-size: 1.75rem;
    }

    .stat-label {
        font-size: 13px;
    }
}

/* ========== Chart Responsive ========== */
@media (max-width: 768px) {
    .chart-container {
        height: 250px !important;
    }
}

@media (max-width: 640px) {
    .chart-container {
        height: 200px !important;
    }
}

/* ========== Footer Responsive ========== */
@media (max-width: 768px) {
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .footer-column {
        text-align: center;
    }

    .footer-links {
        align-items: center;
    }
}

/* ========== Overflow Handling ========== */
.overflow-x-auto {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.overflow-x-auto::-webkit-scrollbar {
    height: 8px;
}

.overflow-x-auto::-webkit-scrollbar-track {
    background: var(--uas-bg);
    border-radius: 4px;
}

.overflow-x-auto::-webkit-scrollbar-thumb {
    background: var(--uas-border-dark);
    border-radius: 4px;
}

.overflow-x-auto::-webkit-scrollbar-thumb:hover {
    background: var(--uas-text-lighter);
}

/* ========== Touch Optimization ========== */
@media (hover: none) and (pointer: coarse) {

    /* Increase touch targets */
    .btn,
    .nav-item,
    .nav-tab,
    a {
        min-height: 44px;
        min-width: 44px;
    }

    /* Remove hover effects on touch devices */
    .card:hover {
        box-shadow: var(--uas-shadow);
        border-color: var(--uas-border);
    }

    .btn:hover {
        transform: none;
    }
}

/* ========== Print Styles ========== */
@media print {

    .no-print,
    .dashboard-sidebar,
    .admin-sidebar,
    .navbar,
    .footer,
    .btn,
    .header-actions {
        display: none !important;
    }

    .dashboard-main,
    .admin-main {
        margin-left: 0;
        width: 100%;
    }

    .card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }

    body {
        background: white;
    }
}

/* ========== Accessibility Improvements ========== */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    :root {
        --uas-border: #000;
        --uas-border-dark: #000;
    }

    .btn {
        border: 2px solid currentColor;
    }
}

/* ========== Desktop: Hide Mobile Elements ========== */
@media (min-width: 769px) {
    .nav-mobile-toggle {
        display: none !important;
    }

    .mobile-menu-overlay {
        display: none !important;
    }

    .nav-links {
        position: static !important;
        width: auto !important;
        height: auto !important;
        flex-direction: row !important;
        padding: 0 !important;
        box-shadow: none !important;
        background: transparent !important;
    }
}

/* ========== Landscape Mobile Optimization ========== */
@media (max-height: 500px) and (orientation: landscape) {
    .modal {
        max-height: 100vh;
    }

    .dashboard-header,
    .admin-header {
        padding: 12px 0;
    }
}

/* ========== Very Small Devices (< 375px) ========== */
@media (max-width: 374px) {
    html {
        font-size: 14px;
    }

    .container {
        padding-left: 12px;
        padding-right: 12px;
    }

    .btn {
        padding: 8px 14px;
        font-size: 13px;
    }

    .card-header,
    .card-body,
    .card-footer {
        padding: 12px;
    }
}

/* ========== Large Screens Optimization ========== */
@media (min-width: 1920px) {
    .container {
        max-width: 1536px;
    }
}