:root {
    --primary-color: #4f46e5; /* Indigo 600 */
    --primary-hover: #4338ca; /* Indigo 700 */
    --secondary-color: #0ea5e9; /* Light blue */
    --text-color: #0f172a; /* slate-900 */
    --text-muted: #64748b; /* slate-500 */
    --bg-color: #f8fafc; /* slate-50 */
    --card-bg: #ffffff;
    --border-color: #e2e8f0; /* slate-200 */
    --success-color: #10b981;
    --radius: 1rem; /* 16px */
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --primary-shadow: 0 10px 15px -3px rgba(199, 210, 254, 0.5), 0 4px 6px -4px rgba(199, 210, 254, 0.5); /* shadow-lg shadow-indigo-200 */
    --primary-hover-shadow: 0 10px 15px -3px rgba(165, 180, 252, 0.6), 0 4px 6px -4px rgba(165, 180, 252, 0.6); /* hover:shadow-indigo-300 */
}

:root[data-theme="dark"] {
        --text-color: #f8fafc;
        --text-muted: #94a3b8;
        --bg-color: #0f172a;
        --card-bg: #1e293b;
        --border-color: #334155;
    }

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--text-color);
    background-color: var(--bg-color);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

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

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

/* Header */
.site-header {
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 800; /* extrabold */
    font-size: 1.25rem;
    color: var(--text-color);
    letter-spacing: -0.025em; /* tracking-tight */
}

.main-nav {
    display: flex;
    gap: 1.5rem;
}

.main-nav a {
    color: var(--text-muted);
    font-weight: 500;
    transition: color 0.2s;
}

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

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
}

.mobile-menu {
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem;
    gap: 1rem;
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    z-index: 49;
}

.hidden {
    display: none !important;
}

/* Search */
.search-bar {
    position: relative;
    max-width: 300px;
    width: 100%;
}

.search-bar input {
    width: 100%;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 9999px;
    background: #f1f5f9; /* slate-100 */
    color: var(--text-color);
    outline: none;
    transition: all 0.2s;
    font-size: 0.875rem;
}

.search-bar input:focus {
    box-shadow: 0 0 0 2px var(--primary-color);
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-top: 0.5rem;
    z-index: 60;
}

.search-result-item {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text-color);
    border-bottom: 1px solid var(--border-color);
}

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

.search-result-item:hover {
    background: var(--bg-color);
}

/* Hero Section */
.hero {
    padding: 5rem 0;
}

.hero-title {
    font-size: 3.75rem; /* 6xl */
    font-weight: 900; /* black */
    line-height: 1.1;
    margin-bottom: 1.5rem;
    letter-spacing: -0.05em; /* tracking-tighter */
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto 2.5rem auto;
    line-height: 1.625;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.hero, .hero.text-center {
    text-align: left;
}

@media (min-width: 768px) {
    .hero, .hero.text-center {
        text-align: left;
    }
    .hero-buttons {
        justify-content: flex-start;
    }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-weight: 700; /* bold */
    border-radius: 1rem; /* 2xl */
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    white-space: nowrap;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    box-shadow: var(--primary-shadow);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    color: white;
    box-shadow: var(--primary-hover-shadow);
}

.btn-secondary {
    background-color: var(--card-bg);
    color: #334155; /* slate-700 */
    border: 1px solid var(--border-color);
    font-weight: 700;
}

.btn-secondary:hover {
    background-color: #f8fafc; /* slate-50 */
}

.btn-block {
    width: 100%;
}

/* Cards & Grid */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.tool-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 1rem; /* rounded-2xl */
    padding: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    color: var(--text-color);
}

.tool-card:hover {
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1); /* hover:shadow-md */
    transform: translateY(-2px);
}

.tool-card-icon {
    width: 3.5rem;
    height: 3.5rem;
    background: #e0e7ff; /* indigo-100 */
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin-bottom: 1.25rem;
}

.tool-card h3 {
    margin-bottom: 0.5rem;
    font-size: 1.125rem;
}

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

.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
}

/* Features */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin: 4rem 0;
}

.feature-card {
    text-align: center;
    padding: 2rem;
}

.feature-icon {
    width: 3.5rem;
    height: 3.5rem;
    background: #d1fae5; /* emerald-100 */
    color: #059669; /* emerald-600 */
    border-radius: 9999px; /* full */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin: 0 auto 1rem auto;
}

/* Main Content */
.main-content {
    flex: 1;
    padding-top: 2rem;
    padding-bottom: 4rem;
}

