/* =====================================================
   ToollanceHub – Professional Stylesheet v2.0
   Dark-first, Light mode supported, Modern UI
   ===================================================== */

/* ─────────────────── CSS VARIABLES (Dark) ─────────── */
:root {
    --primary: #6C63FF;
    --primary-dark: #5A52D5;
    --primary-light: #8B85FF;
    --secondary: #00D4AA;
    --accent: #FF6B6B;
    --warning: #F59E0B;
    --success: #10B981;

    --bg-dark: #0D0D1A;
    --bg-card: #16162A;
    --bg-surface: #1E1E35;
    --bg-input: #0D0D1A;

    --text-primary: #F0F0FF;
    --text-secondary: #A0A0C0;
    --text-muted: #6060A0;

    --border: rgba(108, 99, 255, 0.18);
    --border-hover: rgba(108, 99, 255, 0.45);
    --glass: rgba(255, 255, 255, 0.03);
    --glass-strong: rgba(255, 255, 255, 0.07);

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 48px rgba(108, 99, 255, 0.2);
    --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.5);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;

    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);

    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-heading: 'Outfit', 'Inter', sans-serif;
    --header-height: 68px;
}

/* ─────────────────── Light Mode ─────────────────── */
[data-theme="light"] {
    --bg-dark: #F6F7FB;
    --bg-card: #FFFFFF;
    --bg-surface: #F0F2FE;
    --bg-input: #FFFFFF;
    --text-primary: #111128;
    --text-secondary: #4A4B72;
    --text-muted: #7B7CA8;
    --border: rgba(108, 99, 255, 0.12);
    --border-hover: rgba(108, 99, 255, 0.35);
    --glass: rgba(108, 99, 255, 0.03);
    --glass-strong: rgba(108, 99, 255, 0.06);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 40px rgba(108, 99, 255, 0.12);
    --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.12);
}

/* ─────────────────── Reset ─────────────────── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-body);
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.65;
    min-height: 100vh;
    overflow-x: hidden;
    transition: background var(--transition), color var(--transition);
    /* Anti-cloning: Prevent text selection globally */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Allow normal selection inside form inputs and textareas */
input,
textarea,
[contenteditable="true"],
.allow-select {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* Prevent image dragging */
img {
    -webkit-user-drag: none;
    user-drag: none;
    pointer-events: none;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(ellipse at 15% 15%, rgba(108, 99, 255, 0.07) 0%, transparent 55%),
        radial-gradient(ellipse at 85% 85%, rgba(0, 212, 170, 0.04) 0%, transparent 55%);
}

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 3px;
}

a {
    color: var(--primary-light);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--secondary);
}

img {
    max-width: 100%;
    height: auto;
}

/* ─────────────────── Container ─────────────────── */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ─────────────────── HEADER ─────────────────── */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: var(--header-height);
    background: rgba(13, 13, 26, 0.88);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    transition: all var(--transition);
}

[data-theme="light"] .site-header {
    background: rgba(255, 255, 255, 0.9);
}

.site-header.scrolled {
    box-shadow: var(--shadow);
    border-bottom-color: var(--border-hover);
}

.navbar {
    display: flex;
    align-items: center;
    height: var(--header-height);
    gap: 8px;
    position: relative;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-heading);
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--text-primary);
    white-space: nowrap;
    flex-shrink: 0;
}

.brand-icon {
    font-size: 1.5rem;
}

.brand-accent {
    color: var(--secondary);
}

/* ─── Nav Menu ─── */
.nav-menu {
    display: flex;
    list-style: none;
    gap: 2px;
    align-items: center;
    margin-left: auto;
}

.nav-menu>li>a {
    display: block;
    padding: 8px 14px;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    white-space: nowrap;
    position: relative;
}

.nav-menu>li>a:hover,
.nav-menu>li>a.active {
    color: var(--text-primary);
    background: var(--glass-strong);
}

.nav-menu>li>a.active::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    right: 50%;
    height: 2px;
    background: var(--primary);
    border-radius: 2px;
    left: 16px;
    right: 16px;
}

/* ─── Dropdown ─── */
.nav-dropdown {
    position: relative;
}

.dropdown-toggle {
    cursor: pointer;
    display: flex !important;
    align-items: center;
    gap: 6px;
}

.dropdown-arrow {
    font-size: 0.7rem;
    transition: transform var(--transition);
}

