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

/* Large Desktop (1200px+) */
@media (min-width: 1200px) {

    .header-container,
    .footer-container {
        max-width: 1200px;
    }

    body:not(.index-page) main>* {
        max-width: 1200px;
    }
}

/* Desktop (992px - 1199px) */
@media (max-width: 1199px) {
    .demo-slider {
        min-height: 300px;
        min-width: 300px;
    }
}

/* Tablet Landscape (768px - 991px) */
@media (max-width: 991px) {

    .header-container,
    .footer-container {
        padding: 0 15px;
    }

    nav ul {
        gap: 1.5rem;
    }

    nav a {
        font-size: 0.85rem;
    }

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

    .demo-slider {
        min-height: 280px;
        min-width: 280px;
    }

    .content {
        padding: 2px 30px 40px 30px !important;
    }

    h1 {
        font-size: 2.4em;
    }

    .notes-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Tablet Portrait (576px - 767px) */
@media (max-width: 767px) {
    nav ul {
        gap: 1rem;
    }

    nav a {
        font-size: 0.8rem;
    }

    .demo-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .demo-slider {
        min-height: 250px;
        min-width: 250px;
        margin: 0 auto;
    }

    .content {
        padding: 20px !important;
    }

    h1 {
        font-size: 2.2em;
    }

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

    .notes-grid {
        grid-template-columns: 1fr;
        gap: 1.5em;
    }

    table {
        font-size: 0.8em;
    }

    th,
    td {
        padding: 10px 6px;
    }

    /* Index page content section improvements */
    .content-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 20px;
    }

    .feature {
        background: rgba(255, 255, 255, 0.95);
        padding: 25px;
        border-radius: 15px;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
        backdrop-filter: blur(10px);
        border: 1px solid rgba(255, 255, 255, 0.2);
    }

    .feature-icon {
        font-size: 3em;
        margin-bottom: 15px;
    }

    .feature-title {
        font-size: 1.3em;
        margin-bottom: 10px;
        font-weight: 600;
    }

    .feature-desc {
        font-size: 1em;
        line-height: 1.4;
    }
}

/* Mobile Large (480px - 575px) */
@media (max-width: 575px) {

    .header-container,
    .footer-container {
        padding: 0 10px;
    }

    .logo {
        font-size: 1rem;
    }

    nav ul {
        gap: 0.8rem;
    }

    nav a {
        font-size: 0.75rem;
    }

    .content {
        padding: 15px !important;
    }

    h1 {
        font-size: 2em;
    }

    .demo-slider {
        min-height: 200px;
        min-width: 200px;
    }

    table {
        font-size: 0.7em;
    }

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

    .contact-form {
        padding: 1.2em;
    }

    /* Index page mobile styles */
    body.index-page .hero-overlay .hero-title {
        font-size: 2.2em;
    }

    body.index-page .hero-overlay .hero-subtitle {
        font-size: 1em;
    }

    .content-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 15px;
    }

    .feature {
        background: rgba(255, 255, 255, 0.95);
        padding: 20px;
        border-radius: 12px;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
        backdrop-filter: blur(10px);
    }

    .feature-icon {
        font-size: 2.5em;
        margin-bottom: 15px;
    }

    .feature-title {
        font-size: 1.2em;
        margin-bottom: 8px;
    }

    .feature-desc {
        font-size: 0.95em;
    }
}

/* Mobile Small (320px - 479px) */
@media (max-width: 479px) {

    .header-container,
    .footer-container {
        padding: 0 8px;
    }

    .logo {
        font-size: 0.9rem !important;
        display: flex !important;
        visibility: visible !important;
    }

    nav ul {
        gap: 0.5rem;
    }

    nav a {
        font-size: 0.7rem;
    }

    .content {
        padding: 12px !important;
    }

    h1 {
        font-size: 1.8em;
    }

    .demo-slider {
        min-height: 180px;
        min-width: 180px;
    }

    table {
        font-size: 0.65em;
    }

    th,
    td {
        padding: 6px 3px;
    }

    /* Index page extra small mobile */
    body.index-page .hero-overlay .hero-title {
        font-size: 1.8em;
    }

    body.index-page .hero-overlay .hero-subtitle {
        font-size: 0.9em;
    }

    .hero-button {
        padding: 12px 20px;
        font-size: 1em;
        width: 180px;
    }

    .content-grid {
        gap: 12px;
        padding: 12px;
    }

    .feature {
        padding: 15px;
    }

    .feature-icon {
        font-size: 2.2em;
        margin-bottom: 12px;
    }

    .feature-title {
        font-size: 1.1em;
        margin-bottom: 6px;
    }

    .feature-desc {
        font-size: 0.9em;
    }
}

