/* QUANTUM TOOLS Mobile Navigation Optimizations */

/* ===== TWO-LINE NAVIGATION BAR STRUCTURE ===== */

/* General header adjustments */
header {
    padding: 0 !important;
}

header .container {
    flex-direction: column;
    padding: 0;
    background-color: transparent;
}

/* First line: Logo and search in one row */
.top-nav-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0.8rem 1rem;
    background-color: rgba(10, 13, 20, 0.6);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 240, 255, 0.1);
    flex-wrap: wrap;
    /* Allow wrapping on very small screens */
    gap: 10px;
}

.light-theme .top-nav-row {
    background-color: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid rgba(0, 102, 204, 0.1);
}

/* Logo styling */
.top-nav-row .logo {
    display: flex;
    align-items: center;
}

.top-nav-row .logo a {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.top-nav-row .logo img {
    height: 45px;
    width: auto;
    margin-right: 10px;
}

.top-nav-row .logo h1 {
    font-size: 1.5rem;
    background: linear-gradient(45deg, #66c2c8, #19d081);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Right side elements in top row */
.top-right-elements {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Search container in top row */
.top-right-elements .search-container {
    position: relative;
}

.top-right-elements .search-bar {
    display: flex;
    align-items: center;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(0, 240, 255, 0.3);
    border-radius: 25px;
    padding: 0 15px;
    transition: all 0.3s ease;
}

.light-theme .top-right-elements .search-bar {
    background: rgba(240, 240, 240, 0.8);
    border: 1px solid rgba(0, 102, 204, 0.2);
}

.top-right-elements .search-bar input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.9rem;
    padding: 8px 5px;
    width: 220px;
}

.top-right-elements .search-bar input::placeholder {
    color: rgba(150, 150, 150, 0.8);
}

.top-right-elements .search-button {
    background: transparent;
    border: none;
    color: var(--accent-color-1);
    cursor: pointer;
    display: flex;
    align-items: center;
}

/* Theme toggle in top row */
.top-right-elements .theme-toggle {
    position: relative;
    width: 45px;
    height: 24px;
    background: linear-gradient(90deg, var(--accent-color-1), var(--accent-color-2));
    border-radius: 25px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 5px;
    overflow: hidden;
}

/* Second line: Navigation links with hamburger */
.bottom-nav-row {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0;
    background: rgba(17, 24, 39, 0.8);
    position: relative;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 240, 255, 0.1);
}

.light-theme .bottom-nav-row {
    background: rgba(245, 247, 250, 0.9);
    border-bottom: 1px solid rgba(0, 102, 204, 0.1);
}

/* Navigation links in second row */
.bottom-nav-row nav {
    width: 100%;
}

.bottom-nav-row .nav-links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 9999;
    /* Increased to ensure visibility */
    padding: 1rem 0;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.bottom-nav-row .nav-links li {
    margin: 0 10px 0 0;
}

/* Show dropdowns on hover in desktop */
@media (min-width: 769px) {
    .dropdown:hover .dropdown-menu {
        display: block;
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
}

/* Small mobile screens adjustments */
@media (max-width: 480px) {
    .logo h1 {
        font-size: 1.2rem;
    }

    .top-nav-row .search-container {
        width: 40%;
    }
}

/* Mobile & Desktop navigation styles */
.nav-links.active {
    display: block !important;
}

/* Mobile dropdown menus */
.dropdown-menu {
    display: none;
}

.dropdown.active>.dropdown-menu {
    display: block;
}

/* Mobile specific styles */
@media (max-width: 768px) {
    .top-right-elements .search-bar input {
        width: 100%;
        /* Flexible width */
        min-width: 100px;
    }

    .top-right-elements {
        flex: 1;
        justify-content: flex-end;
    }

    .logo h1 {
        font-size: 1.2rem;
        flex-shrink: 1;
        min-width: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Featured tool cards - SINGLE COLUMN on mobile */
    .featured-tools-grid {
        grid-template-columns: 1fr !important;
        gap: 20px;
        padding: 0 15px;
    }

    .featured-tool-card {
        width: 100%;
        max-width: 100%;
        margin: 0 auto;
    }

    /* Tool content should not truncate */
    .featured-tool-card .tool-content h3 {
        font-size: 1.5rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
        white-space: normal;
    }

    .featured-tool-card .tool-content p {
        font-size: 0.95rem;
        word-wrap: break-word;
    }

    /* Tool cards - better mobile layout to prevent text cutoff */
    .tools-section .tools-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        padding: 0 15px;
        gap: 20px;
    }

    .tool-card {
        width: 100%;
        max-width: 100%;
    }

    .tool-card h3 {
        font-size: 1.1rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
        white-space: normal;
    }

    .tool-card p {
        font-size: 0.9rem;
        word-wrap: break-word;
    }

    /* Ensure proper container padding */
    .container {
        padding-left: 15px;
        padding-right: 15px;
        width: 100%;
        box-sizing: border-box;
    }

    /* Fix for overlapping elements */
    .tool-content {
        padding: 20px;
        overflow: visible;
    }

    /* Category grid fixes */
    .category-section .tools-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 15px;
    }

    /* Tags wrap properly */
    .tool-tags {
        flex-wrap: wrap;
        gap: 8px;
    }

    .tag {
        font-size: 0.7rem;
        padding: 4px 10px;
    }
}

/* Ensure proper section and container spacing for all screens */
@media (max-width: 768px) {

    /* Section padding adjustments - reduced */
    section {
        padding: 20px 0;
    }

    /* Hide particles on mobile - causes extra space and hides content */
    #particles-js,
    #particles-js canvas,
    .floating-shape {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
        min-height: 0 !important;
        position: absolute !important;
        z-index: -1 !important;
    }

    /* Hero section - proper spacing below fixed header */
    .hero {
        min-height: auto !important;
        max-height: fit-content !important;
        height: auto !important;
        margin-top: 70px !important;
        padding: 20px 15px !important;
        overflow: visible !important;
        position: relative !important;
    }

    /* CRITICAL: Make hero content visible */
    .hero-content {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: relative !important;
        z-index: 100 !important;
        padding: 15px !important;
        text-align: center !important;
    }

    .hero-content h1,
    .hero-content .glowing-text {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        font-size: 1.4rem !important;
        line-height: 1.4 !important;
        margin-bottom: 10px !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        white-space: normal !important;
        padding: 0 5px !important;
        max-width: 100% !important;
    }

    .hero-content p {
        display: block !important;
        visibility: visible !important;
        font-size: 0.95rem !important;
        margin-bottom: 15px !important;
    }

    .hero-content .cta-button {
        display: inline-block !important;
        visibility: visible !important;
    }

    /* Container width and padding */
    .container {
        max-width: 100%;
        padding-left: 15px;
        padding-right: 15px;
        box-sizing: border-box;
    }

    /* Fix for the hero section */
    .hero .container {
        padding: 0 15px;
    }

    /* Adjust featured tool cards layout */
    .featured-tool-card {
        display: flex;
        flex-direction: column;
    }

    .tool-preview {
        height: 120px;
    }

    /* Fix for category sections */
    .category-section {
        margin-bottom: 40px;
    }

    /* Prevent horizontal scrolling */
    body {
        overflow-x: hidden;
        width: 100%;
    }

    main {
        overflow-x: hidden;
        width: 100%;
    }
}

/* Tablet/Mobile Fix for Explore Button */
@media (max-width: 768px) {
    .cta-button {
        padding: 14px 32px;
        font-size: 1rem;
        display: inline-block;
        max-width: 80%;
        margin-top: 15px;
        /* Ensure it behaves */
        box-sizing: border-box;
    }
}

/* Small mobile screens */
@media (max-width: 480px) {
    .top-right-elements .search-bar input {
        width: 100%;
        min-width: 80px;
    }

    .logo h1 {
        font-size: 1rem;
    }

    /* Ensure single column on very small screens */
    .featured-tools-grid {
        grid-template-columns: 1fr !important;
        gap: 15px;
        padding: 0 10px;
    }

    .tools-grid,
    .category-section .tools-grid {
        grid-template-columns: 1fr !important;
        gap: 15px;
        padding: 0 10px;
    }

    .tool-card,
    .featured-tool-card {
        padding: 15px;
        width: 100%;
    }

    .tool-icon {
        font-size: 1.5rem;
        margin-bottom: 10px;
    }

    .tool-card h3 {
        font-size: 1rem;
        word-wrap: break-word;
    }

    .tool-card p {
        font-size: 0.85rem;
        word-wrap: break-word;
    }

    .featured-tool-card .tool-content h3 {
        font-size: 1.3rem;
    }

    /* Fix for "Explore Tools" button */
    .cta-button {
        padding: 12px 24px;
        font-size: 0.9rem;
        width: auto;
        max-width: 90%;
        display: inline-block;
    }

    /* Hero section adjustments */
    .hero-content h1 {
        font-size: 1.8rem;
    }

    .hero-content p {
        font-size: 1rem;
    }

    /* Section title adjustments */
    .section-title {
        font-size: 1.5rem;
    }

    .category-title {
        font-size: 1.3rem;
    }
}

/* Medium size screens */
@media (min-width: 769px) and (max-width: 1024px) {
    .logo h1 {
        font-size: 1.4rem;
    }

    /* Medium screen adjustments for tools grid */
    .featured-tools-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}