.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mt-5 { margin-top: 2rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success-color); }
.text-primary { color: var(--primary-color); }
.font-bold { font-weight: 700; }
.font-medium { font-weight: 500; }
.text-sm { font-size: 0.875rem; }

/* Tool UI */
.upload-area {
    border: 2px dashed #cbd5e1; /* border-slate-300 */
    border-radius: 1.5rem; /* rounded-3xl */
    padding: 4rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--card-bg); /* bg-white */
}

.upload-area:hover, .upload-area.dragover {
    border-color: #818cf8; /* hover:border-indigo-400 */
    background: #ffffff;
}

.upload-icon-svg {
    color: var(--primary-color);
    margin: 0 auto;
}

.editor-grid {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 2rem;
}

.preview-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.flex-center {
    justify-content: center;
}

.preview-container {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    max-height: 500px;
    overflow: hidden;
}

.checkered-bg {
    background-image: linear-gradient(45deg, #e2e8f0 25%, transparent 25%),
                      linear-gradient(-45deg, #e2e8f0 25%, transparent 25%),
                      linear-gradient(45deg, transparent 75%, #e2e8f0 75%),
                      linear-gradient(-45deg, transparent 75%, #e2e8f0 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

:root[data-theme="dark"] .checkered-bg {
        background-image: linear-gradient(45deg, #334155 25%, transparent 25%),
                          linear-gradient(-45deg, #334155 25%, transparent 25%),
                          linear-gradient(45deg, transparent 75%, #334155 75%),
                          linear-gradient(-45deg, transparent 75%, #334155 75%);
}

#imagePreview {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

.stats-bar {
    display: flex;
    justify-content: space-between;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1rem;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.settings-panel {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.5rem;
}

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

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

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

.badge {
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.range-slider {
    width: 100%;
    accent-color: var(--primary-color);
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--card-bg);
    color: var(--text-color);
    font-family: inherit;
    font-size: 1rem;
}

.setting-hint {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.dimensions-grid {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.input-group {
    flex: 1;
}

.input-group label {
    font-size: 0.875rem;
}

.lock-icon {
    cursor: pointer;
    color: var(--text-muted);
    padding: 0.5rem;
    border-radius: 50%;
    margin-top: 1.25rem;
}

.lock-icon.locked {
    color: var(--primary-color);
    background: rgba(79, 70, 229, 0.1);
}

.preset-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.btn-preset {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-preset:hover {
    background: var(--bg-color);
    border-color: var(--primary-color);
}

/* Footer */
.site-footer {
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    padding: 4rem 0 2rem;
    margin-top: auto;
}

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

.footer-col h3 {
    margin-bottom: 1rem;
    font-size: 1.125rem;
}

.footer-col a {
    display: block;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

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

.copyright {
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.75rem; /* text-xs */
    font-weight: 500;
}

/* SEO Content */
.seo-content {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 2rem;
    margin-top: 2rem;
}

.seo-content h2 {
    margin-top: 2rem;
    margin-bottom: 1rem;
}

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

.seo-content p, .seo-content ul, .seo-content ol {
    margin-bottom: 1rem;
}

.seo-content ul, .seo-content ol {
    padding-left: 1.5rem;
}

.faq-item {
    margin-bottom: 1.5rem;
}

.faq-item h4 {
    margin-bottom: 0.5rem;
}

/* Ads */
.ad-placeholder {
    width: 100%;
    padding: 1rem;
    background: var(--bg-color);
    border: 1px dashed var(--border-color);
    color: var(--text-muted);
    text-align: center;
    border-radius: var(--radius);
    margin: 1.5rem 0;
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Responsive */
@media (max-width: 768px) {
    .header-container {
        flex-wrap: wrap;
    }
    .main-nav {
        display: none;
    }
    .mobile-menu-btn {
        display: block;
    }
    .hero-title {
        font-size: 2rem;
    }
    .editor-grid {
        grid-template-columns: 1fr;
    }
    .footer-grid {
        grid-template-columns: 1fr;
    }
    .search-bar {
        display: none; /* Hide in header on mobile, maybe put in menu */
    }
}

/* Preset Buttons for Cropper */
.preset-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.btn-preset {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    background: var(--bg-color);
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-preset:hover {
    background: #e2e8f0;
}

.btn-preset.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.theme-toggle-btn {
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.theme-toggle-btn:hover {
    background-color: var(--border-color);
}

:root[data-theme="dark"] .sun-icon {
    display: block !important;
}
:root[data-theme="dark"] .moon-icon {
    display: none !important;
}
