/* =============================================================================
   Caixa Setup & Login — Premium Monocromática Identity
   Inspired by NFe Module & Dashboard Design System
   ========================================================================= */

/* =============================================================================
   DESIGN TOKENS (scoped to .caixa-setup-module)
   ========================================================================= */
.caixa-setup-module {
    --cx-font-sans: "Inter", "Segoe UI", sans-serif;
    --cx-font-display: "Poppins", "Inter", "Segoe UI", sans-serif;
    --cx-ink: #111111;
    --cx-ink-soft: #4d4d4d;
    --cx-ink-muted: #8b8b8b;
    --cx-surface: #ffffff;
    --cx-surface-alt: #f6f6f6;
    --cx-border: #e4e4e4;
    --cx-border-strong: #cacaca;
    --cx-primary: #111111;
    --cx-primary-soft: rgba(17, 17, 17, 0.08);
    --cx-danger: #d92d20;
    --cx-danger-soft: rgba(217, 45, 32, 0.08);
    --cx-warning: #f79009;
    --cx-warning-soft: rgba(247, 144, 9, 0.08);
    --cx-success: #12b76a;
    --cx-success-soft: rgba(18, 183, 106, 0.08);
    --cx-info: #1570ef;
    --cx-info-soft: rgba(21, 112, 239, 0.08);
    --cx-shadow-soft: 0 18px 32px rgba(17, 17, 17, 0.06);
    --cx-shadow-strong: 0 28px 52px rgba(17, 17, 17, 0.08);
    --cx-radius-xl: 28px;
    --cx-radius-lg: 22px;
    --cx-radius-md: 16px;
    --cx-radius-sm: 12px;
    --cx-radius-xs: 8px;
    --cx-transition: 220ms cubic-bezier(.4, 0, .2, 1);
}

/* =============================================================================
   BASE MODULE
   ========================================================================= */
.caixa-setup-module {
    position: relative;
    width: 100vw;
    height: 100vh;
    background: var(--cx-surface-alt);
    color: var(--cx-ink);
    font-family: var(--cx-font-sans);
    overflow: hidden;
    margin: 0;
}

.caixa-setup-module * {
    box-sizing: border-box;
}

/* =============================================================================
   SCREEN OVERLAYS
   ========================================================================= */
.cx-screen {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    background: var(--cx-surface-alt);
    transition: opacity 0.5s cubic-bezier(.4, 0, .2, 1),
                transform 0.5s cubic-bezier(.4, 0, .2, 1);
    padding: clamp(16px, 4vw, 32px);
}

.cx-screen.hidden {
    opacity: 0;
    transform: translateY(-30px);
    pointer-events: none;
}

/* =============================================================================
   HERO BRANDING
   ========================================================================= */
.cx-hero-brand {
    text-align: center;
    margin-bottom: clamp(24px, 4vw, 40px);
    animation: cxFadeSlideIn 0.5s ease both;
}

.cx-hero-icon {
    width: 72px;
    height: 72px;
    border-radius: var(--cx-radius-md);
    background: var(--cx-ink);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: #fff;
    margin-bottom: 20px;
    box-shadow: var(--cx-shadow-strong);
}

.cx-hero-brand h1 {
    margin: 0;
    font-family: var(--cx-font-display);
    font-size: clamp(24px, 4vw, 36px);
    font-weight: 800;
    color: var(--cx-ink);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.cx-hero-brand p {
    margin: 8px 0 0;
    font-size: clamp(13px, 2vw, 16px);
    color: var(--cx-ink-muted);
    font-weight: 400;
}

/* =============================================================================
   CARD CONTAINER
   ========================================================================= */
.cx-card {
    background: var(--cx-surface);
    border-radius: var(--cx-radius-lg);
    padding: clamp(24px, 4vw, 40px);
    max-width: 520px;
    width: 100%;
    box-shadow: var(--cx-shadow-strong);
    border: 1px solid var(--cx-border);
    animation: cxFadeSlideIn 0.5s 0.15s ease both;
}

.cx-card-title {
    margin: 0 0 24px;
    font-family: var(--cx-font-display);
    font-size: clamp(16px, 2.5vw, 20px);
    font-weight: 700;
    color: var(--cx-ink);
    text-align: center;
}

/* =============================================================================
   FORM ELEMENTS
   ========================================================================= */
.cx-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cx-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cx-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--cx-ink-soft);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.cx-input {
    width: 100%;
    padding: 14px 18px;
    border: 1px solid var(--cx-border);
    border-radius: var(--cx-radius-xs);
    font-size: 15px;
    font-family: var(--cx-font-sans);
    background: var(--cx-surface);
    color: var(--cx-ink);
    outline: none;
    transition: border-color var(--cx-transition),
                box-shadow var(--cx-transition);
}

