:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #8b5cf6;
    --bg: #0f172a;
    --surface: #1e293b;
    --text: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --success: #22c55e;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    padding: 2rem 1rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

header p {
    color: rgba(255,255,255,0.8);
    font-size: 1.1rem;
}

main {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
}

/* Upload Section */
.upload-section {
    margin-bottom: 2rem;
}

.drop-zone {
    border: 3px dashed var(--border);
    border-radius: 16px;
    padding: 4rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--surface);
}

.drop-zone:hover, .drop-zone.drag-over {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.upload-icon {
    width: 64px;
    height: 64px;
    color: var(--primary);
    margin-bottom: 1rem;
}

.drop-zone p {
    font-size: 1.25rem;
    color: var(--text);
}

.drop-zone .small {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* Editor Section */
.editor-section {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Canvas Wrapper */
.canvas-wrapper {
    position: relative;
    background: white;
    border-radius: 16px;
    padding: 1rem;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    z-index: 10;
}

.loading-overlay p {
    color: var(--bg);
    font-weight: 500;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Canvas Container */
.canvas-container {
    background: white;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
}

#outputCanvas {
    max-width: 100%;
    max-height: 70vh;
    border-radius: 8px;
}

/* Controls */
.controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    background: var(--surface);
    padding: 1.5rem;
    border-radius: 12px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.control-group label {
    font-size: 0.9rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.control-group input[type="range"] {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border);
    border-radius: 3px;
    outline: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
}

.control-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.value {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: right;
}

/* Actions */
.actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.btn.primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.btn.secondary {
    background: var(--border);
    color: var(--text);
}

.btn.secondary:hover {
    background: #475569;
}

/* Ads Section */
.ads-section {
    margin-top: 3rem;
    text-align: center;
}

.ads-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
}

.ad-container {
    background: var(--surface);
    border-radius: 8px;
    padding: 1rem;
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-placeholder {
    color: var(--text-muted);
    font-size: 0.9rem;
}

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

/* Skip link for accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary);
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 100;
    border-radius: 0 0 4px 0;
}

.skip-link:focus {
    top: 0;
}

/* Container system */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header improvements */
header .tagline {
    font-size: 1.2rem;
    font-weight: 500;
    margin-top: 0.5rem;
}

header .sub-tagline {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-top: 0.25rem;
}

/* Features grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 2rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
}

.feature-icon {
    font-size: 1.5rem;
}

.feature-text {
    font-size: 0.9rem;
    color: var(--text);
}

/* Control help text */
.control-help {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Content Section for SEO */
.content-section {
    margin-top: 3rem;
    padding: 2rem 0;
    border-top: 1px solid var(--border);
}

.content-section h2 {
    font-size: 1.75rem;
    margin-bottom: 1rem;
    color: var(--text);
}

.content-section h3 {
    font-size: 1.25rem;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--primary);
}

.content-section p {
    line-height: 1.7;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.content-section ol,
.content-section ul {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-muted);
}

.content-section li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.content-section strong {
    color: var(--text);
}

/* FAQ Section */
.faq-section {
    margin-top: 3rem;
    padding: 2rem 0;
    border-top: 1px solid var(--border);
}

.faq-section h2 {
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
    color: var(--text);
}

.faq-item {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

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

.faq-item h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.faq-item p {
    line-height: 1.7;
    color: var(--text-muted);
}

/* Footer improvements */
footer .container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

footer .footer-main {
    font-size: 0.95rem;
    color: var(--text);
}

footer .footer-links {
    font-size: 0.85rem;
}

footer .footer-tech {
    font-size: 0.75rem;
    opacity: 0.7;
}

/* Responsive improvements */
@media (max-width: 768px) {
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
        padding: 1rem;
    }
    
    .content-section h2,
    .faq-section h2 {
        font-size: 1.4rem;
    }
    
    .content-section h3 {
        font-size: 1.1rem;
    }
    
    .faq-item h3 {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    .feature-item {
        padding: 0.25rem;
    }
}


/* Print Styles */
@media print {
    header, .upload-section, .controls, .actions, .ads-section, footer {
        display: none !important;
    }
    
    body {
        background: white;
    }
    
    .editor-section {
        display: block !important;
    }
    
    .canvas-container {
        background: white;
        box-shadow: none;
        padding: 0;
    }
    
    #outputCanvas {
        max-height: none;
        width: 100%;
    }
}
