/* Header Styles */
/* Add CSS variable for grid columns at the top of your file */
:root {
    --compress-grid-columns: 4;
    /* You can change this number to adjust columns */
    --compress-grid-gap: 10px;
    /* Grid gap - adjust this value to change spacing */
    --compress-item-padding: 10px;
    /* Item padding */
    --compress-menu-padding: 15px;
    /* Menu padding */
    --compress-text-align: left;
    /* Add this new variable - can be 'left', 'center', or 'right' */
    --compress-content-justify: flex-start;
    /* Add this for flex alignment - can be 'flex-start', 'center', or 'flex-end' */

    --bg-color: #f8fafc;
    --text-color: #0f172a;
    --header-bg: #ffffff;
    --header-text: #0f172a;
    --dropdown-bg: #ffffff;
    --dropdown-text: #0f172a;
    --dropdown-hover-bg: #f5f5f5;
    --dropdown-item-bg: #f8f9fa;
    --dropdown-item-hover: #e9ecef;
    --border-color: rgba(0, 0, 0, 0.08);
    --shadow-color: rgba(0, 0, 0, 0.1);
}

.dark-mode {
    --bg-color: #0b1220;
    --text-color: #e5e7eb;
    --header-bg: #0f172a;
    --header-text: #e5e7eb;
    --dropdown-bg: #1e293b;
    --dropdown-text: #e5e7eb;
    --dropdown-hover-bg: rgba(255, 255, 255, 0.1);
    --dropdown-item-bg: rgba(255, 255, 255, 0.05);
    --dropdown-item-hover: rgba(255, 255, 255, 0.12);
    --border-color: rgba(255, 255, 255, 0.12);
    --shadow-color: rgba(0, 0, 0, 0.35);
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    line-height: 1.6;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s ease, color 0.3s ease;
    padding-top: 70px;
    /* Adjust based on your header height */
}

.dark-mode body {
    background-color: #020617 !important;
    color: var(--text-color);
}

.dark-mode section {
    background-color: transparent;
}

.dark-mode .bg-gray-50,
.dark-mode .bg-gradient-to-b,
.dark-mode .from-blue-100,
.dark-mode .from-gray-50,
.dark-mode .via-blue-50,
.dark-mode .to-white {
    background-color: #020617 !important;
    background-image: none !important;
}

.dark-mode .bg-white {
    background-color: #0f172a !important;
}

.dark-mode .text-blue-600 {
    color: #60a5fa !important;
}

.dark-mode .bg-blue-100,
.dark-mode .bg-green-100,
.dark-mode .bg-purple-100,
.dark-mode .bg-red-100,
.dark-mode .bg-yellow-100,
.dark-mode .bg-indigo-100 {
    background-color: rgba(255, 255, 255, 0.1) !important;
}

.dark-mode .text-blue-500,
.dark-mode .text-green-500,
.dark-mode .text-purple-500,
.dark-mode .text-red-500,
.dark-mode .text-yellow-500,
.dark-mode .text-indigo-500 {
    color: #60a5fa !important;
    /* Lighter blue for better contrast */
}

/* Specific highlight colors for dark mode */
.dark-mode .text-green-500 {
    color: #4ade80 !important;
}

.dark-mode .text-purple-500 {
    color: #c084fc !important;
}

.dark-mode .text-red-500 {
    color: #f87171 !important;
}

.dark-mode .text-yellow-500 {
    color: #fbbf24 !important;
}

.dark-mode .text-indigo-500 {
    color: #818cf8 !important;
}

.dark-mode .text-gray-900,
.dark-mode .text-gray-800,
.dark-mode .text-gray-700 {
    color: #f1f5f9 !important;
}

.dark-mode .text-gray-600 {
    color: #cbd5e1 !important;
}

.dark-mode .btn-secondary {
    background-color: #1e293b !important;
    color: #60a5fa !important;
    border-color: #2563eb !important;
}

.dark-mode .btn-secondary:hover {
    background-color: #2d3748 !important;
}

/* CTA Buttons Base Styles */
.btn-primary-cta {
    background-color: #2563eb;
    color: white;
    padding: 16px 32px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 18px;
    text-decoration: none;
    display: inline-block;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
    transition: all 0.3s ease;
}