.cx-input:focus {
    border-color: var(--cx-ink);
    box-shadow: 0 0 0 3px var(--cx-primary-soft);
}

.cx-input::placeholder {
    color: var(--cx-ink-muted);
    font-weight: 400;
}

.cx-input--center {
    text-align: center;
    font-weight: 600;
    font-size: 16px;
    letter-spacing: 0.02em;
}

/* =============================================================================
   BUTTONS
   ========================================================================= */
.cx-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 28px;
    border: none;
    border-radius: var(--cx-radius-xs);
    font-family: var(--cx-font-sans);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--cx-transition);
    white-space: nowrap;
    width: 100%;
}

.cx-btn-primary {
    background: var(--cx-ink);
    color: #fff;
}

.cx-btn-primary:hover {
    background: #333;
    transform: translateY(-1px);
    box-shadow: var(--cx-shadow-soft);
}

.cx-btn-secondary {
    background: var(--cx-surface);
    color: var(--cx-ink-soft);
    border: 1px solid var(--cx-border);
}

.cx-btn-secondary:hover {
    background: var(--cx-surface-alt);
    border-color: var(--cx-border-strong);
    color: var(--cx-ink);
}

.cx-btn-danger {
    background: var(--cx-danger);
    color: #fff;
}

.cx-btn-danger:hover {
    filter: brightness(1.1);
}

.cx-btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.cx-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* =============================================================================
   STATUS MESSAGES
   ========================================================================= */
.cx-status {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--cx-radius-xs);
    font-size: 13px;
    font-weight: 500;
    margin-top: 16px;
    animation: cxFadeSlideIn 0.3s ease both;
}

.cx-status.visible {
    display: flex;
}

.cx-status.checking {
    background: var(--cx-warning-soft);
    color: #93370d;
    border: 1px solid rgba(247, 144, 9, 0.2);
}

.cx-status.ready {
    background: var(--cx-success-soft);
    color: #065f46;
    border: 1px solid rgba(18, 183, 106, 0.2);
}

.cx-status.error {
    background: var(--cx-danger-soft);
    color: #991b1b;
    border: 1px solid rgba(217, 45, 32, 0.2);
}

.cx-status i {
    font-size: 14px;
    flex-shrink: 0;
}

/* =============================================================================
   SAVED ID PANEL
   ========================================================================= */
.cx-saved-info {
    display: none;
    margin-top: 20px;
    padding: 14px 16px;
    background: var(--cx-primary-soft);
    border: 1px solid var(--cx-border);
    border-radius: var(--cx-radius-xs);
    animation: cxFadeSlideIn 0.3s ease both;
}

.cx-saved-info.visible {
    display: block;
}

.cx-saved-info-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.cx-saved-info-text {
    flex: 1;
}

.cx-saved-info-text strong {
    font-size: 13px;
    color: var(--cx-ink);
    display: block;
    margin-bottom: 2px;
}

.cx-saved-info-text small {
    font-size: 11px;
    color: var(--cx-ink-muted);
}

/* =============================================================================
   LOGIN SCREEN EXTRAS
   ========================================================================= */
.cx-register-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: var(--cx-primary-soft);
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    color: var(--cx-ink);
    margin-top: 8px;
}

.cx-register-badge i {
    font-size: 12px;
    color: var(--cx-ink-muted);
}

.cx-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 4px 0;
}

.cx-divider::before,
.cx-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--cx-border);
}

.cx-divider span {
    font-size: 11px;
    color: var(--cx-ink-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* =============================================================================
   ANIMATIONS
   ========================================================================= */
@keyframes cxFadeSlideIn {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

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

/* =============================================================================
   RESPONSIVE
   ========================================================================= */
@media (max-width: 640px) {
    .cx-card {
        padding: 24px 20px;
        border-radius: var(--cx-radius-md);
    }

    .cx-hero-icon {
        width: 56px;
        height: 56px;
        font-size: 22px;
    }

    .cx-input {
        padding: 12px 14px;
        font-size: 14px;
    }

    .cx-btn {
        padding: 12px 20px;
    }
}

@media (max-width: 480px) {
    .cx-hero-brand {
        margin-bottom: 20px;
    }

    .cx-card {
        padding: 20px 16px;
    }

    .cx-saved-info-content {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
}
