:root {
    --bg-color: #f5f7fa;
    --card-bg: #ffffff;
    --card-border: rgba(0, 0, 0, 0.08);
    --card-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    --text-primary: #1a1a2e;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --accent: #6366f1;
    --accent-light: #818cf8;
    --accent-bg: rgba(99, 102, 241, 0.08);
    --success: #10b981;
    --error: #ef4444;
    --glass-bg: #f8fafc;
    --glass-border: #e2e8f0;
    --input-bg: #ffffff;
    --input-border: #e2e8f0;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8eb 100%);
    min-height: 100vh;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 520px;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 40px;
    box-shadow: var(--card-shadow);
    animation: fadeInUp 0.6s ease-out;
}

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

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

.header {
    text-align: center;
    margin-bottom: 32px;
}

.logo {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--accent) 0%, #a855f7 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.3);
}

.logo svg {
    width: 32px;
    height: 32px;
    color: white;
}

.header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.stats {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 28px;
    text-align: center;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-number {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent) 0%, #a855f7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.1;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 500;
}

.country-stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--glass-border);
}

.country-stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--accent-bg);
    border-radius: 24px;
    font-size: 0.85rem;
    border: 1px solid rgba(99, 102, 241, 0.15);
}

.country-name {
    color: var(--text-secondary);
}

.country-count {
    color: var(--accent);
    font-weight: 700;
    font-size: 0.95rem;
}

.refresh-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 16px;
    padding: 10px 20px;
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    background: var(--card-bg);
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.refresh-btn:hover {
    background: var(--accent-bg);
    color: var(--accent);
    border-color: var(--accent);
}

.refresh-btn svg {
    width: 16px;
    height: 16px;
}

.country-select {
    margin-bottom: 20px;
}

.country-select label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
}

.country-select select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--input-border);
    border-radius: 12px;
    background: var(--input-bg);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px;
}

.country-select select:hover {
    border-color: var(--accent-light);
}

.country-select select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.country-select select option {
    background: var(--card-bg);
    color: var(--text-primary);
    padding: 10px;
}

.upload-area {
    border: 2px dashed var(--glass-border);
    border-radius: 16px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--glass-bg);
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--accent);
    background: var(--accent-bg);
}

.upload-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, var(--accent) 0%, #a855f7 100%);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.25);
}

.upload-icon svg {
    width: 28px;
    height: 28px;
    color: white;
}

.upload-text {
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 8px;
    font-weight: 500;
}

.browse-link {
    color: var(--accent);
    cursor: pointer;
    font-weight: 600;
    transition: color 0.2s ease;
}

.browse-link:hover {
    color: var(--accent-light);
}

.upload-hint {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 16px;
}

.file-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.file-icon svg {
    width: 22px;
    height: 22px;
    color: white;
}

.file-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.file-name {
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.remove-file {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.remove-file:hover {
    background: rgba(239, 68, 68, 0.2);
}

.remove-file svg {
    width: 18px;
    height: 18px;
    color: var(--error);
}

.submit-btn {
    width: 100%;
    padding: 16px 24px;
    margin-top: 24px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent) 0%, #a855f7 100%);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.35);
}

.submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(99, 102, 241, 0.45);
}

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

.btn-loading {
    display: flex;
    align-items: center;
    gap: 8px;
}

.spinner {
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

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

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

.result {
    margin-top: 28px;
    animation: fadeInUp 0.4s ease-out;
}

.result-success,
.result-error {
    text-align: center;
    padding: 28px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
}

.result-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.result-icon.success {
    background: rgba(16, 185, 129, 0.15);
}

.result-icon.error {
    background: rgba(239, 68, 68, 0.15);
}

.result-icon svg {
    width: 30px;
    height: 30px;
}

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

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

.result h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.result-stats {
    display: flex;
    justify-content: center;
    gap: 28px;
    margin-bottom: 24px;
}

.result-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--accent);
}

.stat-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.download-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
    color: white;
    text-decoration: none;
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.3);
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(16, 185, 129, 0.4);
}

.download-btn svg {
    width: 20px;
    height: 20px;
}

.error-message {
    color: var(--error);
    font-size: 0.95rem;
}

.footer {
    text-align: center;
    margin-top: 24px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

@media (max-width: 480px) {
    .card {
        padding: 28px 20px;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    .stat-number {
        font-size: 2.5rem;
    }

    .result-stats {
        gap: 20px;
    }

    .stat-value {
        font-size: 1.5rem;
    }
}