/* AIToolDetect - Responsive Styles */

/* Mobile-First Responsive Design */

/* Extra Large Screens (1400px+) */
@media (min-width: 87.5rem) {
    .container {
        max-width: 1320px;
    }
    
    .hero-title {
        font-size: var(--font-size-6xl, 4rem);
    }
    
    .tool-container {
        grid-template-columns: 1fr 350px;
        gap: var(--space-3xl);
    }
}

/* Large Screens (1200px+) */
@media (min-width: 75rem) {
    .nav-container {
        padding: 0 var(--space-xl);
    }
}

/* Medium Screens (768px - 1199px) */
@media (max-width: 74.938rem) {
    .container {
        max-width: 960px;
        padding: 0 var(--space-md);
    }
    
    .nav-container {
        padding: 0 var(--space-md);
    }
    
    .tool-container {
        grid-template-columns: 1fr 280px;
        gap: var(--space-xl);
    }
    
    .hero-content {
        gap: var(--space-xl);
    }
    
    .hero-title {
        font-size: var(--font-size-4xl);
    }
    
    .ad-banner-header,
    .ad-banner-content {
        overflow-x: auto;
        padding: 0 var(--space-md);
    }
    
    #header-ad {
        min-width: 728px;
    }
}

/* Small Screens (576px - 767px) */
@media (max-width: 47.938rem) {
    .container {
        padding: 0 var(--space-sm);
    }
    
    .nav-container {
        padding: 0 var(--space-sm);
    }
    
    /* Navigation - Mobile Menu */
    .nav-toggle {
        display: flex;
        z-index: 1001;
    }
    
    .nav-menu {
        position: fixed;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100vh;
        background: rgba(15, 15, 35, 0.98);
        backdrop-filter: blur(10px);
        display: flex;
        align-items: center;
        justify-content: center;
        transition: left var(--transition-base);
        z-index: 1000;
    }
    
    .nav-menu.active {
        left: 0;
    }
    
    .nav-list {
        flex-direction: column;
        gap: var(--space-lg);
        text-align: center;
    }
    
    .nav-link {
        font-size: var(--font-size-lg);
        padding: var(--space-md) var(--space-xl);
    }
    
    /* Mobile menu toggle animation */
    .nav-toggle.active .bar:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }
    
    .nav-toggle.active .bar:nth-child(2) {
        opacity: 0;
    }
    
    .nav-toggle.active .bar:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -6px);
    }
    
    /* Hero Section */
    .hero-content {
        grid-template-columns: 1fr;
        gap: var(--space-xl);
        text-align: center;
    }
    
    .hero-title {
        font-size: var(--font-size-3xl);
    }
    
    .hero-subtitle {
        font-size: var(--font-size-base);
    }
    
    .hero-features {
        justify-content: center;
    }
    
    .hero-cta {
        justify-content: center;
    }
    
    /* Tool Layout */
    .tool-container {
        grid-template-columns: 1fr;
        gap: var(--space-xl);
    }
    
    .tool-sidebar {
        order: -1; /* Move sidebar above main content on mobile */
    }
    
    /* Input Section */
    .input-section {
        padding: var(--space-lg);
    }
    
    .input-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-sm);
    }
    
    .text-input {
        min-height: 250px;
        padding: var(--space-md);
    }
    
    .input-actions {
        flex-direction: column;
        gap: var(--space-sm);
    }
    
    .input-actions .btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Results Section */
    .results-section {
        padding: var(--space-lg);
    }
    
    .results-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-md);
    }
    
    .primary-result {
        grid-template-columns: 1fr;
        text-align: center;
        gap: var(--space-md);
    }
    
    .result-icon {
        font-size: 2.5rem;
        padding: var(--space-md);
        margin: 0 auto;
        width: fit-content;
    }
    
    .metrics-grid {
        grid-template-columns: 1fr;
        gap: var(--space-sm);
    }
    
    /* AdSense Responsive */
    .ad-banner-header {
        display: none; /* Hide header banner on mobile */
    }
    
    #content-ad-1 {
        width: 300px;
        height: 250px;
    }
    
    #sidebar-ad-1 {
        width: 300px;
        height: 250px; /* Reduce height on mobile */
    }
    
    .ad-banner-sidebar {
        margin: var(--space-md) 0;
    }
    
    /* Footer */
    .footer-content {
        grid-template-columns: 1fr;
        gap: var(--space-xl);
        text-align: center;
    }
    
    .footer-bottom {
        flex-direction: column;
        gap: var(--space-md);
        text-align: center;
    }
    
    /* Section Spacing */
    .section {
        padding: var(--space-xl) 0;
    }
    
    .section-header {
        margin-bottom: var(--space-xl);
    }
    
    .section-title {
        font-size: var(--font-size-2xl);
        flex-direction: column;
        gap: var(--space-sm);
    }
    
    /* Button Adjustments */
    .hero-cta .btn {
        min-width: 140px;
    }
}

