/* ============================================
   VARIÁVEIS DE TEMA
   ============================================ */
:root {
    --bg-primary: #f4f4f4;
    --bg-card: #ffffff;
    --bg-input: #ffffff;
    --bg-button: #333333;
    --bg-button-hover: #555555;
    --bg-button-secondary: #666666;
    --bg-button-secondary-hover: #888888;
    --bg-button-success: #28a745;
    --bg-button-success-hover: #218838;
    --bg-button-disabled: #cccccc;
    --bg-keyboard: #333333;
    --bg-keyboard-hover: #555555;
    --bg-keyboard-delete: #dc3545;
    --bg-keyboard-delete-hover: #c82333;
    --bg-error: #f8d7da;
    --bg-summary: #f9f9f9;
    
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-white: #ffffff;
    --text-error: #dc3545;
    --text-success: #28a745;
    --text-disabled: #999999;
    
    --border-default: #dddddd;
    --border-focus: #333333;
    --border-error: #f5c6cb;
    
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-button: 0 1px 4px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] {
    --bg-primary: #0d1117;
    --bg-card: #161b22;
    --bg-input: #1c2128;
    --bg-button: #1f6feb;
    --bg-button-hover: #58a6ff;
    --bg-button-secondary: #30363d;
    --bg-button-secondary-hover: #484f58;
    --bg-button-success: #238636;
    --bg-button-success-hover: #2ea043;
    --bg-button-disabled: #21262d;
    --bg-keyboard: #21262d;
    --bg-keyboard-hover: #30363d;
    --bg-keyboard-delete: #da3633;
    --bg-keyboard-delete-hover: #f85149;
    --bg-error: #5a1a1a;
    --bg-summary: #1c2128;
    
    --text-primary: #e6edf3;
    --text-secondary: #7d8590;
    --text-white: #e6edf3;
    --text-error: #ff6b6b;
    --text-success: #66ff99;
    --text-disabled: #484f58;
    
    --border-default: #30363d;
    --border-focus: #58a6ff;
    --border-error: #da3633;
    
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-button: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* ============================================
   RESET E CONFIGURAÇÕES GLOBAIS
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* ============================================
   CONTAINER PRINCIPAL
   ============================================ */
.container {
    background: var(--bg-card);
    padding: 30px;
    border-radius: 12px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-card);
    transition: all 0.3s ease;
}

/* ============================================
   HEADER
   ============================================ */
.header h1 {
    text-align: center;
    margin-bottom: 20px;
    font-size: 24px;
    color: var(--text-primary);
    font-weight: 700;
    transition: color 0.3s ease;
}

/* ============================================
   MENSAGENS DE ERRO
   ============================================ */
.error-banner {
    color: var(--text-error);
    background: var(--bg-error);
    border: 1px solid var(--border-error);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 14px;
    animation: slideIn 0.3s ease;
    transition: all 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   ETAPAS (STEPS)
   ============================================ */
.step {
    display: none;
}

.step.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.step-label {
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-primary);
    font-size: 14px;
    transition: color 0.3s ease;
}

/* ============================================
   INPUTS E SELECTS
   ============================================ */
input[type="email"],
input[type="text"],
select {
    width: 100%;
    padding: 12px;
    margin-top: 8px;
    margin-bottom: 15px;
    font-size: 16px;
    border: 1px solid var(--border-default);
    border-radius: 8px;
    background: var(--bg-input);
    color: var(--text-primary);
    transition: all 0.3s ease;
    -webkit-user-select: text;
    user-select: text;
}

input[type="email"]:focus,
input[type="text"]:focus,
select:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] input[type="email"]:focus,
[data-theme="dark"] input[type="text"]:focus,
[data-theme="dark"] select:focus {
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}

input[readonly] {
    background: var(--bg-summary);
    cursor: not-allowed;
    opacity: 0.8;
}

select {
    cursor: pointer;
}

/* ============================================
   STATUS DE EMAIL
   ============================================ */