.btn-secondary-cta {
    background-color: white;
    color: #2563eb;
    padding: 16px 32px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 18px;
    text-decoration: none;
    display: inline-block;
    border: 2px solid #2563eb;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.15);
    transition: all 0.3s ease;
}

.btn-primary-cta:hover,
.btn-secondary-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.25);
}

.dark-mode .btn-primary-cta {
    background-color: #2563eb;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.dark-mode .btn-secondary-cta {
    background-color: #1e293b;
    color: #60a5fa;
    border-color: #2563eb;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.dark-mode .btn-secondary-cta:hover {
    background-color: #2d3748;
}

.dark-mode #search-results {
    background-color: #0f172a !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: #f1f5f9 !important;
}

.dark-mode #search-results a:hover {
    background-color: rgba(255, 255, 255, 0.05) !important;
}

.dark-mode .border-gray-100,
.dark-mode .border-gray-200 {
    border-color: rgba(255, 255, 255, 0.1) !important;
}

.dark-mode input,
.dark-mode textarea,
.dark-mode select {
    background-color: #1e293b !important;
    color: #f1f5f9 !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
}

.dark-mode input::placeholder,
.dark-mode textarea::placeholder {
    color: #94a3b8 !important;
}

/* Header styles */
.header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 2rem;
    background: var(--header-bg);
    box-shadow: 0 2px 10px var(--shadow-color);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1000;
}

.logo {
    justify-self: start;
}

.nav-menu {
    justify-self: center;
}

.header-actions {
    justify-self: end;
}



/* Navigation menu */
.nav-menu {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
}

.menu-items {
    display: flex;
    list-style: none;
    gap: 1.5rem;
    align-items: center;
    justify-content: center;
    width: auto;
}

@media (max-width: 1024px) {
    .menu-items {
        gap: 1rem;
    }

    .menu-items a {
        font-size: 0.95rem;
        padding: 0.4rem;
    }
}

.menu-items a {
    text-decoration: none;
    color: var(--header-text);
    font-size: 1rem;
    padding: 0.5rem;
    transition: color 0.3s ease;
    font-weight: 500;
}

.menu-items a:hover {
    color: #1976d2;
    /* Darker blue for better contrast */
    font-weight: 600;
}

.menu-items a.active {
    color: #1565c0;
    /* Even darker blue for active state, better contrast */
    font-weight: 600;
    border-bottom: 2px solid #1565c0;
}

/* Dropdown styles */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 15px);
    left: 0;
    background: var(--dropdown-bg);
    box-shadow: 0 2px 10px var(--shadow-color);
    border-radius: 4px;
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    list-style: none;
    z-index: 100;
}

/* Add dropdown arrow/triangle */
.dropdown-menu::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 20px;
    width: 16px;
    height: 16px;
    background: var(--dropdown-bg);
    transform: rotate(45deg);
    box-shadow: -2px -2px 5px rgba(0, 0, 0, 0.05);
    border-radius: 2px;
}

/* Adjust right-aligned dropdowns arrow position */
.menu-items>li:last-child .dropdown-menu::before,
.menu-items>li:nth-last-child(2) .dropdown-menu::before {
    left: auto;
    right: 20px;
}

