/* ===== CSS RESET & BASE ===== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: rgba(37, 99, 235, 0.08);
    --success: #16a34a;
    --success-bg: #dcfce7;
    --error: #dc2626;
    --error-bg: #fef2f2;
    --bg: #0f172a;
    --bg-card: #1e293b;
    --bg-input: #334155;
    --text: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: #475569;
    --border-focus: #60a5fa;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.4);
    --transition: 0.2s ease;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ===== HEADER ===== */
.header {
    display: flex;
    align-items: center;
    padding: 16px 24px;
    background: rgba(30, 41, 59, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header__logo {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    text-decoration: none;
}

.header__icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    color: white;
}

.header__title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.5px;
}

/* ===== MAIN ===== */
.main {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: calc(100vh - 69px);
    padding: 48px 16px;
}

/* ===== CARD ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
    width: 100%;
    max-width: 460px;
    box-shadow: var(--shadow-lg);
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card__title {
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.card__subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 28px;
    line-height: 1.5;
}

/* ===== TABS ===== */
.tabs {
    display: flex;
    border-radius: var(--radius-sm);
    background: var(--bg);
    padding: 4px;
    margin-bottom: 24px;
    gap: 4px;
}

.tabs__btn {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
}

.tabs__btn:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
}

.tabs__btn--active {
    background: var(--primary) !important;
    color: white !important;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

/* ===== INFO BOX ===== */
.info-box {
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 13px;
    line-height: 1.5;
    border: 1px solid;
}

.info-box--primary {
    background: var(--primary-light);
    border-color: rgba(37, 99, 235, 0.2);
    color: #93c5fd;
}

.info-box--secondary {
    background: rgba(124, 58, 237, 0.08);
    border-color: rgba(124, 58, 237, 0.2);
    color: #c4b5fd;
}

.info-box strong {
    display: block;
    margin-bottom: 4px;
    font-size: 14px;
}

/* ===== FORM ===== */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 15px;
    transition: var(--transition);
    outline: none;
}

.form-group input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.15);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-group .helper {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ===== BUTTONS ===== */
.btn {
    width: 100%;
    padding: 14px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn--primary {
    background: linear-gradient(135deg, var(--primary), #4f46e5);
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    margin-top: 24px;
}

.btn--primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.btn--primary:active {
    transform: translateY(0);
}

.btn--primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn--outline {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--border);
}

.btn--outline:hover {
    background: var(--primary-light);
    border-color: var(--primary);
}

.btn-row {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.btn-row .btn {
    margin-top: 0;
}

/* ===== ALERT ===== */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 16px;
    display: none;
}

.alert--error {
    background: var(--error-bg);
    color: var(--error);
    border: 1px solid rgba(220, 38, 38, 0.2);
}

.alert--success {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid rgba(22, 163, 74, 0.2);
}

.alert.visible {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* ===== LINK ===== */
.link-text {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: var(--text-secondary);
}

.link-text a,
.link-text button {
    background: none;
    border: none;
    color: var(--primary);
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    font-weight: 500;
}

.link-text a:hover,
.link-text button:hover {
    text-decoration: underline;
}

/* ===== SUCCESS PAGE ===== */
.success-icon {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, var(--success), #22c55e);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 36px;
    box-shadow: 0 4px 20px rgba(22, 163, 74, 0.3);
}

.download-section {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 20px;
    margin-top: 24px;
    text-align: center;
}

.download-section h3 {
    font-size: 16px;
    margin-bottom: 12px;
}

.download-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--primary), #4f46e5);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
}

.download-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4);
}

.download-btn--secondary {
    background: transparent !important;
    border: 1px solid var(--border);
    box-shadow: none;
}

.download-btn--secondary:hover {
    background: var(--primary-light) !important;
    border-color: var(--primary);
}

/* ===== TOAST ===== */
.toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 14px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    font-size: 14px;
    font-weight: 500;
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
    max-width: 400px;
    text-align: center;
}

.toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast--success {
    border-color: var(--success);
    color: var(--success);
}

.toast--error {
    border-color: var(--error);
    color: var(--error);
}

/* ===== SPINNER ===== */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 520px) {
    .card {
        padding: 28px 20px;
    }

    .main {
        padding: 24px 12px;
    }

    .card__title {
        font-size: 20px;
    }

    .btn-row {
        flex-direction: column;
    }
}