/* ===== RESPONSIVE DESIGN SYSTEM ===== */

/* Extra Small Devices (phones, less than 576px) */
@media (max-width: 575.98px) {
    :root {
        --spacing-xs: 0.2rem;
        --spacing-sm: 0.4rem;
        --spacing-md: 0.8rem;
        --spacing-lg: 1.2rem;
        --spacing-xl: 1.6rem;
        --spacing-2xl: 2.4rem;
        --spacing-3xl: 3.2rem;
    }

    html {
        font-size: 14px;
    }

    .container {
        padding: 0 var(--spacing-md);
    }

    /* Navigation */
    .nav-container {
        padding: var(--spacing-sm) var(--spacing-md);
    }

    .nav-brand {
        font-size: 1.1rem;
    }

    .nav-brand .cyber-icon {
        font-size: 1.3rem;
    }

    .nav-menu {
        width: 280px;
        top: 60px;
        padding: var(--spacing-lg);
    }

    .nav-link {
        padding: var(--spacing-md);
        font-size: 0.9rem;
    }

    /* Hero Section */
    .hero-section {
        padding-top: 60px;
        min-height: 90vh;
    }

    .hero-content {
        padding: 0 var(--spacing-md);
        gap: var(--spacing-xl);
    }

    .hero-title {
        font-size: 2rem;
        line-height: 1.2;
        margin-bottom: var(--spacing-lg);
    }

    .hero-subtitle {
        font-size: 1rem;
        line-height: 1.6;
        margin-bottom: var(--spacing-xl);
    }

    .hero-stats {
        flex-direction: column;
        gap: var(--spacing-md);
        margin-bottom: var(--spacing-xl);
    }

    .stat-item {
        padding: var(--spacing-md);
    }

    .stat-number {
        font-size: 1.8rem;
    }

    .stat-label {
        font-size: 0.8rem;
    }

    .hero-buttons {
        flex-direction: column;
        width: 100%;
        gap: var(--spacing-md);
    }

    .cta-button {
        width: 100%;
        justify-content: center;
        padding: var(--spacing-md) var(--spacing-lg);
        font-size: 1rem;
    }

    /* Cyber Terminal */
    .cyber-terminal {
        max-width: 100%;
    }

    .terminal-body {
        padding: var(--spacing-md);
        font-size: 0.8rem;
    }

    .terminal-line {
        flex-wrap: wrap;
        margin-bottom: var(--spacing-xs);
    }

    /* Search */
    .search-container {
        padding: 0 var(--spacing-md);
    }

    .search-box input {
        padding: var(--spacing-md) var(--spacing-lg) var(--spacing-md) 50px;
        font-size: 1rem;
    }

    .search-filters {
        flex-direction: column;
        gap: var(--spacing-sm);
    }

    .filter-select {
        width: 100%;
        padding: var(--spacing-md);
        font-size: 0.9rem;
    }

    /* Typography */
    h1 { font-size: 1.8rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.3rem; }
    h4 { font-size: 1.1rem; }
    h5 { font-size: 1rem; }
    h6 { font-size: 0.9rem; }

    .section-title {
        flex-direction: column;
        gap: var(--spacing-sm);
        font-size: 1.5rem;
    }

    .section-subtitle {
        font-size: 1rem;
    }

    /* Sections */
    .quick-search,
    .categories-section,
    .tools-section,
    .guide-section,
    .resources-section {
        padding: var(--spacing-xl) 0;
    }
}

/* Small Devices (landscape phones, 576px and up) */
@media (min-width: 576px) and (max-width: 767.98px) {
    .hero-content {
        gap: var(--spacing-2xl);
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .hero-stats {
        flex-wrap: wrap;
        justify-content: center;
    }

    .stat-item {
        flex: 1;
        min-width: 140px;
    }

    .search-filters {
        gap: var(--spacing-md);
    }

    .filter-select {
        flex: 1;
        min-width: 150px;
    }
}

/* Medium Devices (tablets, 768px and up) */
@media (min-width: 768px) and (max-width: 991.98px) {
    .nav-menu {
        position: static;
        width: auto;
        height: auto;
        background: transparent;
        flex-direction: row;
        padding: 0;
        border: none;
    }

    .nav-toggle {
        display: none;
    }

    .hero-content {
        grid-template-columns: 1fr;
        text-align: center;
        gap: var(--spacing-2xl);
    }

    .hero-visual {
        order: -1;
    }

    .hero-stats {
        justify-content: center;
        gap: var(--spacing-xl);
    }

    .hero-buttons {
        flex-direction: row;
        justify-content: center;
    }

    .search-filters {
        justify-content: center;
        gap: var(--spacing-md);
    }

    .filter-select {
        min-width: 180px;
    }
}

/* Large Devices (desktops, 992px and up) */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .container {
        max-width: 960px;
    }

    .hero-content {
        grid-template-columns: 1fr 1fr;
        gap: var(--spacing-3xl);
    }

    .hero-title {
        font-size: 3.5rem;
    }
}

/* Extra Large Devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
    }

    .hero-title {
        font-size: 4rem;
    }
}

/* Ultra Wide Screens (1400px and up) */
@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }

    .hero-content {
        gap: var(--spacing-3xl);
    }
}

/* ===== COMPONENT-SPECIFIC RESPONSIVE STYLES ===== */

