@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Poppins:wght@400;500;600;700&display=swap');

:root {
    /* Color Palette - Light Mode */
    --primary: #6366f1; /* Indigo 500 */
    --primary-hover: #4f46e5;
    --secondary: #64748b; /* Slate 500 */
    --bg-main: #f8fafc; /* Slate 50 */
    --bg-surface: #ffffff;
    --text-main: #0f172a; /* Slate 900 */
    --text-muted: #475569; /* Slate 600 */
    --border: #e2e8f0; /* Slate 200 */
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    /* Color Palette - Dark Mode */
    --bg-main: #0f172a; /* Slate 900 */
    --bg-surface: #1e293b; /* Slate 800 */
    --text-main: #f8fafc; /* Slate 50 */
    --text-muted: #94a3b8; /* Slate 400 */
    --border: #334155; /* Slate 700 */
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
    transition: var(--transition);
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
}

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

ul {
    list-style: none;
}

/* Utilities */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-col { flex-direction: column; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }

/* Sticky Navbar */
.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(var(--bg-surface-rgb), 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    background-color: var(--bg-surface);
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

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

/* Dropdown Menu */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--bg-surface);
    min-width: 200px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    z-index: 1001;
    padding: 0.5rem 0;
    margin-top: 0.5rem;
}

.dropdown-content a {
    color: var(--text-main);
    padding: 0.75rem 1.5rem;
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
}

.dropdown-content a:hover {
    background-color: var(--bg-main);
    color: var(--primary);
}

/* Header Search Box */
.header-search {
    position: relative;
    margin-right: 1.5rem;
}

.header-search-input {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    width: 220px;
    font-size: 0.85rem;
    color: var(--text-main);
    transition: var(--transition);
}

.header-search-input:focus {
    outline: none;
    border-color: var(--primary);
    width: 280px;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.header-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 0 0 10px 10px;
    box-shadow: var(--shadow-lg);
    z-index: 1002;
    margin-top: 5px;
    max-height: 250px;
    overflow-y: auto;
}

.dropdown:hover .dropdown-content {
    display: block;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translate(-50%, 10px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

/* Hero Section */
.hero {
    padding: 6rem 0;
    text-align: center;
    background: radial-gradient(circle at top right, rgba(99, 102, 241, 0.1), transparent);
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--primary), #818cf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

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

.search-input {
    width: 100%;
    padding: 1.2rem 1.5rem 1.2rem 3.5rem;
    border-radius: 50px;
    border: 1px solid var(--border);
    background: var(--bg-surface);
    color: var(--text-main);
    font-size: 1.1rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

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

.search-icon {
    position: absolute;
    left: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

/* Cards */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    padding: 2rem 0;
}

.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

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

.card-icon {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

.category-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    margin-bottom: 1rem;
    width: fit-content;
}

/* Tool UI Elements */
.tool-container {
    max-width: 800px;
    margin: 2rem auto;
    background: var(--bg-surface);
    padding: 3rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-main);
    color: var(--text-main);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    transform: scale(1.05);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
}

.output-area {
    margin-top: 2rem;
    padding: 2rem;
    background: var(--bg-main);
    border-radius: var(--radius);
    border-left: 4px solid var(--primary);
    position: relative;
    min-height: 100px;
}

.copy-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    padding: 0.5rem;
    background: var(--bg-surface);
    border-radius: 4px;
    cursor: pointer;
}

/* Base Styles */
body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
    transition: var(--transition);
    overflow-x: hidden; /* Prevent horizontal scroll */
    width: 100%;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Ad Units - CLS Prevention */
.ad-header { 
    width: 100%; 
    margin: 1rem auto; 
    min-height: auto;
    background: rgba(127, 127, 127, 0.05);
    display: flex; 
    align-items: center; 
    justify-content: center;
    border-radius: 8px;
    overflow: hidden;
}

.ad-footer { 
    width: 100%; 
    margin: 2rem auto; 
    min-height: 250px;
    background: rgba(127, 127, 127, 0.05);
    display: flex; 
    align-items: center; 
    justify-content: center;
    border-radius: 8px;
}

.ad-sidebar { 
    width: 100%; 
    min-height: 300px;
    aspect-ratio: auto;
    background: rgba(127, 127, 127, 0.05);
    display: flex; 
    align-items: center; 
    justify-content: center;
    border-radius: var(--radius);
    margin-bottom: 2rem;
}

.ad-content { 
    width: 100%; 
    margin: 2rem auto; 
    min-height: 250px;
    aspect-ratio: auto;
    background: rgba(127, 127, 127, 0.05);
    display: flex; 
    align-items: center; 
    justify-content: center;
    border-radius: 8px;
}

/* Global Responsive Adjustments */
.flex.gap-4 {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap; /* Critical for responsiveness */
}

@media (max-width: 992px) {
    .flex.gap-4 {
        flex-direction: column;
    }
    
    aside {
        width: 100% !important;
        flex: none !important;
    }
    
    .ad-sidebar {
        min-height: 250px;
        aspect-ratio: auto;
    }
}

@media (max-width: 768px) {
    .hero { padding: 4rem 1rem; }
    .hero h1 { font-size: 2.2rem; }
    .nav-links { display: none; }
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

@media (max-width: 576px) {
    .hero h1 { font-size: 1.8rem; }
    .header-search { display: none; }
    .logo { font-size: 1.2rem; }
    .footer-grid { grid-template-columns: 1fr; }
}

/* Footers */
.main-footer {
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    padding: 4rem 0 2rem;
    margin-top: 4rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 3rem;
    margin-bottom: 3rem;
}

.footer-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1rem;
}

.footer-col h4 {
    margin-bottom: 1.5rem;
}

.footer-col ul li {
    margin-bottom: 0.75rem;
    color: var(--text-muted);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 768px) {
    .nav-links { display: none; }
    .hero h1 { font-size: 2rem; }
    .ad-sidebar { display: none; }
}

/* Theme Toggle */
.theme-toggle {
    background: none;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    font-size: 1.25rem;
    transition: var(--transition);
}

.theme-toggle:hover {
    color: var(--primary);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--primary);
    color: white;
    padding: 1rem 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    transform: translateY(100px);
    transition: transform 0.3s ease-in-out;
    z-index: 10000;
}

/* Desktop Fixed Ads */
.desktop-ad-skyscraper {
    position: fixed;
    right: 20px;
    top: 100px;
    width: 300px;
    height: 600px;
    z-index: 1000;
    display: none;
}

@media (min-width: 1400px) {
    .desktop-ad-skyscraper {
        display: block;
    }
}