.nav-dropdown:hover .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    min-width: 220px;
    box-shadow: var(--shadow-xl);
    list-style: none;
    padding: 8px;
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all var(--transition);
}

/* Invisible bridge to prevent hover loss when moving mouse from toggle to menu */
.dropdown-menu::before {
    content: '';
    position: absolute;
    top: -15px;
    left: 0;
    width: 100%;
    height: 15px;
    background: transparent;
}

.nav-dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
    transform: translateX(-50%) translateY(0);
}

.dropdown-menu li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: all var(--transition);
}

.dropdown-menu li a:hover {
    background: var(--glass-strong);
    color: var(--primary-light);
    transform: translateX(4px);
}

/* ─── Nav Controls ─── */
.nav-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 12px;
    flex-shrink: 0;
}

.theme-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--glass-strong);
    border: 1px solid var(--border);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all var(--transition);
}

.theme-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    transform: rotate(20deg);
}

/* ─── Hamburger ─── */
.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
}

.menu-toggle:hover {
    background: var(--glass);
}

.menu-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all var(--transition);
}

.menu-toggle.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.menu-toggle.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ─────────────────── MAIN ─────────────────── */
.main-content {
    min-height: 100vh;
    padding-top: calc(var(--header-height) + 24px);
    padding-bottom: 64px;
    position: relative;
    z-index: 1;
}

/* ─── Tool Layout ─── */
.tool-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 28px;
    align-items: start;
    padding-top: 8px;
    width: 100%;
}

.tool-main {
    min-width: 0;
    width: 100%;
}

/* ─── Tool Sidebar always right ─── */
.tool-sidebar {
    position: sticky;
    top: calc(var(--header-height) + 24px);
    width: 300px;
    min-width: 300px;
}

/* ─── Tool Header ─── */
.tool-header h1 {
    color: var(--text-primary);
}

/* Make emoji icon in h1 high visibility in both modes */
:root .tool-header h1 .tool-icon-emoji,
.tool-header h1 .emoji {
    font-style: normal;
}

/* ─────────────────── BUTTONS ─────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 26px;
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: 0 4px 20px rgba(108, 99, 255, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    color: #fff;
    box-shadow: 0 8px 30px rgba(108, 99, 255, 0.55);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary), #009980);
    color: #fff;
    box-shadow: 0 4px 20px rgba(0, 212, 170, 0.3);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    color: #fff;
}

.btn-outline {
    background: transparent;
    border-color: var(--border-hover);
    color: var(--primary-light);
}

.btn-outline:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.btn-danger {
    background: var(--accent);
    color: #fff;
    border: none;
}

.btn-danger:hover {
    transform: translateY(-2px);
    opacity: 0.9;
}

.btn-sm {
    padding: 7px 16px;
    font-size: 0.85rem;
}

.btn-lg {
    padding: 14px 36px;
    font-size: 1.05rem;
    border-radius: var(--radius-md);
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ─────────────────── CARDS ─────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    transition: all var(--transition);
}

.card:hover {
    border-color: var(--border-hover);
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

/* ─────────────────── TOOL CARDS ─────────────────── */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 18px;
    margin-top: 24px;
}

.tool-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 20px 24px;
    text-align: center;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: var(--text-primary);
    transition: all var(--transition-slow);
    position: relative;
    overflow: hidden;
}

.tool-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(108, 99, 255, 0.06), transparent);
    opacity: 0;
    transition: opacity var(--transition);
}

.tool-card:hover {
    border-color: var(--primary);
    color: var(--text-primary);
    transform: translateY(-6px);
    box-shadow: 0 16px 40px rgba(108, 99, 255, 0.2);
}

.tool-card:hover::before {
    opacity: 1;
}

.tool-card .tool-icon {
    font-size: 2.4rem;
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface);
    border-radius: 18px;
    border: 1px solid var(--border);
    transition: all var(--transition);
}

.tool-card:hover .tool-icon {
    background: rgba(108, 99, 255, 0.12);
    border-color: var(--primary);
    transform: scale(1.08) rotate(-3deg);
}

.tool-card .tool-name {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.98rem;
    line-height: 1.3;
    transition: color var(--transition);
}

.tool-card:hover .tool-name {
    color: var(--primary-light);
}

.tool-card .tool-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
    flex-grow: 1;
}

.tool-card .tool-category {
    font-size: 0.72rem;
    padding: 3px 10px;
    background: rgba(108, 99, 255, 0.12);
    border-radius: 20px;
    color: var(--primary-light);
    font-weight: 500;
    transition: all var(--transition);
}