/* Navigation responsive improvements */
@media (max-width: 991px) {
    nav ul {
        flex-wrap: wrap;
        justify-content: center;
    }
}

@media (max-width: 767px) {
    .mobile-menu-toggle {
        display: block !important;
        position: absolute;
        right: 10px;
        top: 50%;
        transform: translateY(-50%);
        background: none;
        border: none;
        color: white;
        font-size: 1.5rem;
        cursor: pointer;
        padding: 5px;
        transition: color 0.3s ease;
    }

    .mobile-menu-toggle:hover {
        color: #E94560;
    }

    .header-container {
        position: relative;
    }

    nav {
        display: block;
    }

    nav ul {
        flex-direction: column;
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        background: #1A1A2E;
        padding: 15px 0;
        display: none;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
        z-index: 1000;
    }

    nav ul.show {
        display: flex;
    }

    nav ul li {
        margin: 0;
        text-align: center;
    }

    nav ul li a {
        display: block;
        padding: 12px 20px;
        font-size: 1rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        transition: background-color 0.3s ease;
    }

    nav ul li:last-child a {
        border-bottom: none;
    }

    nav ul li a:hover,
    nav ul li a.active {
        background-color: rgba(233, 69, 96, 0.1);
        color: #E94560;
    }

    /* Mobile-only menu items */
    nav ul li.mobile-only:first-of-type {
        border-top: 1px solid rgba(255, 255, 255, 0.2);
        margin-top: 15px;
        padding-top: 10px;
    }

    nav ul li.mobile-only:first-of-type a {
        border-top: none;
    }
}

/* Hide mobile-only items on desktop */
@media (min-width: 768px) {
    nav ul li.mobile-only {
        display: none;
    }
}

/* Footer responsive */
@media (max-width: 767px) {
    .footer-links {
        display: none;
    }

    .footer-container {
        justify-content: center;
    }

    .copyright {
        font-size: 0.7rem;
    }
}

/* Ensure images and media are responsive */
img,
video,
iframe {
    max-width: 100%;
    height: auto;
}

/* Prevent horizontal overflow */
* {
    max-width: 100%;
    box-sizing: border-box;
}

body {
    font-size: 0.9em;
    overflow-x: hidden;
}

/* Fix code blocks on mobile */
@media (max-width: 767px) {
    .content pre {
        font-size: 0.75em;
        padding: 12px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .content code {
        font-size: 0.8em;
        word-break: break-all;
    }

    /* Fix wide tables - MOBILE FIRST */
    .comparison-table {
        display: table !important;
        width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        font-size: 0.7em !important;
        margin: 0 !important;
        border-radius: 8px !important;
        border-collapse: collapse !important;
    }

    .comparison-table thead {
        display: table-header-group !important;
    }

    .comparison-table tbody {
        display: table-row-group !important;
    }

    .comparison-table tr {
        display: table-row !important;
    }

    .comparison-table th,
    .comparison-table td {
        display: table-cell !important;
        padding: 6px 4px !important;
        font-size: 0.7em !important;
        min-width: 70px !important;
        word-break: break-word !important;
        overflow-wrap: break-word !important;
        white-space: normal !important;
        vertical-align: top !important;
        border: 1px solid #ddd !important;
    }

    .comparison-table th:first-child,
    .comparison-table td:first-child {
        min-width: 90px !important;
        position: sticky !important;
        left: 0 !important;
        background: white !important;
        z-index: 2 !important;
    }

    .notes-grid {
        grid-template-columns: 1fr;
        gap: 1em;
    }

    /* Fix long URLs and text */
    .content {
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
        overflow-x: hidden !important;
    }
}

/* Responsive typography */
@media (max-width: 767px) {
    .content h2 {
        font-size: 1.6em;
    }

    .content h3 {
        font-size: 1.2em;
    }

    .content {
        font-size: 0.9em;
    }
}

@media (max-width: 479px) {
    .content h2 {
        font-size: 1.4em;
    }

    .content h3 {
        font-size: 1.1em;
    }

    .content {
        font-size: 0.9em;
    }
}
