/* ==========================================================================
   TagWhite Password Setup Suite (Mobile-First Viewport Optimized)
   ========================================================================== */

:root {
    --tw-blue-primary: #2563eb;
    --tw-blue-hover: #1d4ed8;
    --tw-blue-soft: #eff6ff;
    --tw-emerald: #10b981;
    --tw-emerald-bg: #ecfdf5;
    --tw-dark: #0f172a;
    --tw-gray-700: #334155;
    --tw-gray-500: #64748b;
    --tw-gray-400: #94a3b8;
    --tw-gray-200: #e2e8f0;
    --tw-gray-100: #f8fafc;
    --tw-red-bg: #fef2f2;
    --tw-red-text: #991b1b;
    --tw-red-border: #fecaca;
    --tw-radius: 12px;
    --tw-transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base Layout & Reset */
.tw-setup-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #ffffff;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: var(--tw-dark);
    padding: 16px;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

.tw-setup-shell {
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-sizing: border-box;
}

/* Header & Branding */
.tw-setup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.tw-setup-brand {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.tw-setup-brand-text {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--tw-dark);
}

.tw-setup-header-link {
    font-size: 0.825rem;
    font-weight: 600;
    color: var(--tw-blue-primary);
    text-decoration: none;
    transition: var(--tw-transition);
}

.tw-setup-header-link:hover {
    color: var(--tw-blue-hover);
    text-decoration: underline;
}

.tw-setup-badge {
    display: inline-flex;
    align-items: center;
    background-color: var(--tw-emerald-bg);
    color: #047857;
    border: 1px solid #a7f3d0;
    padding: 4px 10px;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Step Progress Bar */
.tw-setup-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: 16px;
}

.tw-setup-step {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background-color: var(--tw-gray-100);
    border: 1.5px solid var(--tw-gray-200);
    color: var(--tw-gray-400);
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--tw-transition);
}

.tw-setup-step.active {
    background-color: var(--tw-blue-primary);
    border-color: var(--tw-blue-primary);
    color: #ffffff;
    box-shadow: 0 0 0 3px var(--tw-blue-soft);
}

.tw-setup-step.completed {
    background-color: var(--tw-emerald);
    border-color: var(--tw-emerald);
    color: #ffffff;
}

.tw-setup-line {
    flex: 1;
    max-width: 40px;
    height: 2px;
    background-color: var(--tw-gray-200);
    border-radius: 2px;
    transition: var(--tw-transition);
}

.tw-setup-line.active {
    background-color: var(--tw-emerald);
}

/* Headline Section */
.tw-setup-headline {
    margin-bottom: 16px;
}

.tw-setup-headline h1 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    color: var(--tw-dark);
    margin: 0 0 4px 0;
    line-height: 1.25;
}

.tw-setup-headline p {
    font-size: 0.875rem;
    color: var(--tw-gray-500);
    margin: 0;
    line-height: 1.4;
}

/* Alert Box */
.tw-setup-alert {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: var(--tw-red-bg);
    border: 1px solid var(--tw-red-border);
    color: var(--tw-red-text);
    padding: 10px 14px;
    border-radius: var(--tw-radius);
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 14px;
}

.tw-setup-alert svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Form Controls */
.tw-setup-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.tw-setup-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tw-setup-label {
    font-size: 0.825rem;
    font-weight: 600;
    color: var(--tw-gray-700);
}

.tw-setup-input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.tw-setup-prefix {
    position: absolute;
    left: 14px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--tw-gray-500);
    user-select: none;
    pointer-events: none;
}

.tw-setup-input {
    width: 100%;
    height: 48px;
    background-color: var(--tw-gray-100);
    border: 1.5px solid var(--tw-gray-200);
    border-radius: var(--tw-radius);
    padding: 0 14px;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--tw-dark);
    box-sizing: border-box;
    transition: var(--tw-transition);
    outline: none;
}

.tw-setup-input-mobile {
    padding-left: 50px;
    letter-spacing: 0.04em;
}

.tw-setup-input-otp {
    letter-spacing: 0.4em;
    font-size: 1.25rem;
    font-weight: 700;
    text-align: center;
}

.tw-setup-input-password {
    padding-right: 44px;
}

.tw-setup-input::placeholder {
    color: var(--tw-gray-400);
    font-weight: 400;
    letter-spacing: normal;
}

.tw-setup-input:focus {
    background-color: #ffffff;
    border-color: var(--tw-blue-primary);
    box-shadow: 0 0 0 4px var(--tw-blue-soft);
}

.tw-setup-toggle-pw {
    position: absolute;
    right: 6px;
    background: transparent;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--tw-gray-400);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: var(--tw-transition);
}

.tw-setup-toggle-pw:hover {
    color: var(--tw-gray-700);
    background-color: rgba(0, 0, 0, 0.04);
}

.tw-setup-toggle-pw svg {
    width: 20px;
    height: 20px;
}

/* Primary Submit Button */
.tw-setup-submit {
    height: 50px;
    margin-top: 4px;
    background-color: var(--tw-blue-primary);
    color: #ffffff;
    border: none;
    border-radius: var(--tw-radius);
    font-size: 0.975rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
    transition: var(--tw-transition);
    -webkit-tap-highlight-color: transparent;
}

.tw-setup-submit:hover {
    background-color: var(--tw-blue-hover);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
    transform: translateY(-1px);
}

.tw-setup-submit:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}

/* Secondary Navigation Block */
.tw-setup-nav-footer {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px dashed var(--tw-gray-200);
    text-align: center;
}

.tw-setup-nav-footer p {
    font-size: 0.8rem;
    color: var(--tw-gray-500);
    margin: 0 0 4px 0;
}

.tw-setup-nav-link {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--tw-blue-primary);
    text-decoration: none;
    transition: var(--tw-transition);
    display: inline-block;
}

.tw-setup-nav-link:hover {
    color: var(--tw-blue-hover);
    text-decoration: underline;
}

/* Footer / Trust Badge */
.tw-setup-footer {
    margin-top: 20px;
    display: flex;
    justify-content: center;
}

.tw-setup-trust {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--tw-gray-500);
    font-size: 0.775rem;
    font-weight: 500;
}

.tw-setup-trust svg {
    width: 14px;
    height: 14px;
    stroke: var(--tw-emerald);
}

/* Desktop Screens (> 480px) */
@media (min-width: 481px) {
    .tw-setup-page {
        background-color: var(--tw-gray-100);
        padding: 32px 16px;
    }

    .tw-setup-shell {
        background-color: #ffffff;
        border-radius: 20px;
        padding: 36px 32px;
        box-shadow: 0 20px 25px -5px rgba(15, 23, 42, 0.05), 0 8px 10px -6px rgba(15, 23, 42, 0.03);
        border: 1px solid var(--tw-gray-200);
    }
}