.tool-card:hover .tool-category {
    background: var(--primary);
    color: #fff;
}

/* ─────────────────── HERO SECTION ─────────────────── */
.hero {
    text-align: center;
    padding: 72px 0 56px;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 20px;
    background: rgba(108, 99, 255, 0.12);
    border: 1px solid rgba(108, 99, 255, 0.3);
    border-radius: 50px;
    font-size: 0.85rem;
    color: var(--primary-light);
    font-weight: 500;
    margin-bottom: 28px;
    animation: fadeInDown 0.6s ease;
}

.hero h1 {
    font-family: var(--font-heading);
    font-size: clamp(2rem, 5vw, 3.6rem);
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 20px;
    animation: fadeInUp 0.7s ease 0.1s both;
}

.gradient-text {
    background: linear-gradient(135deg, var(--primary-light), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero>p {
    font-size: 1.15rem;
    color: var(--text-secondary);
    max-width: 580px;
    margin: 0 auto 40px;
    animation: fadeInUp 0.7s ease 0.2s both;
}

.hero-search {
    max-width: 600px;
    margin: 0 auto 48px;
    /* NOTE: No animation here — CSS animations create a stacking context
       that would trap the absolutely-positioned dropdown inside.
       The hero-badge and h1 animations are enough visual flair. */
    position: relative;
    z-index: 50;
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 60px;
    padding: 12px 8px 12px 24px;
    gap: 12px;
    transition: all var(--transition);
}

.search-box:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(108, 99, 255, 0.15);
}

.search-box input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--text-primary);
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.search-box button {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    color: #fff;
    padding: 11px 24px;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-body);
    transition: all var(--transition);
}

.search-box button:hover {
    transform: scale(1.04);
    box-shadow: 0 4px 20px rgba(108, 99, 255, 0.4);
}

.hero-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
    animation: fadeInUp 0.7s ease 0.4s both;
    position: relative;
    z-index: 1;
    /* Always below .hero-search (z-index:50) */
}

.hero-stat {
    text-align: center;
}

.hero-stat .stat-number {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary-light);
}

.hero-stat .stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.hero-stat-divider {
    width: 1px;
    height: 40px;
    background: var(--border);
}

/* ─────────────────── SECTION HEADERS ─────────────────── */
.section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 12px;
}

.section-title {
    font-family: var(--font-heading);
    font-size: 1.55rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.title-dot {
    width: 10px;
    height: 10px;
    background: var(--primary);
    border-radius: 50%;
    display: inline-block;
}

.section-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 6px;
}

/* ─────────────────── CATEGORY TABS ─────────────────── */
.category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}

.category-tab {
    padding: 7px 18px;
    border-radius: 50px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font-body);
}

.category-tab:hover,
.category-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* ─────────────────── CATEGORY CARDS ─────────────────── */
.category-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px 28px;
    text-decoration: none;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    transition: all var(--transition-slow);
    position: relative;
    overflow: hidden;
}

.category-card:hover {
    border-color: var(--primary);
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    color: var(--text-primary);
}

.category-card .cat-icon {
    font-size: 2.8rem;
    margin-bottom: 18px;
    display: block;
    transition: transform var(--transition);
}

.category-card:hover .cat-icon {
    transform: scale(1.1) rotate(-5deg);
}

.category-card .cat-title {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.category-card .cat-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 20px;
    flex-grow: 1;
}

.category-card .cat-cta {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary-light);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: gap var(--transition);
}

.category-card:hover .cat-cta {
    gap: 14px;
}

/* ─────────────────── FEATURES GRID ─────────────────── */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
    margin-top: 24px;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 24px;
    transition: all var(--transition);
}

.feature-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.feature-icon {
    font-size: 2.2rem;
    margin-bottom: 16px;
}

.feature-card h3 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.feature-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ─────────────────── PAGE HERO ─────────────────── */
.page-hero {
    text-align: center;
    padding: 48px 0 40px;
}

.page-hero h1 {
    font-family: var(--font-heading);
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    font-weight: 800;
    margin-bottom: 14px;
}

.page-hero p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 560px;
    margin: 0 auto;
}

/* ─────────────────── TOOL PAGE HEADER ─────────────────── */
.tool-header {
    margin-bottom: 28px;
}