.email-status {
    font-size: 13px;
    margin-top: 5px;
    margin-bottom: 10px;
    min-height: 16px;
    transition: all 0.3s ease;
}

.status-error {
    color: var(--text-error);
    font-weight: 500;
}

.status-success {
    color: var(--text-success);
    font-weight: 500;
}

/* ============================================
   PIN DISPLAY
   ============================================ */
.pin-display {
    font-size: 36px;
    letter-spacing: 20px;
    text-align: center;
    margin: 20px 0;
    color: var(--text-primary);
    transition: color 0.3s ease;
    user-select: none;
}

.pin-dot {
    display: inline-block;
    transition: all 0.2s ease;
}

.pin-error {
    color: var(--text-error);
    font-size: 13px;
    font-weight: 500;
    margin-top: 10px;
    margin-bottom: 10px;
    text-align: center;
    min-height: 18px;
}

/* ============================================
   TECLADO VIRTUAL
   ============================================ */
.keyboard {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 20px;
    margin-bottom: 20px;
}

.keyboard-btn {
    padding: 16px;
    font-size: 20px;
    font-weight: 600;
    background: var(--bg-keyboard);
    color: var(--text-white);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    touch-action: manipulation;
    user-select: none;
}

.keyboard-btn:hover {
    background: var(--bg-keyboard-hover);
    transform: scale(1.05);
}

.keyboard-btn:active {
    transform: scale(0.95);
}

.keyboard-btn.delete-btn {
    background: var(--bg-keyboard-delete);
}

.keyboard-btn.delete-btn:hover {
    background: var(--bg-keyboard-delete-hover);
}

/* ============================================
   BOTÕES
   ============================================ */
button {
    width: 100%;
    padding: 12px;
    margin-top: 10px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    background: var(--bg-button);
    color: var(--text-white);
    border: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    touch-action: manipulation;
    box-shadow: var(--shadow-button);
}

