/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #1e1e2e 0%, #2a2a3e 100%);
    color: #ffffff;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header styles */
.header {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    padding: 1.8rem 2rem; 
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.header h1 {
    font-size: 2.2rem; 
    font-weight: bold;
    letter-spacing: 1.5px; 
    margin-bottom: 0.4rem; 
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.0rem; 
}

/* Container and layout */
.container {
    flex: 1;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Upload section */
.upload-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.upload-box {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 2.5rem; 
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.upload-box h3 {
    font-size: 1.3rem; 
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: rgba(255,255,255,0.9);
}

.upload-box:hover {
    border-color: #667eea;
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
}

.upload-box.dragover {
    border-color: #764ba2;
    background: rgba(118, 75, 162, 0.1);
}

.upload-box input[type="file"] {
    display: none;
}

.upload-label {
    cursor: pointer;
    display: inline-block;
    padding: 0.9rem 1.8rem; 
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50px;
    font-weight: 500;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    margin-top: 1rem;
}

.upload-label:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.upload-icon {
    font-size: 2.8rem; 
    margin-bottom: 1rem;
    opacity: 0.7;
    color: #fff; 
}

.preview-image {
    max-width: 100%;
    max-height: 280px; 
    margin-top: 1rem;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* Controls and buttons */
.controls {
    text-align: center;
    margin: 2rem 0;
}

.btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    padding: 0.9rem 2.8rem; 
    font-size: 1.0rem; 
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 1px;
    font-weight: 500;
    margin: 0 0.5rem;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Result section */
.result-section {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 2rem;
    margin-top: 2rem;
    display: none;
}

.result-section.active {
    display: block;
}

.result-header {
    text-align: center;
    margin-bottom: 2rem;
}

.result-header h2 {
    font-size: 1.8rem; 
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.canvas-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 2rem;
    position: relative;
}

.canvas-wrapper {
    position: relative;
    display: inline-block;
}

#resultCanvas, #overlayCanvas {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

#overlayCanvas {
    position: absolute;
    top: 0;
    left: 0;
}

/* Settings and controls */
.settings-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); 
    gap: 2rem;
    margin: 2rem 0;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.slider-container {
    flex: 1;
}

.slider-label {
    display: block;
    margin-bottom: 0.5rem;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
}

.slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
    opacity: 0.7;
    transition: opacity 0.2s;
    -webkit-appearance: none;
}

.slider:hover {
    opacity: 1;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    border: none;
}

.toggle-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.toggle-switch {
    position: relative;
    width: 60px;
    height: 30px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 30px;
    cursor: pointer;
    transition: background 0.3s;
}

.toggle-switch.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.toggle-slider {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s;
}

.toggle-switch.active .toggle-slider {
    transform: translateX(30px);
}

.color-picker-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.color-picker {
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    background: transparent;
}

/* Statistics */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); 
    gap: 1rem;
    margin-top: 2rem;
}

.stat-card {
    background: rgba(255, 255, 255, 0.05);
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
}

.stat-value {
    font-size: 1.8rem; 
    font-weight: 300;
    color: #667eea;
}

.stat-label {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem; 
    margin-top: 0.5rem;
}

/* Loading */
.loading {
    display: none;
    text-align: center;
    padding: 2rem;
}