.tool-breadcrumb {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tool-breadcrumb a {
    color: var(--text-muted);
}

.tool-breadcrumb a:hover {
    color: var(--primary-light);
}

.tool-header h1 {
    font-family: var(--font-heading);
    font-size: clamp(1.5rem, 3vw, 2.1rem);
    font-weight: 800;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.tool-header p {
    color: var(--text-secondary);
    font-size: 1rem;
    max-width: 600px;
}

/* ─────────────────── TOOL BOX ─────────────────── */
.tool-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    margin-bottom: 24px;
}

/* ─────────────────── UPLOAD AREA ─────────────────── */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 48px 32px;
    text-align: center;
    cursor: pointer;
    background: var(--bg-surface);
    transition: all var(--transition);
    position: relative;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary);
    background: rgba(108, 99, 255, 0.05);
}

.upload-zone .upload-icon {
    font-size: 3.5rem;
    margin-bottom: 16px;
}

.upload-zone h3 {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    margin-bottom: 8px;
}

.upload-zone p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.upload-zone small {
    display: block;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 12px;
}

/* ─────────────────── UPLOAD PREVIEW ─────────────────── */
.preview-stage {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    background: var(--bg-surface);
    margin-bottom: 20px;
}

.preview-image-wrap {
    text-align: center;
    margin-bottom: 20px;
}

.preview-image-wrap img {
    max-width: 100%;
    max-height: 320px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
}

.preview-file-info {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
}

.preview-file-icon {
    font-size: 2.5rem;
}

.preview-file-details h4 {
    font-weight: 600;
    margin-bottom: 4px;
}

.preview-file-details p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.preview-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* ─────────────────── PROCESSING OVERLAY ─────────────────── */
.processing-indicator {
    text-align: center;
    padding: 24px;
    color: var(--text-secondary);
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    margin-top: 16px;
}

.processing-indicator .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ─────────────────── SUCCESS / DOWNLOAD ─────────────────── */
.download-stage {
    text-align: center;
    padding: 32px;
    background: rgba(16, 185, 129, 0.07);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: var(--radius-md);
}

.download-stage .success-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.download-stage h3 {
    color: var(--success);
    font-family: var(--font-heading);
    font-size: 1.25rem;
    margin-bottom: 20px;
}

.download-btn-wrap {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ─────────────────── FORMS ─────────────────── */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    background: var(--bg-input);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: all var(--transition);
    outline: none;
    appearance: none;
    -webkit-appearance: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.15);
}

.form-control::placeholder {
    color: var(--text-muted);
}

textarea.form-control {
    resize: vertical;
    min-height: 150px;
    line-height: 1.65;
}

select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M0 0l6 8 6-8z' fill='%236060A0'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
    cursor: pointer;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

input[type="range"] {
    width: 100%;
    accent-color: var(--primary);
    cursor: pointer;
    height: 6px;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

.checkbox-item:hover {
    color: var(--text-primary);
}

/* ─────────────────── RESULT BOX ─────────────────── */
.result-box {
    background: var(--bg-surface);
    border: 2px solid var(--primary);
    border-radius: var(--radius);
    padding: 24px;
    margin-top: 24px;
    display: none;
    animation: fadeInUp 0.4s ease;
}

.result-box.show {
    display: block;
}

.result-title {
    font-family: var(--font-heading);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 14px;
}

.result-value {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--secondary);
}

.result-detail {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 6px;
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
}

.result-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    text-align: center;
}

.result-item .label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.result-item .value {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--secondary);
}

/* ─────────────────── PROGRESS BAR ─────────────────── */
.progress {
    height: 8px;
    background: var(--bg-surface);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 4px;
    transition: width 0.4s ease;
}

/* ─────────────────── SIDEBAR ─────────────────── */
.sidebar-widget {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
}

.sidebar-title {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-tools-list {
    list-style: none;
}

.sidebar-tools-list li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: all var(--transition);
    border: 1px solid transparent;
}

.sidebar-tools-list li a:hover {
    color: var(--text-primary);
    background: var(--glass-strong);
    border-color: var(--border);
    transform: translateX(4px);
}

.sidebar-tool-icon {
    font-size: 1.1rem;
    width: 26px;
    flex-shrink: 0;
    text-align: center;
}

/* ─────────────────── AD PLACEHOLDERS ─────────────────── */
.ad-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 90px;
    background: var(--glass);
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.75rem;
    text-align: center;
}

.sidebar-ad {
    height: 250px;
}