button:hover {
    background: var(--bg-button-hover);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    background: var(--bg-button-disabled);
    color: var(--text-disabled);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.button-group {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.button-group button {
    flex: 1;
    margin-top: 0;
}

.btn-primary {
    background: var(--bg-button);
}

.btn-primary:hover:not(:disabled) {
    background: var(--bg-button-hover);
}

.btn-secondary {
    background: var(--bg-button-secondary);
}

.btn-secondary:hover {
    background: var(--bg-button-secondary-hover);
}

.btn-success {
    background: var(--bg-button-success);
}

.btn-success:hover {
    background: var(--bg-button-success-hover);
}

/* ============================================
   RESUMO
   ============================================ */
.summary {
    background: var(--bg-summary);
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    text-align: left;
    font-size: 14px;
    border: 1px solid var(--border-default);
    transition: all 0.3s ease;
}

.summary p {
    margin: 10px 0;
    line-height: 1.6;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.summary strong {
    color: var(--text-primary);
    font-weight: 600;
    display: inline-block;
    min-width: 80px;
}

/* ============================================
   FOOTER LINKS
   ============================================ */
.footer-links {
    margin-top: 20px;
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.6;
    transition: color 0.3s ease;
}

.footer-links a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    text-decoration: underline;
}

/* ============================================
   RESPONSIVIDADE - TABLETS E DESKTOPS
   ============================================ */

/* Tablets (768px+) */
@media (min-width: 768px) {
    .container {
        max-width: 480px;
        padding: 40px;
    }
    
    .header h1 {
        font-size: 28px;
        margin-bottom: 30px;
    }
    
    .error-banner {
        padding: 14px 16px;
        font-size: 15px;
    }
    
    .step-label {
        font-size: 15px;
        margin-bottom: 12px;
    }
    
    input[type="email"],
    input[type="text"],
    select {
        padding: 14px;
        font-size: 17px;
        margin-bottom: 18px;
    }
    
    .email-status {
        font-size: 14px;
        margin-bottom: 12px;
    }
    
    .pin-display {
        font-size: 42px;
        letter-spacing: 25px;
        margin: 25px 0;
    }
    
    .pin-error {
        font-size: 14px;
    }
    
    .keyboard {
        gap: 12px;
        margin-top: 25px;
        margin-bottom: 25px;
    }
    
    .keyboard-btn {
        padding: 18px;
        font-size: 22px;
    }
    
    button {
        padding: 14px;
        font-size: 17px;
    }
    
    .button-group {
        gap: 12px;
    }
    
    .summary {
        padding: 24px;
        font-size: 15px;
        margin: 24px 0;
    }
    
    .summary p {
        margin: 12px 0;
    }
    
    .summary strong {
        min-width: 90px;
    }
    
    .footer-links {
        font-size: 14px;
        margin-top: 25px;
    }
}

/* Desktops (1024px+) */
@media (min-width: 1024px) {
    .container {
        max-width: 540px;
        padding: 50px;
    }
    
    .header h1 {
        font-size: 32px;
        margin-bottom: 35px;
    }
    
    .error-banner {
        padding: 16px 20px;
        font-size: 16px;
    }
    
    .step-label {
        font-size: 16px;
        margin-bottom: 14px;
    }
    
    input[type="email"],
    input[type="text"],
    select {
        padding: 16px;
        font-size: 18px;
        margin-bottom: 20px;
    }
    
    .pin-display {
        font-size: 48px;
        letter-spacing: 30px;
        margin: 30px 0;
    }
    
    .keyboard {
        gap: 14px;
        margin-top: 30px;
        margin-bottom: 30px;
    }
    
    .keyboard-btn {
        padding: 20px;
        font-size: 24px;
    }
    
    button {
        padding: 16px;
        font-size: 18px;
    }
    
    .summary {
        padding: 28px;
        font-size: 16px;
    }
    
    .summary strong {
        min-width: 100px;
    }
    
    /* Efeitos hover aprimorados para desktop */
    .keyboard-btn:hover {
        transform: scale(1.08);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    }
    
    button:hover:not(:disabled) {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    }
}

/* Telas muito grandes (1440px+) */
@media (min-width: 1440px) {
    .container {
        max-width: 600px;
        padding: 60px;
    }
    
    .header h1 {
        font-size: 36px;
        margin-bottom: 40px;
    }
    
    .pin-display {
        font-size: 54px;
        letter-spacing: 35px;
    }
    
    .keyboard-btn {
        padding: 22px;
        font-size: 26px;
    }
}

/* Mobile pequeno (ajustes) */
@media (max-width: 600px) {
    body {
        padding: 15px;
    }

    .container {
        padding: 20px;
        max-width: 380px;
    }

    .header h1 {
        font-size: 22px;
        margin-bottom: 16px;
    }

    .error-banner {
        padding: 10px;
        font-size: 13px;
    }

    .step-label {
        font-size: 13px;
    }

    input[type="email"],
    input[type="text"],
    select {
        padding: 10px;
        font-size: 15px;
    }

    .pin-display {
        font-size: 32px;
        letter-spacing: 16px;
        margin: 16px 0;
    }

    .keyboard {
        gap: 8px;
        margin-top: 16px;
        margin-bottom: 16px;
    }

    .keyboard-btn {
        padding: 14px;
        font-size: 18px;
    }

    button {
        padding: 11px;
        font-size: 15px;
    }

    .summary {
        padding: 16px;
        font-size: 13px;
    }

    .summary p {
        margin: 8px 0;
    }

    .summary strong {
        min-width: 70px;
        font-size: 13px;
    }

    .footer-links {
        font-size: 12px;
    }
}

@media (max-width: 400px) {
    .container {
        padding: 16px;
        max-width: 340px;
    }

    .header h1 {
        font-size: 20px;
    }

    .pin-display {
        font-size: 28px;
        letter-spacing: 12px;
    }

    .keyboard-btn {
        padding: 12px;
        font-size: 16px;
    }

    button {
        padding: 10px;
        font-size: 14px;
    }

    .button-group {
        gap: 8px;
    }

    .summary strong {
        display: block;
        margin-bottom: 4px;
    }
}