:root {
    --bg-deep: #030712;
    --bg-gradient-1: #4f46e5;
    --bg-gradient-2: #ec4899;

    --glass-surface: rgba(17, 24, 39, 0.7);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-highlight: rgba(255, 255, 255, 0.03);

    --text-main: #f8fafc;
    --text-muted: #94a3b8;

    --primary: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.4);

    --success: #10b981;

    --font-heading: 'Outfit', sans-serif;
    --font-ui: 'Plus Jakarta Sans', sans-serif;

    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
    background-color: var(--bg-deep);
    color: var(--text-main);
    font-family: var(--font-ui);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
}

/* Ambient Background Glows */
.ambient-glow {
    position: fixed;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.15;
    z-index: -1;
    animation: float 20s ease-in-out infinite alternate;
}

.glow-1 {
    background: var(--bg-gradient-1);
    top: -10%;
    left: -10%;
}

.glow-2 {
    background: var(--bg-gradient-2);
    bottom: -10%;
    right: -10%;
    animation-delay: -10s;
}

@keyframes float {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(50px, 50px) scale(1.1);
    }
}

/* App Container */
.app-glass-container {
    width: 100%;
    max-width: 960px;
    min-height: 600px;
    margin: 2rem;
    background: var(--glass-surface);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    padding: 3rem;
    position: relative;
    overflow: hidden;
}

/* Header */
.app-header {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInDown 0.8s var(--ease-out);
}

.logo-area {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 0.5rem;
}

.logo-icon {
    color: var(--primary);
    filter: drop-shadow(0 0 10px var(--primary-glow));
}

h1 {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 2.5rem;
    letter-spacing: -0.02em;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tagline {
    color: var(--text-muted);
    font-size: 1.1rem;
    font-weight: 400;
}

/* Upload Zone */
.upload-zone {
    flex: 1;
    border: 2px dashed rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s var(--ease-out);
    position: relative;
    background: rgba(255, 255, 255, 0.01);
    min-height: 300px;
    cursor: pointer;
}

.upload-zone:hover,
.upload-zone.drag-over {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
    transform: scale(0.995);
}

.upload-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.upload-icon-wrapper {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    position: relative;
}

.upload-icon {
    width: 32px;
    height: 32px;
    color: var(--text-main);
    z-index: 2;
}

.icon-pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 1px solid var(--primary);
    opacity: 0;
    transform: scale(0.8);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }

    50% {
        opacity: 0.3;
    }

    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

.upload-content h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 500;
}

.upload-content p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}

.btn-text {
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-ui);
    font-size: 1rem;
    cursor: pointer;
}

.highlight {
    color: var(--primary);
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: rgba(99, 102, 241, 0.3);
    text-underline-offset: 4px;
    transition: all 0.2s;
}

.highlight:hover {
    text-decoration-color: var(--primary);
}

/* Processing State */
.state-processing {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: 300px;
    gap: 1.5rem;
}

.loader-ring {
    display: inline-block;
    position: relative;
    width: 64px;
    height: 64px;
}

.loader-ring div {
    box-sizing: border-box;
    display: block;
    position: absolute;
    width: 50px;
    height: 50px;
    margin: 8px;
    border: 3px solid var(--primary);
    border-radius: 50%;
    animation: ring 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
    border-color: var(--primary) transparent transparent transparent;
}

.loader-ring div:nth-child(1) {
    animation-delay: -0.45s;
}

.loader-ring div:nth-child(2) {
    animation-delay: -0.3s;
}

.loader-ring div:nth-child(3) {
    animation-delay: -0.15s;
}

@keyframes ring {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Comparison Stage */
.comparison-stage {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 2rem;
    align-items: center;
    margin-bottom: 3rem;
    animation: fadeInUp 0.6s var(--ease-out);
}

.stat-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1rem;
    transition: transform 0.3s var(--ease-out);
}

.stat-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.04);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0 0.5rem;
}

.label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
    color: var(--text-muted);
}

.label.success {
    color: var(--success);
    background: rgba(16, 185, 129, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
}

.size {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1.1rem;
}

.img-viewer {
    width: 100%;
    aspect-ratio: 16/9;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.img-viewer img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.card-footer {
    margin-top: 1rem;
    padding: 0 0.5rem;
    text-align: right;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.flow-indicator {
    color: var(--text-muted);
    opacity: 0.3;
}

/* Action Bar */
.action-bar {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    align-items: center;
    animation: fadeInUp 0.8s var(--ease-out);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #4f46e5);
    color: white;
    padding: 1rem 2rem;
    border-radius: 12px;
    border: none;
    font-family: var(--font-ui);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 10px 20px -5px var(--primary-glow);
    transition: all 0.3s var(--ease-out);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.btn-primary:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 15px 30px -5px var(--primary-glow);
    filter: brightness(1.1);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-family: var(--font-ui);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s var(--ease-out);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.3);
}

.btn-secondary svg {
    opacity: 0.8;
}

.btn-text-only {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-ui);
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    padding: 0.5rem 1rem;
    transition: color 0.2s;
}

.btn-text-only:hover {
    color: var(--text-main);
    text-decoration: underline;
}

/* Footer & Utils */
footer {
    margin-top: auto;
    text-align: center;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.2);
    padding-top: 2rem;
}

.status-indicator {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: var(--success);
    border-radius: 50%;
    margin-right: 4px;
}

.hidden {
    display: none !important;
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

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

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.spinner-icon {
    animation: spin 1s linear infinite;
}

@media (max-width: 768px) {
    .comparison-stage {
        grid-template-columns: 1fr;
    }

    .flow-indicator {
        transform: rotate(90deg);
        margin: 1rem 0;
    }

    .app-glass-container {
        padding: 1.5rem;
    }

    h1 {
        font-size: 2rem;
    }
}