:root {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --text-muted: #718096;
    --border-color: #e2e8f0;
    --border-hover: #cbd5e1;
    --accent-primary: #3182ce;
    --accent-hover: #2c5aa0;
    --success-bg: #f0fff4;
    --success-border: #9ae6b4;
    --success-text: #22543d;
    --error-bg: #fed7d7;
    --error-border: #feb2b2;
    --error-text: #c53030;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --card-bg: #ffffff;
    --card-border: #e2e8f0;
}

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

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

.main-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    max-width: 800px;
    margin: 0 auto;
    min-height: 80vh;
    padding: 1rem;
}

.container {
    width: 100%;
    max-width: 480px;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

/* ── Header ── */

.header {
    background: var(--card-bg);
    padding: 1.5rem 2rem 1rem 2rem;
    text-align: center;
}

.app-icon {
    font-size: 2.25rem;
    margin-bottom: 0.75rem;
    display: block;
}

.header h1 {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.75rem 0;
}

.header-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
}

/* ── Content / Steps ── */

.content {
    padding: 1rem 2rem 1.5rem 2rem;
}

.step {
    display: none;
    opacity: 0;
    transform: translateX(30px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.step.active {
    display: block;
    opacity: 1;
    transform: translateX(0);
    animation: slideInFromRight 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideInFromRight {
    from { opacity: 0; transform: translateX(30px); }
    to   { opacity: 1; transform: translateX(0); }
}

h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1.25rem;
    text-align: center;
}

/* ── Form elements ── */

.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.required-note {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--accent-primary);
    margin-left: 4px;
}

.form-select,
.form-input {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text-primary);
    background: var(--bg-secondary);
    transition: border-color 0.2s, box-shadow 0.2s;
    appearance: none;
    -webkit-appearance: none;
    outline: none;
}

.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23718096' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
    cursor: pointer;
}

.form-select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: var(--bg-primary);
}

.form-select option { background: #fff; }

.form-select:focus,
.form-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.15);
}

.input-prefix-wrap {
    position: relative;
}

.input-prefix {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
    pointer-events: none;
}

.form-input.has-prefix {
    padding-left: 24px;
}

/* ── Upload area ── */

.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 10px;
    padding: 1.75rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--bg-primary);
}

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

.upload-area.dragover {
    transform: scale(1.01);
}

.upload-icon {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

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

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

.file-info {
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.file-info-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

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

.file-info-size {
    flex-shrink: 0;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.rename-preview {
    margin-top: 0.5rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    padding: 0 0.25rem;
}

.rename-preview strong {
    color: var(--accent-primary);
    font-weight: 500;
}

/* ── Buttons ── */

.btn {
    width: 100%;
    padding: 0.85rem 1.5rem;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 0.5rem;
    font-family: inherit;
}

.btn:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(49, 130, 206, 0.3);
}

.btn:active:not(:disabled) {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    margin-top: 0.5rem;
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-primary);
    border-color: var(--border-hover);
    box-shadow: none;
    transform: translateY(-1px);
}

/* ── Messages ── */

.error-msg {
    padding: 0.75rem 1rem;
    background: var(--error-bg);
    border: 1px solid var(--error-border);
    border-radius: 8px;
    color: var(--error-text);
    font-size: 0.875rem;
    margin-top: 0.75rem;
}

/* ── Progress / spinner ── */

.progress {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
    justify-content: center;
    padding: 1rem 0;
}

.spinner {
    width: 14px;
    height: 14px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}

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

/* ── Success ── */

.success {
    text-align: center;
    padding: 1rem 0 0.5rem 0;
}

.success-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

.success h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.success p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.success-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* ── Responsive ── */

@media (max-width: 768px) {
    .main-container { min-height: auto; padding: 0.5rem; }
    .header { padding: 1.25rem 1.25rem 0.75rem; }
    .content { padding: 1rem 1.25rem 1.25rem; }
    .btn { min-height: 52px; font-size: 1rem; }
}

/* ── Close countdown ── */

.close-countdown {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 0.5rem;
    animation: fadeIn 0.4s ease;
}

.close-countdown strong {
    color: var(--accent-primary);
    font-weight: 600;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