/* Update the dropdown styles */
@media (min-width: 769px) {
    .dropdown:hover .dropdown-menu {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    /* Add scrolling for all dropdowns except Compress */
    .dropdown-menu {
        max-height: calc(100vh - 100px);
        overflow-y: auto;
    }

    /* Remove scrolling specifically for Compress dropdown */
    .menu-items li:nth-child(3) .dropdown-menu {
        max-height: none;
        overflow-y: visible;
    }

    /* Target the Compress dropdown grid view using class instead of nth-child */
    .compress-dropdown .dropdown-menu {
        display: grid !important;
        grid-template-columns: repeat(var(--compress-grid-columns), 1fr) !important;
        gap: var(--compress-grid-gap) !important;
        padding: var(--compress-menu-padding);
        min-width: calc(200px * var(--compress-grid-columns));
        max-width: calc(225px * var(--compress-grid-columns));
        left: 50%;
        top: calc(100% + 15px);
        transform: translateX(-50%) translateY(10px);
        max-height: none !important;
        overflow: visible !important;
    }

    /* Center the arrow for Compress dropdown */
    .compress-dropdown .dropdown-menu::before {
        left: 50%;
        transform: translateX(-50%) rotate(45deg);
    }

    /* Override hover transform for this specific dropdown */
    .compress-dropdown:hover .dropdown-menu {
        transform: translateX(-50%) translateY(0);
    }

    /* Initial state with both transforms */
    .compress-dropdown .dropdown-menu {
        transform: translateX(-50%) translateY(10px);
    }

    .compress-dropdown .dropdown-menu li {
        margin: 0;
    }

    .compress-dropdown .dropdown-menu li a {
        padding: var(--compress-item-padding);
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: var(--compress-content-justify);
        text-align: var(--compress-text-align);
        background: var(--dropdown-item-bg);
        border-radius: 6px;
        transition: all 0.2s ease;
        color: var(--dropdown-text);
    }

    .compress-dropdown .dropdown-menu li a i {
        margin: 0 10px;
    }

    .compress-dropdown .dropdown-menu li a:hover {
        background: var(--dropdown-item-hover);
        transform: translateY(-2px);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        color: #2196f3;
    }

    /* Specific grid column configurations for each dropdown */
    /* Image Resizer - 1 column (vertical list with button style) */
    .menu-items li:nth-child(2).compress-dropdown .dropdown-menu {
        grid-template-columns: 1fr !important;
        min-width: 220px;
        max-width: 250px;
        left: 0;
        transform: translateX(0) translateY(10px);
    }

    .menu-items li:nth-child(2).compress-dropdown .dropdown-menu::before {
        left: 20px;
        transform: translateX(0) rotate(45deg);
    }

    .menu-items li:nth-child(2).compress-dropdown:hover .dropdown-menu {
        transform: translateX(0) translateY(0);
    }

    /* Compress - 1 column (vertical list with button style) */
    .menu-items li:nth-child(4).compress-dropdown .dropdown-menu {
        grid-template-columns: 1fr !important;
        min-width: 220px;
        max-width: 250px;
        left: 0;
        transform: translateX(0) translateY(10px);
    }

    .menu-items li:nth-child(4).compress-dropdown .dropdown-menu::before {
        left: 20px;
        transform: translateX(0) rotate(45deg);
    }

    .menu-items li:nth-child(4).compress-dropdown:hover .dropdown-menu {
        transform: translateX(0) translateY(0);
    }

    /* Image Tools - 1 column (vertical list with button style) */
    .menu-items li:nth-child(5).compress-dropdown .dropdown-menu {
        grid-template-columns: 1fr !important;
        min-width: 220px;
        max-width: 250px;
        left: 0;
        transform: translateX(0) translateY(10px);
    }

    .menu-items li:nth-child(5).compress-dropdown .dropdown-menu::before {
        left: 20px;
        transform: translateX(0) rotate(45deg);
    }

    .menu-items li:nth-child(5).compress-dropdown:hover .dropdown-menu {
        transform: translateX(0) translateY(0);
    }

    /* Convert - 4 columns (grid layout) - ONLY THIS ONE KEEPS GRID */
    .menu-items li:nth-child(3).compress-dropdown .dropdown-menu {
        grid-template-columns: repeat(4, 1fr) !important;
        min-width: 800px;
        max-width: 900px;
    }
}

/* Right-aligned dropdowns for last items */
.menu-items>li:last-child .dropdown-menu,
.menu-items>li:nth-last-child(2) .dropdown-menu {
    left: auto;
    right: 0;
}

/* Adjust position if menu would overflow right edge */
@media (max-width: 1200px) {
    .menu-items>li:nth-last-child(3) .dropdown-menu {
        left: auto;
        right: 0;
    }
}

.dropdown-menu li a {
    display: block;
    padding: 0.8rem 1rem;
    color: var(--dropdown-text);
    transition: background-color 0.3s ease;
    font-weight: normal;
}

.dropdown-menu li a:hover {
    background-color: var(--dropdown-hover-bg);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.theme-toggle {
    appearance: none;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--header-text);
    width: 38px;
    height: 38px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.theme-toggle:hover {
    background-color: rgba(33, 150, 243, 0.08);
    border-color: rgba(33, 150, 243, 0.35);
}

.theme-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}

.theme-icon-sun {
    display: none;
}

.dark-mode .theme-icon-sun {
    display: inline-flex;
}

.dark-mode .theme-icon-moon {
    display: none;
}

/* Mobile specific styles */
@media (max-width: 768px) {
    .dropdown-menu {
        position: static;
        /* Change from fixed to static */
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        display: block;
        width: 100%;
        padding-left: 1.5rem;
        border-left: none;
        margin-left: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }

    /* Show dropdown when active */
    .dropdown.active .dropdown-menu {
        max-height: 1000px;
        /* Large enough to show all content */
        margin-top: 0.5rem;
        margin-bottom: 0.5rem;
    }

    /* Improve nested menu appearance */
    .dropdown-menu li a {
        padding: 0.5rem 0;
        font-size: 1rem;
    }

    /* Remove fixed positioning styles */
    .dropdown-menu {
        height: auto;
        background: transparent;
        z-index: auto;
    }

    /* Ensure compress dropdown works in mobile */
    .compress-dropdown .dropdown-menu {
        display: block;
        grid-template-columns: none;
        min-width: auto;
        transform: none;
        position: static;
        padding-left: 1.5rem;
    }

    .menu-items li a {
        color: var(--header-text);
    }

    .dropdown.active>a {
        color: #1565c0;
        /* Darker blue for better contrast */
    }

    .mobile-menu-btn.active span:nth-child(1) {
        transform: rotate(45deg) translate(8px, 6px);
    }

    .mobile-menu-btn.active span:nth-child(2) {
        opacity: 0;
    }

    .mobile-menu-btn.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -5px);
    }

    .dropdown.active a i {
        transform: rotate(180deg);
    }

    .nav-menu::-webkit-scrollbar,
    .dropdown-menu::-webkit-scrollbar {
        width: 5px;
    }

    .nav-menu::-webkit-scrollbar-track,
    .dropdown-menu::-webkit-scrollbar-track {
        background: #f1f1f1;
    }

    .nav-menu::-webkit-scrollbar-thumb,
    .dropdown-menu::-webkit-scrollbar-thumb {
        background: #888;
        border-radius: 5px;
    }

    .nav-menu::-webkit-scrollbar-thumb:hover,
    .dropdown-menu::-webkit-scrollbar-thumb:hover {
        background: #555;
    }

    .dropdown-menu li {
        padding: 8px 0;
    }

    .dropdown-menu li:last-child {
        padding-bottom: 16px;
    }

    .nav-menu,
    .dropdown-menu {
        -ms-overflow-style: none;
        scrollbar-width: thin;
    }
}