.loading.active {
    display: block;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

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

.supported-formats {
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
    margin-top: 1rem;
}

/* How to use section */
.how-to-use-section {
    background: rgba(255, 255, 255, 0.04); 
    backdrop-filter: blur(8px);
    border-radius: 16px;
    padding: 2.5rem 2rem;
    margin-top: 3rem;
    margin-bottom: 3rem; 
    color: rgba(255, 255, 255, 0.9);
}

.how-to-use-section h2 {
    font-size: 1.8rem; 
    font-weight: bold;
    text-align: center;
    margin-bottom: 2rem;
    color: #667eea; 
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem; 
}

.step-card {
    background: rgba(255, 255, 255, 0.06);
    padding: 1.8rem; 
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.step-number {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
    color: white;
    margin-bottom: 1rem;
}

.step-card h3 {
    font-size: 1.2rem; 
    font-weight: bold;
    color: rgba(255,255,255,0.95);
    margin-bottom: 0.8rem;
}

.step-card p {
    font-size: 0.9rem; 
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.7);
    text-align: left;
}

/* SEO content section */
.seo-content-section {
    background: rgba(255, 255, 255, 0.03); 
    backdrop-filter: blur(5px);
    border-radius: 16px;
    padding: 2.5rem 2rem; 
    margin-top: 3rem;
    color: rgba(255, 255, 255, 0.85);
}

.seo-content-section h2 {
    font-size: 2.0rem; 
    font-weight: bold;
    text-align: center;
    margin-bottom: 2.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 80%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.seo-content-grid {
    display: grid;
    gap: 2rem;
    grid-template-columns: 1fr; 
}

@media (min-width: 768px) {
    .seo-content-grid {
         grid-template-columns: repeat(2, minmax(0, 1fr)); 
    }
}

.seo-feature-card {
    background: rgba(255, 255, 255, 0.05);
    padding: 1.8rem;
    border-radius: 12px;
    border-left: 3px solid #667eea;
    transition: background 0.25s, border-color 0.25s, transform 0.25s, box-shadow 0.25s;
}

a.seo-feature-card {
    text-decoration: none;
    display: block;
}

a.seo-feature-card:hover {
    background: rgba(255, 255, 255, 0.09);
    border-left-color: #93b5ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.15);
}

a.seo-feature-card:hover h3 {
    color: #93b5ff;
}

.seo-feature-card h3 {
    font-size: 1.3rem; 
    font-weight: bold;
    color: #667eea;
    margin-bottom: 1rem;
}

.seo-feature-card p, .seo-feature-card ul {
    font-size: 0.95rem; 
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.75);
}

.seo-feature-card p strong {
    display: block; 
    margin-top: 0.8em; 
    color: rgba(255, 255, 255, 0.9); 
    font-weight: 500;
}

.usage-scene-list {
    list-style: none;
    padding-left: 0;
    margin-top: 0.5rem;
}

.usage-scene-list li {
    margin-bottom: 0.8rem;
    padding-left: 1.5em;
    position: relative;
}

.usage-scene-list li::before {
    content: "✓"; 
    color: #667eea;
    position: absolute;
    left: 0;
    font-weight: bold;
}

/* Footer */
.footer {
    text-align: center;
    padding: 1.8rem; 
    background: rgba(255, 255, 255, 0.02);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem; 
    margin-top: auto; 
}

.footer a {
    color: #a0a0a0; 
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer a:hover {
    color: #ffffff;
    text-decoration: underline;
}

/* Responsive styles */
@media (max-width: 768px) {
    .upload-section {
        grid-template-columns: 1fr;
    }
    .header h1 { 
        font-size: 1.8rem; 
        font-weight: bold; 
    }
    .settings-container { 
        grid-template-columns: 1fr; 
    }
    .how-to-use-section h2 { 
        font-size: 1.6rem; 
        font-weight: bold; 
    }
    .step-card h3 { 
        font-size: 1.1rem; 
        font-weight: bold; 
    }
    .seo-content-section h2 { 
        font-size: 1.6rem; 
        font-weight: bold; 
    }
    .seo-feature-card h3 { 
        font-size: 1.2rem; 
        font-weight: bold; 
    }
    .seo-feature-card p, .seo-feature-card ul { 
        font-size: 0.9rem; 
    }
}

@media (max-width: 480px) {
     .header h1 { 
        font-size: 1.6rem; 
        font-weight: bold;
    }
     .header p { 
        font-size: 0.9rem; 
    }
     .upload-box h3 { 
        font-size: 1.1rem; 
        font-weight: bold;
    }
     .btn { 
        padding: 0.8rem 2rem; 
        font-size: 0.9rem; 
    }
     .how-to-use-section { 
        padding: 2rem 1.5rem;
    }
     .how-to-use-section h2 { 
        font-size: 1.5rem; 
        font-weight: bold;
    }
     .step-card h3 { 
        font-size: 1.0rem; 
        font-weight: bold;
    }
     .step-card p { 
        font-size: 0.85rem; 
    }
     .seo-content-section { 
        padding: 2rem 1.5rem;
    }
     .seo-content-section h2 { 
        font-size: 1.5rem; 
        font-weight: bold;
    }
     .seo-feature-card h3 { 
        font-size: 1.1rem; 
        font-weight: bold;
    }
}