:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --bg: #0b0f19;
    --page-bg: #0b0f19;
    --card-bg: #141a29;
    --card-bg-2: #101625;
    --text: #e5e7eb;
    --muted: #9ca3af;
    --border: #232a3b;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--page-bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 40px;
    background: rgba(11, 15, 25, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    overflow: visible;
}

.logo {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text);
    text-decoration: none;
}

.navbar nav a {
    margin-left: 20px;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
}

.navbar nav a:hover { color: var(--primary); }

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2px 20px;
}

h1 { font-size: 1.15rem; font-weight: 800; margin-bottom: 2px; color: var(--text); }
.subtitle { color: var(--muted); margin-bottom: 4px; font-size: 0.78rem; }

.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-bottom: 0;
}

.tool-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px;
    text-decoration: none;
    color: var(--text);
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
    outline: none;
}

.tool-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.35);
    border-color: var(--primary);
}

.tool-card:focus {
    outline: none;
    border-color: var(--primary);
}

.icon-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    font-size: 1rem;
    margin-bottom: 6px;
}

.icon-red    { background: rgba(239, 68, 68, 0.15); }
.icon-purple { background: rgba(139, 92, 246, 0.15); }
.icon-teal   { background: rgba(45, 212, 191, 0.15); }
.icon-orange { background: rgba(249, 115, 22, 0.15); }
.icon-blue   { background: rgba(59, 130, 246, 0.15); }
.icon-pink   { background: rgba(236, 72, 153, 0.15); }

.tool-card h3 { margin: 0 0 6px; font-size: 1rem; font-weight: 700; color: var(--text); }
.tool-card p { margin: 0; color: var(--muted); font-size: 0.85rem; }

form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--card-bg);
    padding: 20px;
    border-radius: 14px;
    border: 1px solid var(--border);
}

label { font-weight: 600; font-size: 0.85rem; color: var(--text); }

input, select, textarea {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--card-bg-2);
    color: var(--text);
}

input::placeholder, textarea::placeholder { color: #6b7280; }

textarea { resize: vertical; }

button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
    font-weight: 700;
}

button:hover { background: var(--primary-dark); }

.result-box {
    margin-top: 14px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.3);
    padding: 12px 18px;
    border-radius: 10px;
    color: var(--text);
}

.hint { color: var(--muted); font-size: 0.8rem; margin-top: 6px; }

.ad-slot {
    background: var(--card-bg);
    border: 1px dashed var(--border);
    text-align: center;
    padding: 10px;
    color: var(--muted);
    font-size: 0.8rem;
    margin: 0 auto;
    max-width: 1000px;
}

@media (max-width: 600px) {
    .ad-slot {
        margin: 0 12px;
        padding: 8px;
        font-size: 0.72rem;
        border-radius: 8px;
    }
}

footer {
    text-align: center;
    padding: 14px;
    color: var(--muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
}

.tool-hero {
    text-align: center;
    max-width: 640px;
    margin: 0 auto;
}

.tool-hero h1 {
    font-size: 1.9rem;
    margin-bottom: 8px;
}

.tool-hero .subtitle {
    font-size: 0.95rem;
    margin-bottom: 20px;
}

.tool-hero form {
    border: none;
    background: transparent;
    padding: 0;
    align-items: center;
}

.upload-box {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.upload-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    padding: 16px 40px;
    border-radius: 50px;
    cursor: pointer;
    border: none;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.35);
    transition: background 0.15s, transform 0.15s;
    text-decoration: none;
}

.upload-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.file-name {
    color: var(--muted);
    font-size: 0.85rem;
}

.quality-row {
    width: 100%;
    max-width: 320px;
    text-align: left;
}

.tool-hero .hint { margin-top: 10px; }

.hero-dark {
    background: var(--page-bg);
    padding: 14px 20px 6px;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

.hero-badge {
    display: inline-block;
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.35);
    color: #a5b4fc;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 4px 14px;
    border-radius: 50px;
    margin-bottom: 8px;
}

.hero-dark h1 {
    font-size: 1.55rem;
    font-weight: 800;
    line-height: 1.2;
    max-width: 720px;
    margin: 0 auto 8px;
    color: var(--text);
}

.hero-dark h1 .accent {
    color: #a5b4fc;
}

.hero-dark .hero-subtitle {
    color: var(--muted);
    font-size: 0.88rem;
    max-width: 560px;
    margin: 0 auto 10px;
}

.scroll-box {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.35);
    color: #a5b4fc;
    font-weight: 600;
    font-size: 0.82rem;
    padding: 6px 18px;
    border-radius: 50px;
    cursor: pointer;
    transition: background 0.15s, transform 0.15s;
}

.scroll-box:hover {
    background: rgba(99, 102, 241, 0.2);
    transform: translateY(2px);
}

.scroll-box .arrow {
    animation: bounce-down 1.5s infinite;
}

@keyframes bounce-down {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(4px); }
}