/* Keep original list view for mobile */
@media (max-width: 768px) {
    .menu-items>li:nth-child(5) .dropdown-menu {
        display: block;
    }
}

/* Add new styles for compress dropdown */
@media (min-width: 769px) {

    /* Base dropdown hover effect */
    .dropdown:hover .dropdown-menu {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    /* Specific styles for compress dropdown */
    .compress-dropdown .dropdown-menu {
        display: grid !important;
        grid-template-columns: repeat(var(--compress-grid-columns), 1fr) !important;
        gap: var(--compress-grid-gap) !important;
        padding: var(--compress-menu-padding);
        min-width: calc(200px * var(--compress-grid-columns));
        max-width: calc(225px * var(--compress-grid-columns));
        left: 50%;
        top: calc(100% + 15px);
        transform: translateX(-50%) translateY(10px);
        max-height: none !important;
        overflow: visible !important;
    }

    .compress-dropdown:hover .dropdown-menu {
        transform: translateX(-50%) translateY(0);
    }

    /* Grid item styles */
    .compress-dropdown .dropdown-menu li {
        margin: 0;
    }

    .compress-dropdown .dropdown-menu li a {
        padding: var(--compress-item-padding);
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: var(--compress-content-justify);
        text-align: var(--compress-text-align);
        background: var(--dropdown-item-bg);
        border-radius: 6px;
        transition: all 0.2s ease;
        color: var(--dropdown-text);
    }

    .compress-dropdown .dropdown-menu li a i {
        margin: 0 10px;
    }

    .compress-dropdown .dropdown-menu li a:hover {
        background: var(--dropdown-item-hover);
        transform: translateY(-2px);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        color: #2196f3;
    }

    /* Center arrow for compress dropdown */
    .compress-dropdown .dropdown-menu::before {
        left: 50%;
        transform: translateX(-50%) rotate(45deg);
    }
}

/* Mobile styles for compress dropdown */
@media (max-width: 768px) {
    .compress-dropdown .dropdown-menu {
        display: block;
        grid-template-columns: none;
        min-width: auto;
        transform: none;
    }
}

/* Mobile menu button styles */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    gap: 6px;
    cursor: pointer;
    padding: 5px;
}

