:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #ec4899;
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --success: #22c55e;
    --font-main: 'Outfit', sans-serif;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Utils */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.hidden {
    display: none !important;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.3s var(--ease);
}

ul {
    list-style: none;
}

/* Header */
.main-header {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 1rem 0;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.logo span {
    color: var(--primary);
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    font-weight: 500;
    color: var(--text-muted);
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--primary);
}

/* Hero */
.hero-section {
    padding: 4rem 0 2rem;
    text-align: center;
    background: radial-gradient(circle at 50% 0%, rgba(99, 102, 241, 0.15), transparent 70%);
}

.hero-content h1 {
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    letter-spacing: -1px;
}

.highlight {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.intro-text {
    max-width: 600px;
    margin: 0 auto 2rem;
    color: var(--text-muted);
    font-size: 1.125rem;
}

.benefit-list {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 3rem;
    flex-wrap: wrap;
}

.benefit-list li {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.5rem 1rem;
    border-radius: 99px;
    font-size: 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Tool Wrapper */
.tool-wrapper {
    max-width: 900px;
    margin: 0 auto;
    background: var(--bg-card);
    border-radius: 24px;
    border: 1px solid var(--border);
    overflow: hidden;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    min-height: 400px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Upload Area */
.upload-area {
    padding: 4rem 2rem;
    border: 2px dashed var(--border);
    margin: 1.5rem;
    border-radius: 16px;
    transition: all 0.3s var(--ease);
    cursor: pointer;
    background: rgba(255, 255, 255, 0.02);
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
    transform: scale(0.995);
}

.upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.icon-upload {
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.upload-content h3 {
    font-size: 1.5rem;
    font-weight: 600;
}

/* Editor View */
.tool-editor {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.editor-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    height: 100%;
    min-height: 500px;
}

/* Preview Area */
.preview-container {
    background: #111;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    background-image:
        linear-gradient(45deg, #1a1a1a 25%, transparent 25%),
        linear-gradient(-45deg, #1a1a1a 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #1a1a1a 75%),
        linear-gradient(-45deg, transparent 75%, #1a1a1a 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

.img-container {
    max-width: 100%;
    max-height: 100%;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4);
}

.img-container img {
    max-width: 100%;
    max-height: 400px;
    display: block;
    object-fit: contain;
}

.file-info-badge {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: rgba(0, 0, 0, 0.7);
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    color: #fff;
    backdrop-filter: blur(4px);
}

/* Controls Panel */
.controls-panel {
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.control-group h4 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 1rem;
    font-weight: 600;
}

/* Select */
.premium-select {
    width: 100%;
    padding: 12px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}

.premium-select:focus {
    border-color: var(--primary);
}

/* Radio Grid */
.radio-grid {
    display: flex;
    gap: 10px;
}

.radio-card {
    flex: 1;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.radio-card input {
    display: none;
}

.radio-card.active,
.radio-card:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.color-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.color-dot.white {
    background: #fff;
}

.color-dot.black {
    background: #000;
}

.radio-card.custom input[type="color"] {
    width: 24px;
    height: 24px;
    border: none;
    background: none;
    padding: 0;
}

/* Toggles */
.toggles {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.toggle-switch {
    display: flex;
    align-items: center;
    cursor: pointer;
    gap: 10px;
}

.toggle-switch input {
    display: none;
}

.toggle-switch .slider {
    width: 44px;
    height: 22px;
    background: var(--border);
    border-radius: 99px;
    position: relative;
    transition: 0.3s;
}

.toggle-switch .slider::before {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.toggle-switch input:checked+.slider {
    background: var(--primary);
}

.toggle-switch input:checked+.slider::before {
    transform: translateX(22px);
}

.toggle-switch .label {
    font-size: 0.9rem;
}

/* Size Estimate */
.size-estimate {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--text-muted);
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

/* Buttons */
.primary-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
    text-align: center;
    display: block;
}

.primary-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -5px rgba(79, 70, 229, 0.5);
}

.pulse-btn {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(99, 102, 241, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0);
    }
}

.secondary-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Result View */
.result-view {
    text-align: center;
    padding: 3rem;
}

.success-header {
    margin-bottom: 2rem;
}

.success-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.result-display img {
    max-height: 300px;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    margin-bottom: 2rem;
}

.stats-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    margin-bottom: 2rem;
    background: var(--bg-dark);
    padding: 1rem;
    border-radius: 12px;
    display: inline-flex;
    border: 1px solid var(--border);
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-item .label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.stat-item .value {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-main);
}

.download-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 300px;
    margin: 0 auto;
}

/* Loading Overlay */
.loader-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(5px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 50;
    gap: 1rem;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* SEO Content */
.seo-content {
    padding: 4rem 0;
    color: var(--text-muted);
}

.content-block {
    max-width: 800px;
    margin: 0 auto 3rem;
}

.content-block h2 {
    color: var(--text-main);
    margin-bottom: 1rem;
    font-size: 1.8rem;
}

.text-content p {
    margin-bottom: 1rem;
}

/* FAQ */
.faq-section {
    margin-top: 4rem;
}

.faq-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.faq-item {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.faq-item h4 {
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

/* Footer */
.main-footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 3rem 0;
    margin-top: auto;
}

.footer-top {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-brand .logo {
    margin-bottom: 1rem;
    display: block;
}

.footer-col h4 {
    margin-bottom: 1rem;
    color: var(--text-main);
}

.footer-col ul li {
    margin-bottom: 0.5rem;
}

.footer-col ul li a {
    color: var(--text-muted);
}

.footer-col ul li a:hover {
    color: var(--primary);
}

.footer-bottom {
    border-top: 1px solid var(--border);
    padding-top: 1.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .hero-content h1 {
        font-size: 2.5rem;
    }

    .editor-layout {
        grid-template-columns: 1fr;
    }

    .controls-panel {
        border-left: none;
        border-top: 1px solid var(--border);
    }

    .footer-top {
        grid-template-columns: 1fr;
    }

    .nav-links {
        display: none;
        /* Simplify for mobile for now */
    }
}

/* Error Toast */
.error-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #ef4444;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    box-shadow: 0 10px 20px rgba(239, 68, 68, 0.4);
    z-index: 200;
    font-weight: 500;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translate(-50%, 100%);
        opacity: 0;
    }

    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

/* Comparison Table */
.comparison-table-wrapper {
    overflow-x: auto;
    margin: 2rem 0;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
    background: var(--bg-card);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.comparison-table th,
.comparison-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.comparison-table th {
    background: rgba(255, 255, 255, 0.05);
    font-weight: 600;
    color: var(--primary);
}

.comparison-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Internal Links Block */
.internal-links-block {
    margin-top: 5rem;
    padding-top: 3rem;
    border-top: 1px solid var(--border);
}

.internal-links-block h3 {
    margin-bottom: 2rem;
    font-size: 1.5rem;
    color: var(--text-main);
    text-align: center;
}

.link-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.tool-link-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 16px;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.tool-link-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 10px 30px -10px rgba(99, 102, 241, 0.3);
}

.tool-link-card .icon {
    font-size: 2rem;
}

.tool-link-card .meta {
    display: flex;
    flex-direction: column;
}

.tool-link-card .meta strong {
    color: var(--text-main);
    font-size: 1.1rem;
}

.tool-link-card .meta span {
    color: var(--text-muted);
    font-size: 0.9rem;
}