/* Extra Small Screens (320px - 575px) */
@media (max-width: 35.938rem) {
    :root {
        --space-xs: 0.25rem;
        --space-sm: 0.5rem;
        --space-md: 0.75rem;
        --space-lg: 1rem;
        --space-xl: 1.5rem;
        --space-2xl: 2rem;
        --space-3xl: 2.5rem;
    }
    
    .container {
        padding: 0 var(--space-md);
    }
    
    .hero-title {
        font-size: var(--font-size-2xl);
        line-height: 1.2;
    }
    
    .hero-features {
        flex-direction: column;
        gap: var(--space-sm);
        align-items: center;
    }
    
    .hero-cta {
        flex-direction: column;
        gap: var(--space-sm);
    }
    
    .hero-cta .btn {
        width: 100%;
        min-width: unset;
    }
    
    .input-section,
    .results-section {
        padding: var(--space-md);
    }
    
    .text-input {
        min-height: 200px;
        padding: var(--space-sm);
    }
    
    .demo-screen {
        padding: var(--space-md);
    }
    
    .analysis-metrics {
        grid-template-columns: 1fr;
        gap: var(--space-sm);
    }
    
    /* Compact info cards */
    .info-card {
        padding: var(--space-md);
    }
    
    .info-list {
        gap: var(--space-xs);
    }
    
    /* Smaller ad units for very small screens */
    #content-ad-1,
    #sidebar-ad-1 {
        width: 250px;
        height: 200px;
    }
    
    /* Mobile optimizations for new components */
    .about-content {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
    }
    
    .about-stats {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: var(--space-md);
    }
    
    .contact-content {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
    }
    
    .contact-info {
        order: -1;
    }
    
    .blog-grid {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
    }
    
    .placeholder-buttons {
        flex-direction: column;
        gap: var(--space-sm);
    }
    
    .placeholder-buttons .btn {
        width: 100%;
    }
    
    .notification {
        width: calc(100vw - 2rem);
        right: -100vw;
    }
    
    .notification.show {
        right: var(--space-md);
    }
}

/* Landscape Mobile Devices */
@media (max-width: 47.938rem) and (orientation: landscape) {
    .hero-section {
        padding: var(--space-lg) 0;
    }
    
    .nav-menu {
        height: 100vh;
    }
    
    .text-input {
        min-height: 150px;
    }
}

/* Tablet Portrait Specific (768px - 991px) */
@media (min-width: 48rem) and (max-width: 61.938rem) {
    .tool-container {
        grid-template-columns: 1fr;
        gap: var(--space-xl);
    }
    
    .tool-sidebar {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: var(--space-lg);
    }
    
    .ad-banner-sidebar {
        grid-column: 1 / -1;
        justify-self: center;
    }
    
    .hero-content {
        grid-template-columns: 1fr;
        text-align: center;
        gap: var(--space-xl);
    }
    
    .footer-content {
        grid-template-columns: 1fr 1fr;
        gap: var(--space-xl);
    }
    
    /* Tablet optimizations for new components */
    .about-content {
        grid-template-columns: 1fr;
        gap: var(--space-xl);
        text-align: center;
    }
    
    .about-stats {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: var(--space-md);
    }
    
    .contact-content {
        grid-template-columns: 1fr;
        gap: var(--space-xl);
    }
    
    .blog-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-lg);
    }
}

/* Print Styles */
@media print {
    .header,
    .footer,
    .nav-toggle,
    .ad-banner-header,
    .ad-banner-content,
    .ad-banner-sidebar,
    .ad-placeholder {
        display: none !important;
    }
    
    .main-content {
        margin-top: 0;
    }
    
    .section {
        display: block !important;
        page-break-inside: avoid;
    }
    
    .tool-container {
        grid-template-columns: 1fr;
    }
    
    .results-section {
        border: 1px solid #333;
        background: #f5f5f5;
        color: #333;
    }
    
    .btn {
        display: none;
    }
}

/* Reduced Motion Preferences */
@media (prefers-reduced-motion: reduce) {
    .nav-menu {
        transition: none;
    }
    
    .nav-toggle .bar {
        transition: none;
    }
    
    .status-active {
        animation: none;
    }
    
    .meter-fill,
    .meter-progress {
        transition: none;
    }
    
    .fade-in {
        animation: none;
    }
}

/* High DPI Screens */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .brand-icon,
    .result-icon {
        transform: translateZ(0); /* Enable hardware acceleration */
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .btn,
    .nav-link {
        min-height: 44px; /* Minimum touch target size */
        min-width: 44px;
    }
    
    .nav-link {
        padding: var(--space-md) var(--space-lg);
    }
    
    .text-input {
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

/* Dark Mode System Preference Override */
@media (prefers-color-scheme: light) {
    /* Keep dark theme regardless of system preference */
    /* This ensures consistent branding */
}

/* Container Queries (for modern browsers) */
@container (max-width: 500px) {
    .tool-sidebar {
        display: flex;
        flex-direction: column;
    }
}

/* Focus Management for Mobile */
@media (max-width: 47.938rem) {
    .nav-menu.active {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Prevent background scroll when mobile menu is open */
    body.menu-open {
        overflow: hidden;
        position: fixed;
        width: 100%;
    }
}

/* iOS Safari Specific Fixes */
@supports (-webkit-touch-callout: none) {
    .text-input {
        -webkit-appearance: none;
        border-radius: var(--radius-md);
    }
    
    .btn {
        -webkit-appearance: none;
    }
}

/* Firefox Specific Adjustments */
@-moz-document url-prefix() {
    .text-input {
        scrollbar-width: thin;
        scrollbar-color: var(--dark-border) var(--dark-surface);
    }
}

/* Edge/Webkit Scrollbar Styling */
.text-input::-webkit-scrollbar {
    width: 8px;
}

.text-input::-webkit-scrollbar-track {
    background: var(--dark-surface);
}

.text-input::-webkit-scrollbar-thumb {
    background: var(--dark-border);
    border-radius: 4px;
}

.text-input::-webkit-scrollbar-thumb:hover {
    background: var(--primary-purple);
}

/* Animation Performance Optimization */
@media (max-width: 47.938rem) {
    * {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
    
    .nav-menu {
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }
}