/* ─────────────────── TOAST ─────────────────── */
.toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 24px;
    font-size: 0.95rem;
    font-weight: 500;
    box-shadow: var(--shadow-xl);
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
    white-space: nowrap;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ─────────────────── SEO BOX ─────────────────── */
.seo-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 36px;
    margin-top: 32px;
}

.seo-box h2 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 12px;
    margin-top: 28px;
    color: var(--text-primary);
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.seo-box h2:first-child {
    margin-top: 0;
}

.seo-box p {
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 12px;
    font-size: 0.95rem;
}

.seo-box ul,
.seo-box ol {
    margin-left: 24px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.seo-box ul li,
.seo-box ol li {
    margin-bottom: 8px;
    line-height: 1.6;
    font-size: 0.95rem;
}

.faq-item {
    margin-bottom: 20px;
    padding: 20px;
    background: var(--bg-surface);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.faq-item h3 {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--primary-light);
}

.faq-item p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 0;
}

/* ─────────────────── IMAGE TOOLS STYLES ─────────────────── */
.image-drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    background: var(--bg-surface);
    transition: all var(--transition);
}

.image-drop-zone:hover,
.image-drop-zone.dragover {
    border-color: var(--primary);
    background: rgba(108, 99, 255, 0.05);
}

.drop-icon {
    font-size: 3.5rem;
    margin-bottom: 14px;
}

.image-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 14px;
}

.image-preview-item {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    position: relative;
}

.image-preview-item img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
}

/* ─────────────────── COPY BUTTON ─────────────────── */
.copy-btn {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    font-family: var(--font-body);
    transition: all var(--transition);
}

.copy-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* ─────────────────── FOOTER ─────────────────── */
.site-footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 64px 0 32px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 48px;
    margin-bottom: 48px;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.footer-brand p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 20px;
    max-width: 280px;
}

.footer-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.badge {
    padding: 4px 12px;
    background: rgba(108, 99, 255, 0.12);
    border: 1px solid rgba(108, 99, 255, 0.2);
    border-radius: 50px;
    font-size: 0.78rem;
    color: var(--primary-light);
    font-weight: 500;
}

.footer-links h4 {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 20px;
}

.footer-links ul {
    list-style: none;
}

.footer-links ul li {
    margin-bottom: 10px;
}

.footer-links ul li a {
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: all var(--transition);
}

.footer-links ul li a:hover {
    color: var(--primary-light);
    transform: translateX(4px);
    display: inline-block;
}

.footer-bottom {
    border-top: 1px solid var(--border);
    padding-top: 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.footer-bottom p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.footer-bottom a {
    color: var(--text-secondary);
}

.footer-bottom a:hover {
    color: var(--primary-light);
}

/* ─────────────────── ANIMATIONS ─────────────────── */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ─────────────────── RESPONSIVE ─────────────────── */
@media (max-width: 768px) {
    .tool-layout {
        grid-template-columns: 1fr;
    }

    .tool-sidebar {
        position: static;
    }

    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 32px;
    }
}

@media (max-width: 768px) {
    :root {
        --header-height: 62px;
    }

    .container {
        padding: 0 16px;
    }

    .nav-menu {
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        bottom: 0;
        background: var(--bg-card);
        flex-direction: column;
        align-items: stretch;
        padding: 24px;
        gap: 4px;
        overflow-y: auto;
        transform: translateX(100%);
        transition: transform var(--transition);
        z-index: 999;
        border-top: 1px solid var(--border);
    }

    .nav-menu.open {
        transform: translateX(0);
    }

    .nav-menu>li>a {
        padding: 12px 16px;
        font-size: 1rem;
    }

    .nav-dropdown .dropdown-menu {
        position: static;
        transform: none;
        opacity: 1;
        visibility: visible;
        box-shadow: none;
        background: var(--bg-surface);
        border: none;
        display: none;
        border-radius: var(--radius-sm);
    }

    .nav-dropdown.open .dropdown-menu {
        display: block;
    }

    .menu-toggle {
        display: flex;
    }

    .hero {
        padding: 48px 0 40px;
    }

    .hero-stats {
        gap: 20px;
    }

    .hero-stat-divider {
        display: none;
    }

    .tools-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 14px;
    }

    .tool-box {
        padding: 20px;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 28px;
    }

    .seo-box {
        padding: 24px;
    }
}

