/*--------------------------------------------------------------
>>> RESPONSIVE DESIGN
----------------------------------------------------------------
Mobile First Approach
Breakpoints:
- Mobile: < 768px (default)
- Tablet: 768px - 1024px
- Desktop: > 1024px
--------------------------------------------------------------*/

/*--------------------------------------------------------------
Tablet (768px and up)
--------------------------------------------------------------*/
@media (max-width: 1024px) {
    .two-column-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        position: static;
        margin-bottom: var(--spacing-xl);
        order: 2;
        /* Sidebar appears after main content */
    }

    .software-main-content {
        order: 1;
        /* Main content appears first */
    }

    .content-area {
        order: 1;
        /* Archive main content appears first */
    }

    .software-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

/*--------------------------------------------------------------
Mobile (767px and down)
--------------------------------------------------------------*/
@media (max-width: 767px) {

    /* Header */
    .header-inner {
        flex-wrap: wrap;
    }

    .site-logo {
        order: 1;
    }

    .mobile-menu-toggle {
        display: block;
        order: 2;
        margin-left: auto;
    }

    .header-search {
        order: 3;
        width: 100%;
        max-width: none;
        margin-top: var(--spacing-md);
    }

    /* Platform Navigation - Mobile Menu */
    .header-bottom {
        order: 4;
        width: 100%;
    }

    .platform-navigation {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }

    .platform-navigation.is-active {
        max-height: 500px;
    }

    body.menu-open .header-bottom {
        display: block !important;
    }

    .platform-menu {
        flex-direction: column;
        width: 100%;
        padding: var(--spacing-md) 0;
    }

    .platform-menu a {
        display: block;
        width: 100%;
        padding: var(--spacing-sm) var(--spacing-md);
    }

    /* Legacy support for .main-navigation */
    .main-navigation {
        order: 4;
        width: 100%;
        flex-direction: column;
        max-height: 0;
        overflow: hidden;
        transition: max-height var(--transition-base);
    }

    .main-navigation.is-active {
        max-height: 500px;
        margin-top: var(--spacing-md);
    }

    .nav-menu {
        flex-direction: column;
        width: 100%;
    }

    .nav-menu a {
        display: block;
        width: 100%;
    }

    /* Software Grid */
    .software-grid {
        grid-template-columns: 1fr;
    }

    /* Archive Controls */
    .archive-controls {
        flex-direction: column;
        gap: var(--spacing-md);
    }

    .results-count,
    .sorting-dropdown {
        width: 100%;
    }

    /* Footer */
    .footer-widgets {
        grid-template-columns: 1fr;
    }

    .footer-bottom {
        flex-direction: column;
        gap: var(--spacing-md);
        text-align: center;
    }

    /* Software Header */
    .software-header-content {
        flex-direction: column;
        text-align: center;
    }

    .software-icon {
        margin: 0 auto var(--spacing-lg);
    }

    /* Tabs */
    .tabs-nav {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tabs-content {
        padding: var(--spacing-lg);
    }

    /* Version History Table */
    .version-history-table {
        font-size: var(--font-size-sm);
    }

    .version-history-table th,
    .version-history-table td {
        padding: var(--spacing-sm);
    }

    /* Modals */
    .modal-content,
    .modal-dialog {
        margin: 0;
        max-height: 100vh;
        border-radius: 0;
        padding: var(--spacing-lg);
    }

    .categories-grid {
        grid-template-columns: 1fr;
    }

    /* Hero Section */
    .hero-section h1 {
        font-size: var(--font-size-3xl);
    }


    /* Platform Section */
    .section-header h2 {
        font-size: var(--font-size-xl);
    }

    /* Newsletter Form */
    .newsletter-form {
        flex-direction: column;
    }

    /* Back to Top */
    .back-to-top {
        bottom: var(--spacing-md);
        right: var(--spacing-md);
        width: 45px;
        height: 45px;
    }
}

/*--------------------------------------------------------------
Small Mobile (480px and down)
--------------------------------------------------------------*/
@media (max-width: 480px) {
    :root {
        --font-size-4xl: 1.875rem;
        --font-size-3xl: 1.5rem;
        --font-size-2xl: 1.25rem;
    }

    .container {
        padding: 0 var(--spacing-md);
    }

    .site-header {
        height: auto;
        padding: var(--spacing-md) 0;
    }

    .software-card .card-title {
        font-size: var(--font-size-base);
    }

    .btn {
        padding: var(--spacing-sm) var(--spacing-md);
        font-size: var(--font-size-sm);
    }

    .btn-lg {
        padding: var(--spacing-md) var(--spacing-lg);
        font-size: var(--font-size-base);
    }
}

/*--------------------------------------------------------------
Landscape Orientation
--------------------------------------------------------------*/
@media (max-height: 600px) and (orientation: landscape) {

    .modal-content,
    .modal-dialog {
        max-height: 95vh;
        margin: 2.5vh auto;
    }
}

/*--------------------------------------------------------------
Print Styles
--------------------------------------------------------------*/
@media print {

    .site-header,
    .site-footer,
    .filter-sidebar,
    .back-to-top,
    .categories-modal,
    .private-content-modal {
        display: none !important;
    }

    .software-card {
        break-inside: avoid;
    }

    body {
        background: white;
    }
}