.mobile-menu-btn span {
    display: block;
    width: 25px;
    height: 2px;
    background-color: var(--header-text);
    transition: all 0.3s ease;
}

/* Mobile responsive styles */
@media (max-width: 768px) {
    .header {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .header-actions {
        margin-left: auto;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .nav-menu {
        position: fixed;
        top: 70px;
        left: 0;
        right: 0;
        background: var(--header-bg);
        padding: 1.5rem;
        box-shadow: 0 2px 10px var(--shadow-color);
        display: none;
        height: calc(65vh - 90px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }

    .nav-menu.active {
        display: block;
    }

    .menu-items {
        flex-direction: column;
        gap: 0.8rem;
        padding-bottom: 20px;
        align-items: flex-start;
        width: 100%;
    }

    .menu-items li {
        width: 100%;
    }

    .menu-items li a {
        padding: 0.8rem 0;
        display: block;
        font-size: 1.1rem;
    }

    /* Dropdown styles for mobile */
    .dropdown>a {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
    }
}

/* Arrow icon styles */
.dropdown a i {
    display: inline-block;
    margin-left: 4px;
    transition: transform 0.3s ease;
    position: relative;
    font-size: 0.8em;
    transform: rotate(0deg);
    will-change: transform;
}

/* Arrow hover effect for desktop */
@media (min-width: 769px) {
    .dropdown a i {
        transform: rotate(0deg);
        transition: all 0.3s ease;
    }

    .dropdown:hover a i {
        transform: rotate(180deg);
        color: #1565c0;
        /* Darker blue for better contrast */
    }
}

/* Mobile arrow styles */
@media (max-width: 768px) {
    .dropdown a i {
        margin-right: 0.5rem;
        transform: rotate(0deg);
        transition: transform 0.3s ease;
    }

    .dropdown.active a i {
        transform: rotate(180deg);
        color: #2196f3;
    }
}

/* FAQ Section Styles with Theme Support */
.faq-section {
    padding: 80px 0;
    transition: background-color 0.3s ease;
}

.faq-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 40px;
}

.faq-container {
    border-radius: 16px;
    overflow: hidden;
    background-color: var(--dropdown-item-bg);
}

.faq-item-new {
    border-bottom: 1px solid var(--border-color);
}

.faq-button {
    width: 100%;
    padding: 24px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
}

.faq-button span:first-child {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
    padding-right: 20px;
}

.faq-toggle {
    font-size: 24px;
    color: var(--text-color);
    font-weight: 300;
    flex-shrink: 0;
}

.faq-content {
    padding: 0 28px 24px 28px;
}

.faq-content p {
    font-size: 15px;
    color: var(--text-color);
    opacity: 0.8;
    line-height: 1.6;
    margin: 0;
}

.faq-content a {
    color: #2563eb;
    text-decoration: none;
}

.faq-content a:hover {
    text-decoration: underline;
}

.dark-mode .faq-section {
    background-color: #020617;
}

.dark-mode .faq-container {
    background-color: #1e293b;
}

.dark-mode .faq-toggle,
.dark-mode .faq-button span:first-child {
    color: #e5e7eb;
}

.dark-mode .faq-content p {
    color: #9ca3af;
}

/* Footer Contrast Fix */
.dark-mode footer {
    background-color: #0f172a !important;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.dark-mode footer p,
.dark-mode footer span,
.dark-mode footer a {
    color: #9ca3af !important;
}

.dark-mode footer a:hover {
    color: #ffffff !important;
}

.dark-mode footer h1,
.dark-mode footer h2,
.dark-mode footer h3 {
    color: #ffffff !important;
}