/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #e91e63;
    --primary-hover: #c2185b;
    --bg-dark: #0a0a0a;
    --bg-gray: #1a1a1a;
    --bg-gray-light: #2a2a2a;
    --text-primary: #ededed;
    --text-secondary: #9ca3af;
    --border-color: #374151;
    --success: #10b981;
    --error: #ef4444;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

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

/* Header */
header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(26, 26, 26, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
}

header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
}

.logo-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: none;
    border: none;
    cursor: pointer;
    transition: transform 0.2s;
}

.logo-btn:hover {
    transform: scale(1.05);
}

.logo {
    width: auto;
    height: 50px;
    border-radius: 8px;
}

.brand h1 {
    font-size: 1.5rem;
    color: var(--primary);
    margin: 0;
}

.brand .tagline {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: none;
}

.nav-desktop {
    display: none;
    gap: 1.5rem;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    transition: color 0.2s;
}

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

.menu-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
}

/* Main Content */
.main-content {
    padding: 2rem 0;
    min-height: calc(100vh - 80px);
}

.step {
    display: none;
}

.step.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Upload Step */
.upload-container {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.main-title {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--primary), #9c27b0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: 1rem;
    padding: 3rem 2rem;
    background: rgba(26, 26, 26, 0.5);
    cursor: pointer;
    transition: all 0.3s;
}

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

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

.drop-zone h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.drop-zone p {
    color: var(--text-secondary);
    margin: 0.25rem 0;
}

.file-info {
    font-size: 0.875rem;
    margin-top: 1rem !important;
}

.preview {
    margin-top: 2rem;
    border-radius: 1rem;
    overflow: hidden;
}

.preview.hidden {
    display: none;
}

.preview img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 1rem;
}

/* Features Section */
.features-section,
.how-it-works,
.faq-section {
    margin: 4rem 0;
}

.section-title {
    font-size: 2rem;
    text-align: center;
    margin-bottom: 3rem;
}

.features-grid,
.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.feature-card,
.step-card {
    background: var(--bg-gray);
    padding: 2rem;
    border-radius: 1rem;
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
}

.feature-card:hover,
.step-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(233, 30, 99, 0.2);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.step-number {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #3b82f6, #9c27b0);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    margin: 0 auto 1rem;
}

.feature-card h3,
.step-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.feature-card p,
.step-card p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5rem;
    margin: 3rem 0;
}

.stat-card {
    background: var(--bg-gray);
    padding: 1.5rem;
    border-radius: 1rem;
    text-align: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

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

/* Processing Step */
.processing-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

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

.processing-icon {
    margin-bottom: 1.5rem;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--bg-gray-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    margin: 0 auto;
    animation: spin 1s linear infinite;
}

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

.processing-title {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.processing-status {
    color: var(--text-secondary);
    margin-bottom: 0;
    font-size: 0.95rem;
}

.progress-section {
    margin-bottom: 2.5rem;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-gray-light);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #9c27b0);
    transition: width 0.3s ease;
    width: 0%;
    box-shadow: 0 0 10px rgba(233, 30, 99, 0.5);
}

.progress-text {
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-align: center;
    font-weight: 600;
}

.processing-stages {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.stage {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--bg-gray);
    border-radius: 1rem;
    border: 2px solid transparent;
    opacity: 0.4;
    transition: all 0.4s ease;
    position: relative;
}

.stage::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--border-color);
    border-radius: 1rem 0 0 1rem;
    transition: all 0.4s ease;
}

.stage.pending {
    opacity: 0.4;
}

.stage.active {
    opacity: 1;
    background: rgba(233, 30, 99, 0.08);
    border-color: rgba(233, 30, 99, 0.3);
    box-shadow: 0 4px 12px rgba(233, 30, 99, 0.15);
    transform: scale(1.02);
}

.stage.active::before {
    background: var(--primary);
    box-shadow: 0 0 10px var(--primary);
}

.stage.completed {
    opacity: 1;
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.2);
}

.stage.completed::before {
    background: var(--success);
}

/* Stage Indicator (Spinner/Check) */
.stage-indicator {
    position: relative;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.stage-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--bg-gray-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    opacity: 0;
    transition: opacity 0.3s;
}

.stage.active .stage-spinner {
    opacity: 1;
}

.stage-check {
    position: absolute;
    top: 0;
    left: 0;
    width: 40px;
    height: 40px;
    background: var(--success);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0);
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.stage.completed .stage-check {
    opacity: 1;
    transform: scale(1);
}

.stage-check svg {
    color: white;
}

/* Stage Content */
.stage-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.stage-icon {
    font-size: 2rem;
    line-height: 1;
    flex-shrink: 0;
    transition: transform 0.3s;
}

.stage.active .stage-icon {
    transform: scale(1.1);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1.1);
    }

    50% {
        transform: scale(1.2);
    }
}

.stage-info {
    flex: 1;
    min-width: 0;
}

.stage-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    transition: color 0.3s;
}

.stage.active .stage-title {
    color: var(--primary);
}

.stage.completed .stage-title {
    color: var(--success);
}

.stage-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Result Step */
.result-container {
    max-width: 900px;
    margin: 0 auto;
    text-align: center;
}

