/* Apple Liquid Glass — frosted glass, depth, ambient color orbs */

:root {
    --glass-bg: rgba(255, 255, 255, 0.45);
    --glass-border: rgba(255, 255, 255, 0.6);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    --glass-blur: 24px;
    --text: #1d1d1f;
    --text-muted: rgba(0, 0, 0, 0.45);
    --accent: #0071e3;
    --accent-hover: #0077ed;
    --success: #34c759;
    --warn: #ff9500;
    --error: #ff3b30;
    --radius: 20px;
    --radius-sm: 12px;
    --transition: 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

html, body {
    min-height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'SF Pro Display',
                 'Helvetica Neue', Helvetica, Arial, sans-serif;
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    background: #f0f0f5;
}

/* ─── Animated background orbs ─── */
.bg-orbs {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
    animation: float 20s ease-in-out infinite;
}

.orb-1 {
    width: 500px; height: 500px;
    background: radial-gradient(circle, #a78bfa, #7c3aed);
    top: -10%; left: -5%;
    animation-delay: 0s;
}

.orb-2 {
    width: 400px; height: 400px;
    background: radial-gradient(circle, #60a5fa, #3b82f6);
    bottom: -10%; right: -5%;
    animation-delay: -7s;
}

.orb-3 {
    width: 350px; height: 350px;
    background: radial-gradient(circle, #f472b6, #ec4899);
    top: 50%; left: 60%;
    animation-delay: -14s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -40px) scale(1.05); }
    66% { transform: translate(-20px, 20px) scale(0.95); }
}

/* ─── Layout ─── */
main {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1.5rem;
}

.container {
    width: 100%;
    max-width: 520px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ─── Header ─── */
.header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.1));
}

.header h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, #1d1d1f 0%, #6b7280 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    font-weight: 400;
}

/* ─── Glass Card ─── */
.glass-card {
    width: 100%;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur)) saturate(180%);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--glass-shadow),
                inset 0 1px 0 rgba(255, 255, 255, 0.5);
    padding: 1.75rem;
    transition: box-shadow var(--transition);
}

/* ─── Form ─── */
.input-group {
    margin-bottom: 1.25rem;
}

.input-group input {
    width: 100%;
    padding: 0.85rem 1rem;
    font-size: 0.95rem;
    font-family: inherit;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(8px);
    color: var(--text);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.input-group input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.12);
}

.input-group input::placeholder {
    color: var(--text-muted);
    font-size: 0.88rem;
}

/* ─── Primary Button ─── */
.btn-primary {
    width: 100%;
    padding: 0.85rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    color: white;
    background: linear-gradient(135deg, var(--accent) 0%, #005bb5 100%);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: opacity var(--transition), transform 0.1s ease;
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
    border-radius: inherit;
}

.btn-primary:hover { opacity: 0.9; }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-primary:disabled::before { display: none; }

.btn-loading-state { display: none; align-items: center; justify-content: center; gap: 0.5rem; }
.btn-primary.is-loading .btn-label { display: none; }
.btn-primary.is-loading .btn-loading-state { display: flex; }

.spinner-btn {
    width: 16px; height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    flex-shrink: 0;
}

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

/* ─── Progress Area ─── */
.progress-area {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.progress-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.spinner {
    width: 14px; height: 14px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.cancel-row {
    text-align: center;
    margin-top: 0.75rem;
}

.btn-cancel {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
    font-family: inherit;
    font-weight: 400;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    transition: color var(--transition);
}

.btn-cancel:hover {
    color: var(--error);
}

.log-scroll {
    font-family: 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.75rem;
    line-height: 1.7;
    color: var(--text-muted);
    max-height: 220px;
    overflow-y: auto;
    scroll-behavior: smooth;
    padding-right: 0.5rem;
}

.log-scroll::-webkit-scrollbar { width: 4px; }
.log-scroll::-webkit-scrollbar-track { background: transparent; }
.log-scroll::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 4px;
}

.log-scroll p {
    padding: 0.1rem 0;
    animation: fadeSlide 0.25s ease;
}

.log-scroll p.success { color: var(--success); }
.log-scroll p.warn { color: var(--warn); }

@keyframes fadeSlide {
    from { opacity: 0; transform: translateY(3px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ─── Done Card ─── */
.done-card {
    text-align: center;
    padding: 1.5rem 0 0.5rem;
    animation: fadeSlide 0.4s ease;
}

.done-icon {
    width: 44px; height: 44px;
    background: var(--success);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0 auto 0.75rem;
    box-shadow: 0 4px 12px rgba(52, 199, 89, 0.3);
}

.done-card h3 {
    font-size: 1.15rem;
    font-weight: 600;
}

.done-file {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0.25rem 0 1rem;
}

.btn-download {
    display: inline-block;
    padding: 0.7rem 2rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, var(--accent) 0%, #005bb5 100%);
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: opacity var(--transition);
    position: relative;
}

.btn-download::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
    border-radius: inherit;
}

.btn-download:hover { opacity: 0.9; }

.btn-reset {
    display: block;
    margin: 0.75rem auto 0;
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    font-family: inherit;
    color: var(--accent);
    background: none;
    border: none;
    cursor: pointer;
}

.btn-reset:hover { text-decoration: underline; }

/* ─── Login Error ─── */
.login-error {
    color: var(--error);
    font-size: 0.85rem;
    text-align: center;
    margin-bottom: 0.75rem;
}

/* ─── Error Card ─── */
.error-card {
    text-align: center;
    padding: 1rem 0;
    animation: fadeSlide 0.3s ease;
}

.error-card p {
    font-size: 0.85rem;
    color: var(--error);
    margin-bottom: 0.75rem;
    word-break: break-word;
}

/* ─── Footer ─── */
footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ─── Responsive ─── */
@media (max-width: 640px) {
    main { padding: 1rem; }
    .header h1 { font-size: 1.6rem; }
    .glass-card { padding: 1.25rem; }
    .log-scroll { max-height: 180px; }
}