@media (max-width: 480px) {
    .tools-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .tool-card {
        padding: 20px 14px 18px;
    }

    .hero h1 {
        font-size: 1.8rem;
    }

    .btn-lg {
        padding: 12px 28px;
        font-size: 0.97rem;
    }
}

/* ─────────────────── HEADER SEARCH ─────────────────── */
.header-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.header-search-icon {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 7px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    transition: all var(--transition);
}

.header-search-icon:hover {
    background: var(--bg-surface);
    color: var(--primary-light);
}

.header-search-box {
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    width: 340px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xl);
    z-index: 9999;
    overflow: hidden;
}

.header-search-box input {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--text-primary);
    padding: 14px 44px 14px 16px;
    border-bottom: 1px solid var(--border);
}

.header-search-box input::placeholder {
    color: var(--text-muted);
}

.header-search-clear {
    position: absolute;
    right: 12px;
    top: 12px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 2px 6px;
    border-radius: 4px;
}

.header-search-clear:hover {
    color: var(--text-primary);
    background: var(--bg-surface);
}

.header-search-results {
    max-height: 360px;
    overflow-y: auto;
    padding: 8px 0;
}

.header-search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    text-decoration: none;
    color: var(--text-primary);
    transition: background var(--transition);
}

.header-search-result-item:hover,
.header-search-result-item.active {
    background: var(--bg-surface);
}

.hsr-icon {
    font-size: 1.3rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(108, 99, 255, 0.1);
    border-radius: 8px;
    flex-shrink: 0;
}

.hsr-text strong {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 1px;
}

.hsr-text span {
    font-size: 0.77rem;
    color: var(--text-muted);
}

.hsr-empty {
    padding: 20px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.88rem;
}

.hsr-count {
    padding: 8px 16px 4px;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-top: 1px solid var(--border);
}

@media (max-width: 768px) {
    .header-search-box {
        position: fixed;
        left: 0;
        right: 0;
        top: 56px;
        width: 100%;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
}

/* ─────────────────── HERO SEARCH SUGGESTIONS ─────────────────── */
.hero-search-inner {
    position: relative;
    width: 100%;
    z-index: 100;
    /* Creates stacking context above .hero-stats */
}

/* Also lift the outer hero-search wrap */
.hero-search {
    position: relative;
    z-index: 100;
}

.hero-search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    /* Solid opaque background to prevent content bleed-through */
    background: #1a1a2e;
    background: var(--bg-card, #1a1a2e);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
    z-index: 9999;
    overflow: hidden;
    max-height: 420px;
    overflow-y: auto;
    text-align: left;
    isolation: isolate;
}

[data-theme="light"] .hero-search-results {
    background: #ffffff;
    background: var(--bg-card, #ffffff);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18);
}

.hero-search-results .hsr-empty {
    padding: 24px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.92rem;
}

.hero-search-results .hsr-count {
    padding: 10px 20px 4px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border);
}

.hero-search-results .header-search-result-item {
    padding: 12px 20px;
    gap: 14px;
}

.hero-search-results .header-search-result-item:hover,
.hero-search-results .header-search-result-item.active {
    background: var(--bg-surface);
}

.hero-search-results .hsr-icon {
    width: 38px;
    height: 38px;
    font-size: 1.4rem;
    border-radius: 10px;
}

.hero-search-results .hsr-text strong {
    font-size: 0.95rem;
}

.hero-search-results .hsr-text span {
    font-size: 0.82rem;
}

/* Quick tags */
.hero-quick-tags {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 14px;
    justify-content: center;
}

.quick-tag-label {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 500;
}

.quick-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 50px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: all var(--transition);
}

.quick-tag:hover {
    background: rgba(108, 99, 255, 0.15);
    border-color: var(--primary);
    color: var(--primary-light);
    transform: translateY(-1px);
}

[data-theme="light"] .quick-tag {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .quick-tag:hover {
    background: rgba(108, 99, 255, 0.08);
    border-color: var(--primary);
}

/* ─────────────────── TOAST NOTIFICATIONS ─────────────────── */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-surface);
    color: var(--text-primary);
    padding: 12px 24px;
    border-radius: 50px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 10000;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-weight: 500;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: none;
    opacity: 0;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-success {
    color: var(--success);
    border-color: var(--success);
}

.toast-danger {
    color: var(--accent);
    border-color: var(--accent);
}

/* ─────────────────── SPINNER ─────────────────── */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(108, 99, 255, 0.2);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}