.success-icon {
    width: 80px;
    height: 80px;
    background: rgba(16, 185, 129, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}

.success-icon svg {
    color: var(--success);
}

.result-title {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.result-subtitle {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.view-toggle {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 2rem;
    background: var(--bg-gray);
    padding: 0.5rem;
    border-radius: 0.5rem;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.toggle-btn {
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 0.375rem;
    transition: all 0.2s;
    font-size: 1rem;
}

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

.image-view {
    display: none;
    margin-bottom: 2rem;
}

.image-view.active {
    display: block;
}

.image-container {
    background: var(--bg-gray);
    border-radius: 1rem;
    overflow: hidden;
    min-height: 400px;
    max-height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-container img {
    max-width: 100%;
    max-height: 600px;
    object-fit: contain;
}

/* Compare View */
.compare-labels {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.label-left {
    margin-left: 5%;
    font-weight: 600;
}

.label-right {
    margin-right: 5%;
    color: var(--primary);
    font-weight: 600;
}

.compare-container {
    position: relative;
    background: var(--bg-gray);
    border-radius: 1rem;
    overflow: hidden;
    min-height: 400px;
    max-height: 600px;
}

.compare-img {
    width: 100%;
    height: auto;
    display: block;
    max-height: 600px;
    object-fit: contain;
}

.compare-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    clip-path: inset(0 50% 0 0);
}

.compare-slider {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: ew-resize;
    z-index: 10;
}

.slider-line {
    position: absolute;
    top: 0;
    left: 50%;
    width: 4px;
    height: 100%;
    background: var(--primary);
    transform: translateX(-50%);
    pointer-events: none;
    z-index: 5;
}

.slider-line::before,
.slider-line::after {
    content: '';
    position: absolute;
    left: 50%;
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: 50%;
    transform: translateX(-50%);
}

.slider-line::before {
    top: 50%;
    transform: translate(-50%, -50%);
}

/* Result Actions */
.result-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 2rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    border: none;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(233, 30, 99, 0.3);
}

.btn-secondary {
    background: var(--bg-gray);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-gray-light);
}

.btn-accent {
    background: linear-gradient(135deg, #3b82f6, #9c27b0);
    color: white;
}

.btn-accent:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(59, 130, 246, 0.3);
}

/* Image Loading States */
.image-container img.loading,
.compare-img.loading {
    opacity: 0.3;
    position: relative;
}

.image-container img.loading::after,
.compare-img.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    border: 3px solid var(--bg-gray-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    transform: translate(-50%, -50%);
}


/* Error Step */
.error-container {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 1rem;
    padding: 3rem 2rem;
}

.error-icon {
    width: 80px;
    height: 80px;
    background: rgba(239, 68, 68, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}

.error-icon svg {
    color: var(--error);
}

.error-title {
    font-size: 2rem;
    color: var(--error);
    margin-bottom: 1rem;
}

.error-message {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.error-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.error-tips {
    background: rgba(26, 26, 26, 0.5);
    padding: 1.5rem;
    border-radius: 0.5rem;
    text-align: left;
}

.tips-title {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.error-tips ul {
    list-style: disc;
    padding-left: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.error-tips li {
    margin: 0.25rem 0;
}

/* FAQ Section */
.faq-section {
    background: var(--bg-gray);
    padding: 4rem 0;
    margin-top: 4rem;
}

.faq-list {
    max-width: 800px;
    margin: 0 auto;
}

.faq-item {
    border-bottom: 1px solid var(--border-color);
}

.faq-question {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 0;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.125rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
}

.faq-icon {
    transition: transform 0.3s;
    color: var(--primary);
}

.faq-item.active .faq-icon {
    transform: rotate(180deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.faq-item.active .faq-answer {
    max-height: 300px;
    padding-bottom: 1.5rem;
}

.faq-answer p {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Mobile-First Optimizations */
@media (max-width: 767px) {

    /* Safe area for notched devices */
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }

    /* Larger touch targets */
    .btn {
        min-height: 48px;
        font-size: 1.05rem;
    }

    /* Optimized spacing for mobile */
    .processing-container {
        padding: 1.5rem 1rem;
    }

    .stage {
        padding: 1rem;
    }

    .stage-icon {
        font-size: 1.75rem;
    }

    .stage-title {
        font-size: 1rem;
    }

    .stage-description {
        font-size: 0.8rem;
    }

    /* Better mobile header */
    header .container {
        padding: 0.75rem 1rem;
    }

    .logo {
        height: 40px;
    }

    .brand h1 {
        font-size: 1.25rem;
    }

    /* Smooth scrolling */
    html {
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
    }

    /* Prevent zoom on input focus */
    input,
    select,
    textarea {
        font-size: 16px;
    }
}

/* Responsive */
@media (min-width: 640px) {
    .brand .tagline {
        display: block;
    }

    .processing-container {
        padding: 2.5rem 1.5rem;
    }
}

@media (min-width: 768px) {
    .nav-desktop {
        display: flex;
    }

    .menu-btn {
        display: none;
    }

    .main-title {
        font-size: 3rem;
    }

    .result-actions {
        flex-direction: row;
        justify-content: center;
        flex-wrap: wrap;
    }

    .error-actions {
        flex-direction: row;
        justify-content: center;
    }

    .stage {
        padding: 1.5rem;
    }

    .stage-icon {
        font-size: 2.25rem;
    }

    .stage-title {
        font-size: 1.25rem;
    }

    .stage-description {
        font-size: 0.9rem;
    }
}

/* Tablet and Desktop */
@media (min-width: 1024px) {
    .processing-container {
        padding: 3rem 2rem;
    }

    .processing-stages {
        gap: 1.25rem;
    }
}

/* Animations for better UX */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stage {
    animation: slideInUp 0.3s ease-out;
}

.stage:nth-child(1) {
    animation-delay: 0s;
}

.stage:nth-child(2) {
    animation-delay: 0.1s;
}

.stage:nth-child(3) {
    animation-delay: 0.2s;
}

.stage:nth-child(4) {
    animation-delay: 0.3s;
}