/* Categories Grid */
.categories-grid {
    display: grid;
    gap: var(--spacing-xl);
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

@media (max-width: 575.98px) {
    .categories-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }
}

@media (min-width: 576px) and (max-width: 767.98px) {
    .categories-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
}

/* Tools Grid */
.tools-grid {
    display: grid;
    gap: var(--spacing-xl);
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

@media (max-width: 575.98px) {
    .tools-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }
}

@media (min-width: 576px) and (max-width: 767.98px) {
    .tools-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
}

/* Learning Path */
.learning-path {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xl);
}

@media (min-width: 768px) {
    .learning-path {
        flex-direction: row;
    }

    .path-level {
        flex: 1;
    }
}

@media (max-width: 767.98px) {
    .learning-path {
        gap: var(--spacing-lg);
    }

    .path-level {
        margin-bottom: var(--spacing-md);
    }
}

/* Resources Grid */
.resources-grid {
    display: grid;
    gap: var(--spacing-xl);
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

@media (max-width: 575.98px) {
    .resources-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }
}

@media (min-width: 992px) {
    .resources-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Footer */
.footer-content {
    display: grid;
    gap: var(--spacing-xl);
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

@media (max-width: 767.98px) {
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
        gap: var(--spacing-lg);
    }

    .footer-bottom {
        flex-direction: column;
        gap: var(--spacing-md);
        text-align: center;
    }
}

/* ===== UTILITY RESPONSIVE CLASSES ===== */

/* Display utilities */
.d-none { display: none !important; }
.d-block { display: block !important; }
.d-inline { display: inline !important; }
.d-inline-block { display: inline-block !important; }
.d-flex { display: flex !important; }
.d-grid { display: grid !important; }

@media (max-width: 575.98px) {
    .d-xs-none { display: none !important; }
    .d-xs-block { display: block !important; }
    .d-xs-flex { display: flex !important; }
}

@media (min-width: 576px) and (max-width: 767.98px) {
    .d-sm-none { display: none !important; }
    .d-sm-block { display: block !important; }
    .d-sm-flex { display: flex !important; }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    .d-md-none { display: none !important; }
    .d-md-block { display: block !important; }
    .d-md-flex { display: flex !important; }
}

@media (min-width: 992px) {
    .d-lg-none { display: none !important; }
    .d-lg-block { display: block !important; }
    .d-lg-flex { display: flex !important; }
}

/* Text alignment utilities */
.text-left { text-align: left !important; }
.text-center { text-align: center !important; }
.text-right { text-align: right !important; }

@media (max-width: 767.98px) {
    .text-sm-center { text-align: center !important; }
    .text-sm-left { text-align: left !important; }
    .text-sm-right { text-align: right !important; }
}

/* Flex utilities */
.flex-column { flex-direction: column !important; }
.flex-row { flex-direction: row !important; }
.flex-wrap { flex-wrap: wrap !important; }
.flex-nowrap { flex-wrap: nowrap !important; }
.justify-content-start { justify-content: flex-start !important; }
.justify-content-end { justify-content: flex-end !important; }
.justify-content-center { justify-content: center !important; }
.justify-content-between { justify-content: space-between !important; }
.align-items-start { align-items: flex-start !important; }
.align-items-end { align-items: flex-end !important; }
.align-items-center { align-items: center !important; }

@media (max-width: 767.98px) {
    .flex-sm-column { flex-direction: column !important; }
    .flex-sm-row { flex-direction: row !important; }
    .justify-content-sm-center { justify-content: center !important; }
    .align-items-sm-center { align-items: center !important; }
}

/* Margin and padding utilities */
.m-0 { margin: 0 !important; }
.mt-0 { margin-top: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.ml-0 { margin-left: 0 !important; }
.mr-0 { margin-right: 0 !important; }

.p-0 { padding: 0 !important; }
.pt-0 { padding-top: 0 !important; }
.pb-0 { padding-bottom: 0 !important; }
.pl-0 { padding-left: 0 !important; }
.pr-0 { padding-right: 0 !important; }

/* Width utilities */
.w-25 { width: 25% !important; }
.w-50 { width: 50% !important; }
.w-75 { width: 75% !important; }
.w-100 { width: 100% !important; }

@media (max-width: 767.98px) {
    .w-sm-100 { width: 100% !important; }
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    .hero-bg .matrix-rain,
    .hero-bg .cyber-grid {
        animation: none;
    }

    .loading-progress .progress-bar {
        animation: none;
        width: 100%;
    }

    .glitch::before,
    .glitch::after {
        animation: none;
    }

    .cyber-terminal .typing {
        animation: none;
        border: none;
        width: 100%;
    }

    .scroll-arrow {
        animation: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --primary-bg: #000000;
        --secondary-bg: #1a1a1a;
        --tertiary-bg: #333333;
        --primary-text: #ffffff;
        --secondary-text: #cccccc;
        --cyber-green: #00ff00;
        --cyber-blue: #0099ff;
    }
}

/* Print styles */
@media print {
    .navbar,
    .hero-bg,
    .scroll-indicator,
    .loading-screen,
    .nav-toggle {
        display: none !important;
    }

    body {
        background: white !important;
        color: black !important;
    }

    .container {
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    h1, h2, h3, h4, h5, h6 {
        color: black !important;
    }

    .section-title,
    .hero-title {
        background: none !important;
        -webkit-text-fill-color: black !important;
        color: black !important;
    }
}