/**
 * ============================================================================
 * RECONECTA - Estilos Premium para High Ticket
 * ============================================================================
 */

/* ============================================================================
   RESET E BASE
   ============================================================================ */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
    color: #1f2937;
    background: linear-gradient(180deg, #fafbfc 0%, #f0f2f5 100%);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================================================
   NAVBAR
   ============================================================================ */

.nav {
    width: 100%;
    height: 80px;
    background: linear-gradient(135deg, #6c0f0f 0%, #8b1a1a 100%);
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 0 24px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(108, 15, 15, 0.3);
}

.nav h2 {
    color: white;
    margin-left: 16px;
    font-weight: 700;
    font-size: 20px;
    letter-spacing: 0.5px;
}

.nav img {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* ============================================================================
   LAYOUT PRINCIPAL
   ============================================================================ */

.principal {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 80px);
    padding: 120px 20px 40px;
    gap: 24px;
}

/* ============================================================================
   CARD PRINCIPAL
   ============================================================================ */

.card {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 32px;
    border-radius: 24px;
    box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(0, 0, 0, 0.03);
    max-width: 480px;
    width: 100%;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #6c0f0f, #b91c1c, #6c0f0f);
}

.card h3 {
    margin-bottom: 24px;
    font-weight: 700;
    font-size: 24px;
    color: #1f2937;
}

/* ============================================================================
   INDICADOR DE PROGRESSO
   ============================================================================ */

.progress-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 28px;
    gap: 8px;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    opacity: 0.4;
    transition: all 0.3s ease;
}

.step.active {
    opacity: 1;
}

.step.current .step-circle {
    background: linear-gradient(135deg, #6c0f0f 0%, #9a1515 100%);
    color: white;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(108, 15, 15, 0.4);
}

.step.completed .step-circle {
    background: #10b981;
    color: white;
}

.step-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #e5e7eb;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
}

.step span {
    font-size: 12px;
    font-weight: 500;
    color: #6b7280;
    white-space: nowrap;
}

.step.active span {
    color: #1f2937;
}

.step-line {
    width: 40px;
    height: 2px;
    background: #e5e7eb;
    margin-bottom: 22px;
    transition: background 0.3s ease;
}

.step-line.active {
    background: #10b981;
}

/* ============================================================================
   INSTRUÇÕES
   ============================================================================ */

#instructions {
    text-align: left;
    list-style: none;
    margin: 0 0 20px 0;
    padding: 0;
}

#instructions li {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    margin-bottom: 6px;
    background: rgba(108, 15, 15, 0.03);
    border-radius: 10px;
    font-size: 15px;
    color: #374151;
}

#instructions li:last-child {
    margin-bottom: 0;
}

.step-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin-right: 14px;
    flex-shrink: 0;
    background: rgba(108, 15, 15, 0.08);
    border-radius: 10px;
    color: #6c0f0f;
}

.step-icon svg {
    width: 18px;
    height: 18px;
}

/* ============================================================================
   QR CODE
   ============================================================================ */

#qrcode {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
    width: 100%;
    min-height: 0;
}

#qrcode:empty {
    display: none;
}

#qrcode img {
    border-radius: 16px;
    padding: 16px;
    background: white;
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(0, 0, 0, 0.05);
    width: 100%;
    max-width: 320px;
    height: auto;
    animation: qrFadeIn 0.5s ease-out;
}

@keyframes qrFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Contador de expiração do QR */
.qr-countdown {
    margin-top: 12px;
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
    transition: color 0.3s ease;
}

.qr-countdown.warning {
    color: #dc2626;
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ============================================================================
   BOTÃO PREMIUM
   ============================================================================ */

#connectBtn {
    padding: 18px 48px;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    background: linear-gradient(135deg, #6c0f0f 0%, #9a1515 100%);
    border: none;
    border-radius: 14px;
    color: white;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow:
        0 4px 15px rgba(108, 15, 15, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Efeito shine no hover */
#connectBtn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

#connectBtn:hover::before {
    left: 100%;
}

#connectBtn:hover {
    transform: translateY(-3px);
    box-shadow:
        0 8px 25px rgba(108, 15, 15, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

#connectBtn:active {
    transform: translateY(-1px);
}

#connectBtn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    background: linear-gradient(135deg, #6b7280 0%, #9ca3af 100%);
    box-shadow: 0 4px 15px rgba(107, 114, 128, 0.3);
}

#connectBtn:disabled::before {
    display: none;
}

/* Focus visible para acessibilidade */
#connectBtn:focus-visible {
    outline: none;
    box-shadow:
        0 0 0 3px white,
        0 0 0 6px #6c0f0f,
        0 4px 15px rgba(108, 15, 15, 0.4);
}

