/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --success: #22c55e;
    --success-bg: rgba(34, 197, 94, 0.1);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --error: #ef4444;
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-card-hover: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: #334155;
    --gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 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 24px;
}

/* Header */
.header {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 72px;
    gap: 32px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 20px;
}

.logo-icon {
    width: 40px;
    height: 40px;
}

.nav {
    display: flex;
    gap: 8px;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0 16px;
    flex: 1;
    max-width: 320px;
}

.search-icon {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
}

.search-box input {
    background: transparent;
    border: none;
    padding: 12px;
    color: var(--text-primary);
    font-size: 14px;
    width: 100%;
    outline: none;
}

.search-box input::placeholder {
    color: var(--text-muted);
}

/* Main */
.main {
    padding: 48px 0 80px;
}

/* Download Card */
.download-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 32px;
    margin-bottom: 48px;
}

.app-header {
    display: flex;
    gap: 24px;
    margin-bottom: 32px;
    padding-bottom: 32px;
    border-bottom: 1px solid var(--border);
}

.app-icon {
    flex-shrink: 0;
}

.app-icon svg {
    width: 80px;
    height: 80px;
    border-radius: 18px;
}

.app-info {
    flex: 1;
}

.app-name {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}

.app-meta {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
}

.app-meta span {
    background: var(--bg-dark);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-secondary);
}

.app-rating {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stars {
    display: flex;
    gap: 2px;
}

.stars svg {
    width: 18px;
    height: 18px;
    color: #fbbf24;
}

.rating-count {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Progress Steps */
.download-progress {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 32px;
}

.progress-step {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    transition: all 0.3s;
}

.progress-step.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.progress-step.completed {
    border-color: var(--success);
}

.progress-step.disabled {
    opacity: 0.5;
}

.step-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.step-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
}

.step-icon svg {
    width: 24px;
    height: 24px;
    color: var(--text-secondary);
}

.step-icon.active svg {
    color: var(--primary);
}

.step-icon.completed svg {
    color: var(--success);
}

.step-info {
    flex: 1;
}

.step-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 2px;
}

.step-desc {
    font-size: 14px;
    color: var(--text-secondary);
}

.step-badge .badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge.waiting {
    background: var(--bg-card);
    color: var(--text-muted);
}

.badge.processing {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary-light);
    animation: pulse 1.5s infinite;
}

.badge.success {
    background: var(--success-bg);
    color: var(--success);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Progress Bar */
.progress-bar-container {
    height: 6px;
    background: var(--bg-card);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 16px;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: var(--gradient);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.progress-bar.complete {
    background: var(--success);
}

/* Scan Details */
.scan-details, .prep-details {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px;
}

.scan-item, .prep-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-card);
    border-radius: 8px;
    font-size: 13px;
}

.scan-label, .prep-label {
    color: var(--text-secondary);
}

.scan-status, .prep-status {
    font-size: 16px;
}

/* Download Section */
.download-section {
    text-align: center;
    padding: 32px 0;
    border-top: 1px solid var(--border);
}

.download-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: var(--gradient);
    color: white;
    border: none;
    padding: 18px 48px;
    border-radius: 16px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    min-width: 280px;
}

.download-btn:hover:not(.disabled) {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(99, 102, 241, 0.4);
}

.download-btn:active:not(.disabled) {
    transform: translateY(0);
}

.download-btn.disabled {
    background: var(--bg-dark);
    color: var(--text-muted);
    cursor: not-allowed;
}

.download-btn.ready {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    animation: glow 2s infinite;
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 20px rgba(34, 197, 94, 0.3); }
    50% { box-shadow: 0 0 40px rgba(34, 197, 94, 0.5); }
}

.btn-icon {
    width: 24px;
    height: 24px;
}

.download-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
    color: var(--success);
    font-size: 14px;
}

.download-note svg {
    width: 18px;
    height: 18px;
}

/* File Info */
.file-info {
    background: var(--bg-dark);
    border-radius: 12px;
    padding: 16px 20px;
}

.info-item {
    display: flex;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.info-item:last-child {
    border-bottom: none;
}

.info-label {
    color: var(--text-muted);
    font-size: 13px;
    min-width: 80px;
}

.info-value {
    color: var(--text-secondary);
    font-size: 13px;
    font-family: monospace;
    word-break: break-all;
}

/* Features */
.features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 32px;
    text-align: center;
    transition: all 0.3s;
}

.feature-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
}

.feature-icon {
    width: 64px;
    height: 64px;
    background: var(--gradient);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.feature-icon svg {
    width: 32px;
    height: 32px;
    color: white;
}

.feature-card h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.feature-card p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Footer */
.footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 64px 0 32px;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    gap: 48px;
    margin-bottom: 48px;
}

.footer-brand {
    max-width: 320px;
}

.footer-brand .logo {
    margin-bottom: 16px;
}

.footer-brand p {
    color: var(--text-secondary);
    font-size: 14px;
}

.footer-links {
    display: flex;
    gap: 64px;
}

.footer-col h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.footer-col a {
    display: block;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    margin-bottom: 8px;
    transition: color 0.2s;
}

.footer-col a:hover {
    color: var(--primary-light);
}

.footer-bottom {
    text-align: center;
    padding-top: 32px;
    border-top: 1px solid var(--border);
}

.footer-bottom p {
    color: var(--text-muted);
    font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
    .header .container {
        flex-wrap: wrap;
        height: auto;
        padding: 16px 24px;
        gap: 16px;
    }

    .nav {
        order: 3;
        width: 100%;
        justify-content: center;
    }

    .search-box {
        max-width: none;
    }

    .app-header {
        flex-direction: column;
        text-align: center;
    }

    .app-meta {
        justify-content: center;
        flex-wrap: wrap;
    }

    .app-rating {
        justify-content: center;
    }

    .features {
        grid-template-columns: 1fr;
    }

    .footer-content {
        flex-direction: column;
    }

    .footer-links {
        flex-wrap: wrap;
        gap: 32px;
    }

    .scan-details, .prep-details {
        grid-template-columns: 1fr;
    }
}

/* Animations */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.loading-spinner {
    animation: spin 1s linear infinite;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.5s ease;
}

/* Checkmark animation */
.check-mark {
    stroke-dasharray: 10;
    stroke-dashoffset: 10;
    transition: stroke-dashoffset 0.5s ease;
}

.step-icon.completed .check-mark {
    stroke-dashoffset: 0;
}