.features-section {
    background: var(--page-bg);
    padding: 28px 20px;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

.features-section h2 {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 22px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    max-width: 900px;
    margin: 0 auto;
}

.feature-item h3 {
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.feature-item p {
    color: var(--muted);
    font-size: 0.85rem;
    margin: 0;
}

/* Floating back-to-tools button */
.back-to-tools-btn {
    position: fixed;
    top: 100px;
    left: 16px;
    background: var(--primary);
    color: #fff;
    padding: 9px 16px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
    z-index: 999;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.back-to-tools-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.55);
}

@media (max-width: 600px) {
    .back-to-tools-btn {
        top: 90px;
        left: 12px;
        padding: 7px 14px;
        font-size: 0.78rem;
    }
}

/* Mega menu dropdown */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-btn {
    background: none;
    border: none;
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    padding: 0;
    margin-left: 20px;
}

.dropdown-btn:hover {
    color: var(--primary);
}

.mega-menu {
    display: none;
    position: fixed;
    top: 50px;
    left: 50%;
    transform: translateX(-50%);
    width: min(94vw, 980px);
    max-height: 80vh;
    overflow-y: auto;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    padding: 26px 24px 24px;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px 20px;

}

.dropdown.open .mega-menu {
    display: grid;
}

.mega-col h4 {
    color: var(--muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0;
    margin-bottom: 8px;
    font-weight: 600;
}

.mega-col a {
    display: block;
    padding: 6px 0;
    color: var(--text);
    text-decoration: none;
    font-size: 0.85rem;
}

.mega-col a:hover {
    color: var(--primary);
}

@media (max-width: 1000px) {
    .mega-menu {
        grid-template-columns: repeat(3, 1fr);
        width: 90vw;
        top: 70px;
    }
}

@media (max-width: 600px) {
    .mega-menu {
        grid-template-columns: 1fr;
    }
}

/* Promo banner */
.promo-banner {
    max-width: 1000px;
    margin: 8px auto 32px;
    padding: 28px 24px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(99, 102, 241, 0.02));
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: 18px;
}

.promo-badge {
    display: inline-block;
    background: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 5px 14px;
    border-radius: 30px;
    margin-bottom: 14px;
}

.promo-banner h2 {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text);
    margin: 0 0 8px;
}

.promo-banner h2 .accent {
    color: #a5b4fc;
}

.promo-subtitle {
    color: var(--muted);
    font-size: 0.95rem;
    margin: 0 0 22px;
}

.promo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.promo-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    text-decoration: none;
    transition: transform 0.15s, border-color 0.15s;
}

.promo-card:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
}

.promo-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.promo-card-top h4 {
    margin: 0;
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 700;
}

.promo-tag {
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 20px;
    white-space: nowrap;
}

.promo-card p {
    margin: 0;
    color: var(--muted);
    font-size: 0.82rem;
}

.promo-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    padding: 10px 22px;
    border-radius: 10px;
    text-decoration: none;
    transition: background 0.15s;
}

.promo-cta:hover {
    background: var(--primary-dark);
}
/* Feature banner (iLoveIMG style) */
.feature-banner {
    max-width: 1000px;
    margin: 8px auto;
    padding: 40px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 18px;
    display: flex;
    align-items: center;
    gap: 40px;
    flex-wrap: wrap;
}

.feature-visual {
    flex: 0 0 220px;
    height: 180px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.feature-icon-badge {
    width: 110px;
    height: 110px;
    border-radius: 20px;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.8rem;
    position: absolute;
}

.feature-icon-badge:not(.feature-icon-2) {
    left: 10px;
    top: 10px;
    transform: rotate(-6deg);
}

.feature-icon-2 {
    right: 10px;
    bottom: 10px;
    background: rgba(236, 72, 153, 0.15);
    border-color: rgba(236, 72, 153, 0.3);
    transform: rotate(6deg);
}

.feature-text {
    flex: 1 1 320px;
}

.feature-text h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text);
    margin: 0 0 10px;
}

.feature-text p {
    color: var(--muted);
    font-size: 0.95rem;
    margin: 0 0 20px;
    max-width: 480px;
}

.feature-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
    font-weight: 700;
    font-size: 0.9rem;
    padding: 10px 24px;
    border-radius: 10px;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.feature-cta:hover {
    background: var(--primary);
    color: #fff;
}

@media (max-width: 600px) {
    .feature-banner {
        padding: 24px;
        justify-content: center;
        text-align: center;
    }
    .feature-text p {
        margin-left: auto;
        margin-right: auto;
    }
}

/* Navbar search */
.nav-search {
    display: inline-flex;
    align-items: center;
    margin-left: 20px;
    position: relative;
}

.search-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    transition: color 0.15s;
}

.search-icon-btn:hover {
    color: var(--primary);
}

.nav-search-input {
    width: 0;
    opacity: 0;
    padding: 6px 0;
    margin-left: 0;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--card-bg-2);
    color: var(--text);
    font-size: 0.85rem;
    transition: width 0.2s ease, opacity 0.2s ease, padding 0.2s ease, margin-left 0.2s ease;
}

.nav-search-input.active {
    width: 160px;
    opacity: 1;
    padding: 6px 12px;
    margin-left: 8px;
}

.nav-search-results {
    display: none;
    position: absolute;
    top: 36px;
    left: 8px;
    width: 220px;
    max-height: 300px;
    overflow-y: auto;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4);
    z-index: 1000;
}

.nav-search-results.active {
    display: block;
}

.nav-search-item {
    display: block;
    padding: 10px 14px;
    color: var(--text);
    text-decoration: none;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border);
}

.nav-search-item:last-child {
    border-bottom: none;
}

.nav-search-item:hover {
    background: var(--card-bg-2);
    color: var(--primary);
}

.nav-search-empty {
    padding: 10px 14px;
    color: var(--muted);
    font-size: 0.85rem;
}

@media (max-width: 700px) {
    .nav-search-input.active {
        width: 120px;
    }
    .nav-search-results {
        width: 200px;
        left: -30px;
    }
}