/* ============================================================================
   SPINNERS
   ============================================================================ */

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.big-spinner {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, transparent, #6c0f0f);
    mask: radial-gradient(farthest-side, transparent calc(100% - 4px), black calc(100% - 4px));
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), black calc(100% - 4px));
    animation: spin 1s linear infinite;
    margin: 40px auto;
}

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

/* Spinner de loading alternativo (dots) */
.loading-dots {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin: 40px 0;
}

.loading-dots span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #6c0f0f;
    animation: bounce 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }
.loading-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ============================================================================
   MENSAGENS DE FEEDBACK
   ============================================================================ */

/* Mensagem de erro */
.error-message {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 12px;
    color: #dc2626;
    font-weight: 500;
    font-size: 15px;
    max-width: 480px;
    width: 100%;
    animation: slideIn 0.3s ease-out;
}

.error-message:not(:empty) {
    display: flex;
}

.error-message svg {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

/* Mensagem de sucesso */
.success-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    animation: fadeInUp 0.5s ease-out;
}

.success-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.3);
    animation: scaleIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.success-icon svg {
    width: 40px;
    height: 40px;
    color: white;
    stroke: white;
    stroke-width: 3;
}

.success-title {
    font-size: 24px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 8px;
}

.success-subtitle {
    font-size: 16px;
    color: #6b7280;
    line-height: 1.5;
}

.success-subtitle strong {
    color: #1f2937;
    font-weight: 600;
}

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

@keyframes scaleIn {
    from {
        transform: scale(0);
    }
    to {
        transform: scale(1);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================================================
   BADGE DE SEGURANÇA
   ============================================================================ */

.security-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 100px;
    color: #059669;
    font-size: 13px;
    font-weight: 500;
}

.security-badge svg {
    flex-shrink: 0;
}

/* ============================================================================
   FOOTER
   ============================================================================ */

.footer {
    text-align: center;
    padding: 24px 20px;
    color: #6b7280;
    font-size: 13px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    background: rgba(255, 255, 255, 0.5);
}

.footer a {
    color: #6c0f0f;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.footer a:hover {
    color: #9a1515;
    text-decoration: underline;
}

.footer .copyright {
    margin-top: 8px;
    opacity: 0.7;
}

/* ============================================================================
   ACESSIBILIDADE - FOCO VISÍVEL
   ============================================================================ */

*:focus-visible {
    outline: 3px solid #6c0f0f;
    outline-offset: 2px;
}

a:focus-visible,
button:focus-visible {
    outline: 3px solid #6c0f0f;
    outline-offset: 2px;
}

/* ============================================================================
   RESPONSIVIDADE
   ============================================================================ */

@media (max-width: 768px) {
    .nav {
        height: 70px;
        padding: 0 16px;
    }

    .nav img {
        width: 42px;
        height: 42px;
    }

    .nav h2 {
        font-size: 18px;
    }

    .principal {
        padding: 100px 16px 32px;
        gap: 20px;
    }

    .card {
        padding: 24px 20px;
        border-radius: 20px;
    }

    .card h3 {
        font-size: 20px;
        margin-bottom: 20px;
    }

    .progress-steps {
        margin-bottom: 24px;
    }

    .step-circle {
        width: 32px;
        height: 32px;
        font-size: 13px;
    }

    .step span {
        font-size: 11px;
    }

    .step-line {
        width: 24px;
    }

    #instructions li {
        padding: 10px 14px;
        font-size: 14px;
    }

    .step-icon {
        width: 32px;
        height: 32px;
        margin-right: 12px;
    }

    .step-icon svg {
        width: 16px;
        height: 16px;
    }

    #connectBtn {
        padding: 16px 36px;
        font-size: 15px;
        border-radius: 12px;
    }

    #qrcode img {
        max-width: 280px;
        padding: 12px;
    }

    .security-badge {
        font-size: 12px;
        padding: 8px 14px;
    }

    .error-message {
        font-size: 14px;
        padding: 14px 16px;
    }

    .success-icon {
        width: 64px;
        height: 64px;
    }

    .success-icon svg {
        width: 32px;
        height: 32px;
    }

    .success-title {
        font-size: 20px;
    }

    .success-subtitle {
        font-size: 14px;
    }
}

@media (max-width: 380px) {
    .progress-steps {
        gap: 4px;
    }

    .step-circle {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    .step span {
        font-size: 10px;
    }

    .step-line {
        width: 16px;
    }

    #instructions li {
        padding: 10px 12px;
        font-size: 13px;
    }

    .step-icon {
        width: 28px;
        height: 28px;
        margin-right: 10px;
    }

    .step-icon svg {
        width: 14px;
        height: 14px;
    }
}

/* ============================================================================
   UTILITÁRIOS
   ============================================================================ */

.hidden {
    display: none !important;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
