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

:root {
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body[data-theme="dark"] {
    --primary: #4F46E5; /* Indigo 600 - Match Stitch primary */
    --primary-hover: #4338CA;
    --secondary: #94A3B8; /* Slate 400 */
    --bg-dark: #0f172a; /* Slate 900 */
    --bg-darker: #020617; /* Slate 950 */
    --bg-card: rgba(30, 41, 59, 0.6); /* Slate 800 with transparency */
    --border-color: rgba(255, 255, 255, 0.1);
    --text-primary: #F8FAFC;
    --text-secondary: #94A3B8;
}

body[data-theme="blue"] {
    --primary: #0284c7; /* Sky 600 */
    --primary-hover: #0369a1; /* Sky 700 */
    --secondary: #bae6fd;
    --bg-dark: #0c4a6e; /* Sky 900 */
    --bg-darker: #082f49; /* Sky 950 */
    --bg-card: rgba(15, 64, 97, 0.6); 
    --border-color: rgba(255, 255, 255, 0.15);
    --text-primary: #F0F9FF;
    --text-secondary: #bae6fd;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', sans-serif; }
html { scroll-behavior: smooth; }

/* Tailwind-like Utilities used in HTML */
.container { max-width: 1200px; margin: 0 auto; padding: 0 5vw; }
.relative { position: relative; }
.absolute { position: absolute; }
.z-10 { z-index: 10; }
.w-full { width: 100%; }
.h-full { height: 100%; }
.flex { display: flex; }
.grid { display: grid; }
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.mx-auto { margin-left: auto; margin-right: auto; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mb-12 { margin-bottom: 3rem; }
.pt-10 { padding-top: 2.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.pb-3 { padding-bottom: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-6 { gap: 1.5rem; }
.flex-1 { flex: 1; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.block { display: block; }
.inline-block { display: inline-block; }
.flex-wrap { flex-wrap: wrap; }


.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }
.text-primary { color: var(--primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-white { color: #fff !important; }
.bg-primary { background-color: var(--primary) !important; }
.border-primary { border-color: var(--primary) !important; }

.rounded-lg { border-radius: 0.5rem; }
.rounded-xl { border-radius: 0.75rem; }
.rounded-2xl { border-radius: 1rem; }
.rounded-3xl { border-radius: 1.5rem; }
.shadow-sm { box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); }
.shadow-md { box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); }
.shadow-lg { box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1); }
.shadow-2xl { box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); }
.overflow-hidden { overflow: hidden; }
.aspect-\[16\/9\] { aspect-ratio: 16 / 9; }
.bg-black { background-color: #000; }
.bg-black\/20 { background-color: rgba(0,0,0,0.2); }
.bg-black\/30 { background-color: rgba(0,0,0,0.3); }
.bg-black\/50 { background-color: rgba(0,0,0,0.5); }
.border-slate-700 { border-color: rgba(255,255,255,0.15); }
.border-b { border-bottom-width: 1px; }

/* Base App Colors & Typography */
body { background-color: var(--bg-dark); color: var(--text-primary); transition: background-color 0.3s ease; }
h1, h2, h3, h4 { letter-spacing: -0.025em; line-height: 1.2; }
a { color: inherit; text-decoration: none; }
.section-spacing { padding: 5rem 0; }
@media (min-width: 768px) { .section-spacing { padding: 8rem 0; } }

.bg-darker { background-color: var(--bg-darker); }
.glass-panel { background: var(--bg-card); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid var(--border-color); }
.glass-panel-light { background: rgba(255,255,255,0.03); border: 1px solid var(--border-color); backdrop-filter: blur(5px); }

/* Background Glows */
.background-radial { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -1; overflow: hidden; }
.bg-glow-1 { position: absolute; top: -15%; left: 10%; width: 50vw; height: 50vw; background: var(--primary); opacity: 0.15; border-radius: 50%; filter: blur(100px); }
.bg-glow-2 { position: absolute; bottom: -10%; right: 5%; width: 40vw; height: 40vw; background: var(--secondary); opacity: 0.10; border-radius: 50%; filter: blur(80px); }

/* Animations */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { 100% { transform: rotate(360deg); } }
.animate-fade-in-up { animation: fadeInUp 0.6s ease-out forwards; opacity: 0; }
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }

/* Navbar */
.navbar { position: fixed; top: 0; left: 0; width: 100%; padding: 1rem 0; background: rgba(0, 0, 0, 0.4); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-bottom: 1px solid var(--border-color); z-index: 50; }
.nav-container { display: flex; justify-content: space-between; align-items: center; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.25rem; color: #fff; cursor: pointer; }
.logo-icon-bg { width: 32px; height: 32px; background: var(--primary); border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.logo-icon { width: 18px; height: 18px; color: #fff; }
.nav-links { display: flex; gap: 2rem; }
.nav-links a { font-size: 0.875rem; font-weight: 500; color: var(--text-secondary); text-decoration: none; transition: var(--transition); }
.nav-links a:hover { color: #fff; }

.auth-actions { display: flex; align-items: center; gap: 1rem; }
.nav-btn-link { background: none; border: none; font-size: 0.875rem; font-weight: 600; color: var(--text-secondary); cursor: pointer; transition: var(--transition); }
.nav-btn-link:hover { color: #fff; }
.theme-toggle { padding: 6px; border-radius: 8px; background: transparent; }
.theme-toggle:hover { background: rgba(255,255,255,0.1); }
.icon-small { width: 18px; height: 18px; }

/* User Profile Mini */
.user-profile { display: flex; align-items: center; gap: 0.75rem; }
.avatar { width: 36px; height: 36px; background: rgba(255,255,255,0.05); border: 1px solid var(--border-color); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--primary); }
.avatar svg { width: 20px; height: 20px; }
.user-name { font-size: 0.875rem; font-weight: 600; }
.btn-logout { background: rgba(239, 68, 68, 0.1); color: #ef4444; border: 1px solid transparent; padding: 8px; border-radius: 8px; cursor: pointer; transition: var(--transition); display: flex; align-items: center; justify-content: center; }
.btn-logout:hover { background: #ef4444; color: white; }

/* Buttons */
.btn-primary-small, .btn-primary, .btn-secondary, .btn-secondary-light, .btn-outline { font-family: 'Inter', sans-serif; cursor: pointer; transition: var(--transition); display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: none; border-radius: 9999px; }
.btn-primary-small { background: var(--primary); color: white; font-weight: 600; font-size: 0.875rem; padding: 0.5rem 1.25rem; }
.btn-primary { background: var(--primary); color: white; font-weight: 600; padding: 0.75rem 1.5rem; }
.btn-primary:hover, .btn-primary-small:hover { background: var(--primary-hover); transform: translateY(-1px); }
.btn-secondary { background: #fff; color: var(--bg-dark); padding: 0.875rem 2rem; }
.btn-secondary:hover { background: var(--text-secondary); }
.btn-secondary-light { background: rgba(255,255,255,0.1); color: #fff; padding: 0.875rem 2rem; border-radius: 0.75rem; }
.btn-secondary-light:hover { background: rgba(255,255,255,0.15); border: 1px solid var(--primary); }
.btn-outline { background: transparent; color: white; border: 1px solid var(--border-color); padding: 0.75rem 1.5rem; border-radius: 0.75rem; font-weight: 600; }
.btn-outline:hover { background: rgba(255,255,255,0.05); }

/* Hero */
.hero { padding-top: 10rem; }
.hero-title { font-size: 3rem; margin-bottom: 1.5rem; }
@media (min-width: 768px) { .hero-title { font-size: 4rem; } }
.hero-subtitle { font-size: 1.125rem; color: var(--text-secondary); max-width: 600px; margin: 0 auto 3rem; }

/* Upload Area */
.upload-wrapper { max-width: 700px; margin: 0 auto; }
.upload-box { border: 2px dashed rgba(255,255,255,0.15); border-radius: 1.5rem; padding: 4rem 2rem; cursor: pointer; transition: var(--transition); }
.upload-box:hover { border-color: var(--primary); background: rgba(255,255,255,0.02); }
.upload-icon-large { width: 4rem; height: 4rem; background: var(--primary); color: white; border-radius: 1rem; display: flex; justify-content: center; align-items: center; margin-bottom: 1rem; transition: transform 0.3s; }
.upload-box:hover .upload-icon-large { transform: scale(1.05) translateY(-5px); }

/* Loading State Overlay */
.loading-state {
    position: absolute; top:0; left:0; right:0; bottom:0;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    background: var(--bg-card); backdrop-filter: blur(10px);
    z-index: 50;
}
.spinner-xl {
    width: 64px; height: 64px;
    border: 4px solid rgba(255,255,255,0.1);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s cubic-bezier(0.55, 0.15, 0.45, 0.85) infinite;
}

/* Image Editor & Slider */
.processing-wrapper { max-width: 900px; margin: 0 auto; }
.editor-container { position: relative; width: 100%; aspect-ratio: 16/9; cursor: crosshair; }
.comparison-layer { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: contain; }
.transparency-grid { background-image: conic-gradient(rgba(255,255,255,0.05) 90deg, transparent 90deg 180deg, rgba(255,255,255,0.05) 180deg 270deg, transparent 270deg); background-size: 20px 20px; }
#image-after { clip-path: inset(0 0 0 50%); }
.comparison-slider { position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; background: rgba(255,255,255,0.8); z-index: 10; transform: translateX(-50%); pointer-events: none; }
.comparison-handle { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 32px; height: 32px; background: var(--primary); border: 2px solid white; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; transition: transform 0.2s; pointer-events: auto; cursor: ew-resize; }
.comparison-handle:hover { transform: translate(-50%, -50%) scale(1.1); }
.comparison-handle svg { width: 16px; height: 16px; }

canvas#brush-canvas { position: absolute; top:0; left:0; width: 100%; height: 100%; z-index: 5; }

/* Editor Controls (Brush) */
.btn-tool { width: 44px; height: 44px; display: inline-flex; justify-content: center; align-items: center; background: transparent; border: 1px solid transparent; border-radius: 0.5rem; color: var(--text-secondary); cursor: pointer; transition: var(--transition); }
.btn-tool svg { width: 20px; height: 20px; }
.btn-tool:hover { background: rgba(255,255,255,0.05); color: #fff; }
.btn-tool.active { background: rgba(255,255,255,0.1); color: var(--primary); border-color: rgba(255,255,255,0.1); }
.divider { width: 1px; height: 24px; background: var(--border-color); }
.custom-slider { -webkit-appearance: none; appearance: none; width: 100px; height: 6px; background: rgba(255,255,255,0.1); border-radius: 5px; outline: none; }
.custom-slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--primary); cursor: pointer; }

/* Steps */
.steps-grid { display: grid; grid-template-columns: repeat(1, 1fr); gap: 1.5rem; }
@media (min-width: 768px) { .steps-grid { grid-template-columns: repeat(3, 1fr); } }
.step-card { padding: 2rem; border-radius: 1.5rem; transition: var(--transition); border: 1px solid var(--border-color); }
.step-card:hover { border-color: var(--primary); transform: translateY(-3px); }
.step-number { width: 3rem; height: 3rem; background: rgba(255,255,255,0.05); color: var(--primary); border-radius: 0.75rem; display: flex; justify-content: center; align-items: center; font-size: 1.25rem; font-weight: 700; margin-bottom: 1.5rem; transition: var(--transition); }
.step-title { font-size: 1.25rem; margin-bottom: 0.5rem; }
.step-desc { color: var(--text-secondary); font-size: 0.875rem; }

/* Pricing Grid */
.pricing-grid { display: grid; grid-template-columns: repeat(1, 1fr); gap: 2rem; align-items: center; max-width: 1000px; margin: 0 auto; }
@media (min-width: 768px) { .pricing-grid { grid-template-columns: repeat(3, 1fr); } }
.pricing-card { display: flex; flex-direction: column; padding: 2rem; border-radius: 1.5rem; transition: var(--transition); }
.premium-card { border-width: 2px; border-color: var(--primary); box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4); transform: scale(1.05); position: relative; z-index: 10; }
.premium-badge { position: absolute; top: -14px; left: 50%; transform: translateX(-50%); background: var(--primary); color: white; padding: 4px 16px; border-radius: 9999px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.pricing-header { margin-bottom: 1.5rem; border-bottom: 1px solid var(--border-color); padding-bottom: 1.5rem; }
.pricing-features { list-style: none; margin-bottom: 2rem; flex: 1; }
.pricing-features li { display: flex; align-items: center; gap: 10px; margin-bottom: 1rem; font-size: 0.875rem; }
.pricing-features li svg { width: 20px; height: 20px; flex-shrink: 0; }

/* History Grid */
.history-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1.5rem; }
.history-card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 1rem; overflow: hidden; transition: var(--transition); }
.history-card:hover { border-color: var(--primary); transform: translateY(-4px); box-shadow: 0 10px 15px -3px rgba(0,0,0,0.3); }
.history-img-wrap { width: 100%; aspect-ratio: 1; background: rgba(0,0,0,0.5); display: flex; justify-content: center; align-items: center; overflow: hidden; position: relative; }
.history-img-wrap::before { content: ""; position: absolute; inset: 0; background-image: conic-gradient(rgba(255,255,255,0.03) 90deg, transparent 90deg 180deg, rgba(255,255,255,0.03) 180deg 270deg, transparent 270deg); background-size: 16px 16px; }
.history-img-wrap img { width: 85%; height: 85%; object-fit: contain; position: relative; z-index: 10; transition: transform 0.5s ease; }
.history-card:hover .history-img-wrap img { transform: scale(1.08); }
.history-info { padding: 1rem; }
.history-title { font-size: 0.875rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 0.25rem; }
.history-date { font-size: 0.75rem; color: var(--text-secondary); margin-bottom: 1rem; }
.history-dl { width: 100%; background: rgba(255,255,255,0.05); border: none; font-size: 0.875rem; font-weight: 600; color: white; padding: 0.75rem; border-radius: 0.5rem; cursor: pointer; display: flex; justify-content: center; align-items: center; gap: 8px; transition: var(--transition); }
.history-dl:hover { background: var(--primary); }
.history-dl svg { width: 18px; height: 18px; flex-shrink: 0; }

/* User Modal & Forms */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(8px); z-index: 100; display: flex; justify-content: center; align-items: center; }
.modal-card { width: 100%; max-width: 400px; padding: 2rem; position: relative; border-radius: 1.5rem; }
.btn-close { position: absolute; top: 1rem; right: 1rem; background: transparent; border: none; color: var(--text-secondary); font-size: 1.5rem; cursor: pointer; transition: var(--transition); }
.btn-close:hover { color: white; transform: rotate(90deg); }
.auth-tab { transition: var(--transition); background: transparent; border-bottom: 2px solid transparent; border-top:none; border-left:none; border-right:none; cursor: pointer;}
.auth-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); outline: none; }

/* Footer */
.footer { border-top: 1px solid var(--border-color); padding: 3rem 0; margin-top: 3rem; }
.footer-container { display: flex; flex-direction: column; justify-content: space-between; align-items: center; gap: 2rem; }
@media (min-width: 768px) { .footer-container { flex-direction: row; } }
.footer-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; white-space: nowrap; }
.footer-brand svg { flex-shrink: 0; }
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 2rem; }
.footer-links a { color: var(--text-secondary); text-decoration: none; font-size: 0.9rem; transition: var(--transition); }
.footer-links a:hover { color: var(--text-primary); }
.footer-copy { color: var(--text-secondary); font-size: 0.85rem; white-space: nowrap; }
