:root {
    /* Night Theme - Deep & Sophisticated */
    --primary: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.4);
    --secondary: #06b6d4;
    --accent: #a855f7;
    
    --bg-main: #020617;
    --bg-card: #0f172a;
    --bg-navbar: rgba(2, 6, 23, 0.7);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    
    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);
    --glass: rgba(255, 255, 255, 0.03);
    --glass-hover: rgba(255, 255, 255, 0.06);
    
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    --radius-sm: 0.5rem;
    --radius-md: 1rem;
    --radius-lg: 1.5rem;
    --radius-xl: 2.5rem;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] {
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --bg-navbar: rgba(248, 250, 252, 0.8);
    --text-main: #0f172a;
    --text-muted: #475569;
    --text-dim: #94a3b8;
    --border: rgba(0, 0, 0, 0.08);
    --border-hover: rgba(0, 0, 0, 0.12);
    --glass: rgba(0, 0, 0, 0.02);
    --glass-hover: rgba(0, 0, 0, 0.04);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-body);
    line-height: 1.6;
    transition: background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1), color 0.4s;
    overflow-x: hidden;
}

/* Background Mesh Gradient */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 0% 0%, rgba(99, 102, 241, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 100% 100%, rgba(6, 182, 212, 0.08) 0%, transparent 40%);
    pointer-events: none;
    z-index: -1;
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    height: 80px;
    background: var(--bg-navbar);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 4rem;
    z-index: 1000;
}

.logo {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-main);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    letter-spacing: -0.02em;
}

.logo i, .logo img {
    color: var(--primary);
    filter: drop-shadow(0 0 10px var(--primary-glow));
    width: 38px;
    height: 38px;
    object-fit: contain;
}

.nav-links {
    display: flex;
    gap: 2.5rem;
    list-style: none;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 1rem;
    transition: color 0.2s, transform 0.2s;
}

.nav-links a:hover {
    color: var(--text-main);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* Container */
.container {
    max-width: 1300px;
    margin: 80px auto 0;
    padding: 6rem 2rem;
}

/* Hero Section */
.hero {
    text-align: center;
    margin-bottom: 6rem;
    position: relative;
}

.hero h1 {
    font-family: var(--font-heading);
    font-size: 4.5rem;
    font-weight: 900;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    letter-spacing: -0.04em;
    background: linear-gradient(to right, #fff, var(--text-muted));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero p {
    font-size: 1.25rem;
    color: var(--text-muted);
    max-width: 700px;
    margin: 0 auto 3rem;
}

.hero-logo {
    width: 140px;
    height: 140px;
    margin-bottom: 2rem;
    filter: drop-shadow(0 0 30px var(--primary-glow));
    animation: floating 3s ease-in-out infinite;
}

@keyframes floating {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* Search Bar */
.search-container {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
    z-index: 10;
}

.search-bar {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 1.25rem 1.5rem 1.25rem 3.5rem;
    color: var(--text-main);
    font-size: 1.1rem;
    box-shadow: var(--shadow-lg), 0 0 0 4px rgba(99, 102, 241, 0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-bar:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--shadow-lg), 0 0 0 6px rgba(99, 102, 241, 0.1);
    transform: translateY(-2px);
}

#tool-search::placeholder {
    color: var(--text-dim);
    font-style: italic;
}

.search-feedback {
    margin-top: 1rem;
    font-size: 0.9rem;
    color: var(--text-dim);
    display: none;
}

.search-icon {
    position: absolute;
    left: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
    font-size: 1.25rem;
    pointer-events: none;
}

/* Tool Grid */
.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
}

.tool-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.25rem;
    text-decoration: none;
    color: inherit;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    position: relative;
    overflow: hidden;
}

.tool-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    opacity: 0;
    transition: opacity 0.4s;
    z-index: 0;
}

.tool-card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: var(--primary);
    box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.3), 0 18px 36px -18px rgba(99, 102, 241, 0.2);
}

.tool-icon {
    width: 56px;
    height: 56px;
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 1.75rem;
    transition: all 0.3s;
    position: relative;
    z-index: 1;
}

.tool-card:hover .tool-icon {
    background: var(--primary);
    color: white;
    transform: rotate(-5deg);
}

.recent-mini {
    padding: 1.25rem;
    gap: 0.75rem;
    border-radius: var(--radius-md);
    background: var(--glass);
}

.recent-mini h3 {
    font-size: 1.1rem;
}

.recent-mini p {
    font-size: 0.85rem;
}

.tool-card h3 {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    position: relative;
    z-index: 1;
    letter-spacing: -0.01em;
}

.tool-card p {
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.5;
    position: relative;
    z-index: 1;
}

/* Tool Details Page */
.tool-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 3.5rem;
    max-width: 1000px;
    margin: 0 auto;
    box-shadow: var(--shadow-lg);
}

.tool-header {
    margin-bottom: 3rem;
    text-align: center;
}

.tool-header h2 {
    font-family: var(--font-heading);
    font-size: 2.75rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 0.75rem;
}

.tool-header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

textarea, select, input[type="text"], input[type="number"] {
    width: 100%;
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    color: var(--text-main);
    font-family: var(--font-mono);
    font-size: 1rem;
    transition: all 0.2s;
    box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.05);
}

textarea:focus, select:focus, input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.btn {
    padding: 1rem 2rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-family: var(--font-heading);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    font-size: 1rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-primary:hover {
    background: #4f46e5;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--primary-glow);
}

.btn-secondary {
    background: var(--glass);
    color: var(--text-main);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--glass-hover);
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

.btn-success {
    background: var(--success);
    color: white;
}

/* Footer */
footer {
    text-align: center;
    padding: 6rem 2rem;
    color: var(--text-dim);
    border-top: 1px solid var(--border);
    margin-top: 6rem;
    font-size: 0.9rem;
}

footer a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

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

/* AdSense Placeholders */
.ad-slot {
    width: 100%;
    background: var(--glass);
    border: 1px dashed var(--border);
    border-radius: var(--radius-md);
    display: block; /* Changed from flex for AdSense compatibility */
    color: var(--text-dim);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: 2rem 0;
    overflow: hidden;
    min-height: 100px;
}

.ad-slot-banner {
    max-width: 970px;
    height: auto; /* Allow height to adjust to ad */
    min-height: 90px;
    margin: 4rem auto;
}

.ad-card {
    background: var(--glass);
    border: 1px dashed var(--border);
    display: block; /* Changed from flex */
    height: auto;
    min-height: 300px; /* Standard square ad height */
}

.ad-label {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 0.7rem;
    color: var(--text-dim);
    background: var(--border);
    padding: 2px 6px;
    border-radius: 4px;
}

/* Responsive */
@media (max-width: 1024px) {
    .navbar { padding: 0 2rem; }
}

@media (max-width: 768px) {
    .navbar { height: 70px; padding: 0 1.5rem; }
    .hero h1 { font-size: 2.75rem; }
    .hero p { font-size: 1.1rem; }
    .container { padding: 4rem 1.5rem; }
    .tool-container { padding: 2rem; }
    .nav-links { display: none; }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.tool-card {
    animation: fadeIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) backwards;
}

.tool-card:nth-child(2) { animation-delay: 0.05s; }
.tool-card:nth-child(3) { animation-delay: 0.1s; }
.tool-card:nth-child(4) { animation-delay: 0.15s; }
.tool-card:nth-child(5) { animation-delay: 0.2s; }
.tool-card:nth-child(6) { animation-delay: 0.25s; }
