/* ============================================
   VARIÁVEIS DE TEMA
   ============================================ */
:root {
    --bg-primary: #f2f2f7;
    --bg-card: #ffffff;
    --bg-input: #f2f2f7;
    --bg-input-focus: #ffffff;
    --bg-button: #007aff;
    --bg-button-hover: #0051d5;
    --bg-key: #f2f2f7;
    --bg-key-hover: #e5e5ea;
    --bg-key-active: #d1d1d6;
    
    --text-primary: #000000;
    --text-secondary: #8e8e93;
    --text-white: #ffffff;
    --text-link: #007aff;
    
    --border-input: #d1d1d6;
    --border-input-focus: #007aff;
    
    --error-bg: #ff3b30;
    --error-text: #ffffff;
    --wait-bg: #fff3cd;
    --wait-border: #ffc107;
    --wait-text: #856404;
    
    --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] {
    --bg-primary: #0d1117;
    --bg-card: #161b22;
    --bg-input: #21262d;
    --bg-input-focus: #161b22;
    --bg-button: #1f6feb;
    --bg-button-hover: #58a6ff;
    --bg-key: #21262d;
    --bg-key-hover: #2d333b;
    --bg-key-active: #373e47;
    
    --text-primary: #e6edf3;
    --text-secondary: #7d8590;
    --text-white: #e6edf3;
    --text-link: #58a6ff;
    
    --border-input: #30363d;
    --border-input-focus: #58a6ff;
    
    --error-bg: #f85149;
    --error-text: #ffffff;
    --wait-bg: #3d2e00;
    --wait-border: #f0c36d;
    --wait-text: #f0c36d;
    
    --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.4);
}

/* ============================================
   RESET E CONFIGURAÇÕES GLOBAIS
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* ============================================
   CONTAINER
   ============================================ */
.container {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 500px;
    margin: 0 auto;
    width: 100%;
    padding: 20px;
}

/* ============================================
   HEADER
   ============================================ */
.header {
    text-align: center;
    padding: 40px 0 30px;
}

.header h1 {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.header p {
    font-size: 15px;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

/* ============================================
   CONTENT
   ============================================ */
.content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-bottom: 20px;
}

/* ============================================
   CARD
   ============================================ */
.card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow-card);
    transition: all 0.3s ease;
}

/* ============================================
   USER GREETING
   ============================================ */
.user-greeting {
    text-align: center;
    color: var(--text-secondary);
    font-size: 15px;
    margin-bottom: 24px;
    transition: color 0.3s ease;
}

.user-greeting strong {
    color: var(--text-primary);
    font-weight: 600;
    transition: color 0.3s ease;
}

/* ============================================
   DOTS (PIN INDICATORS)
   ============================================ */
.dots {
    text-align: center;
    font-size: 32px;
    letter-spacing: 12px;
    margin: 20px 0;
    min-height: 40px;
    white-space: nowrap;
    overflow: hidden;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

/* ============================================
   INPUT GROUP
   ============================================ */
.input-group {
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.input-group input {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    border: 1px solid var(--border-input);
    border-radius: 10px;
    background: var(--bg-input);
    color: var(--text-primary);
    transition: all 0.2s ease;
    touch-action: manipulation;
}

.input-group input:focus {
    outline: none;
    border-color: var(--border-input-focus);
    background: var(--bg-input-focus);
}

.input-group input::placeholder {
    color: var(--text-secondary);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    touch-action: manipulation;
}

.btn-primary {
    background: var(--bg-button);
    color: var(--text-white);
}

.btn-primary:hover {
    background: var(--bg-button-hover);
}

.btn-primary:active {
    transform: scale(0.98);
}

/* ============================================
   KEYPAD
   ============================================ */
.keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 20px 0;
}

.key {
    background: var(--bg-key);
    border: none;
    border-radius: 10px;
    height: 60px;
    font-size: 24px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    color: var(--text-primary);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

.key:hover {
    background: var(--bg-key-hover);
}

.key:active {
    transform: scale(0.95);
    background: var(--bg-key-active);
}

.key.key-special {
    font-size: 20px;
}

/* ============================================
   ERROR & ALERTS
   ============================================ */
.error-banner {
    background: var(--error-bg);
    color: var(--error-text);
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 14px;
    animation: slideIn 0.3s ease;
    transition: all 0.3s ease;
}

.attempts-info {
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
    margin: 12px 0;
    transition: color 0.3s ease;
}

.wait-timer {
    background: var(--wait-bg);
    border: 1px solid var(--wait-border);
    color: var(--wait-text);
    padding: 12px 16px;
    border-radius: 10px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 16px;
    transition: all 0.3s ease;
}

.blocked-message {
    background: var(--error-bg);
    color: var(--error-text);
    padding: 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.6;
    transition: all 0.3s ease;
}

.blocked-message a {
    color: var(--error-text);
    text-decoration: underline;
    font-weight: 600;
}

/* ============================================
   FOOTER LINKS
   ============================================ */
.footer-links {
    margin-top: 20px;
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.8;
    transition: color 0.3s ease;
}

.footer-links a {
    color: var(--text-link);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    text-decoration: underline;
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   RESPONSIVIDADE - MOBILE PEQUENO
   ============================================ */
@media (max-width: 400px) {
    .container {
        padding: 16px;
    }
    
    .header {
        padding: 25px 0 20px;
    }
    
    .header h1 {
        font-size: 24px;
    }
    
    .header p {
        font-size: 14px;
    }
    
    .card {
        padding: 20px;
        border-radius: 14px;
    }
    
    .dots {
        font-size: 26px;
        letter-spacing: 10px;
    }
    
    .key {
        height: 52px;
        font-size: 20px;
        border-radius: 8px;
    }
    
    .key.key-special {
        font-size: 18px;
    }
    
    .input-group input {
        padding: 12px 14px;
        font-size: 15px;
    }
    
    .btn {
        padding: 12px;
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 30px 0 20px;
    }
    
    .header h1 {
        font-size: 26px;
    }
    
    .dots {
        font-size: 28px;
    }
    
    .key {
        height: 55px;
        font-size: 22px;
    }
}

@media (max-width: 360px) {
    .dots {
        font-size: 22px;
        letter-spacing: 8px;
    }
    
    .key {
        height: 50px;
        font-size: 19px;
    }
}

/* Modo paisagem mobile */
@media (max-height: 600px) and (orientation: landscape) {
    .header {
        padding: 20px 0 15px;
    }
    
    .header h1 {
        font-size: 22px;
    }
    
    .header p {
        font-size: 13px;
    }
    
    .dots {
        margin: 15px 0;
        font-size: 26px;
    }
    
    .key {
        height: 48px;
        font-size: 20px;
    }
    
    .keypad {
        gap: 8px;
        margin: 15px 0;
    }
}

/* ============================================
   RESPONSIVIDADE - TABLETS
   ============================================ */
@media (min-width: 768px) {
    .container {
        max-width: 600px;
        padding: 24px 32px;
    }
    
    .header {
        padding: 50px 0 40px;
    }
    
    .header h1 {
        font-size: 32px;
        margin-bottom: 10px;
    }
    
    .header p {
        font-size: 17px;
    }
    
    .card {
        padding: 32px;
        border-radius: 18px;
    }
    
    .user-greeting {
        font-size: 17px;
        margin-bottom: 28px;
    }
    
    .dots {
        font-size: 36px;
        letter-spacing: 14px;
        margin: 24px 0;
        min-height: 48px;
    }
    
    .input-group {
        margin-bottom: 18px;
    }
    
    .input-group label {
        font-size: 15px;
        margin-bottom: 10px;
    }
    
    .input-group input {
        padding: 16px 18px;
        font-size: 17px;
        border-radius: 12px;
    }
    
    .btn {
        padding: 16px;
        font-size: 17px;
        border-radius: 12px;
    }
    
    .keypad {
        gap: 12px;
        margin: 24px 0;
    }
    
    .key {
        height: 68px;
        font-size: 26px;
        border-radius: 12px;
    }
    
    .key.key-special {
        font-size: 22px;
    }
    
    .error-banner,
    .wait-timer,
    .blocked-message {
        padding: 14px 18px;
        font-size: 15px;
        border-radius: 12px;
    }
    
    .attempts-info {
        font-size: 14px;
    }
    
    .footer-links {
        margin-top: 24px;
        font-size: 14px;
    }
}

/* ============================================
   RESPONSIVIDADE - DESKTOPS
   ============================================ */
@media (min-width: 1024px) {
    .container {
        max-width: 700px;
        padding: 32px 48px;
    }
    
    .header {
        padding: 60px 0 50px;
    }
    
    .header h1 {
        font-size: 36px;
        margin-bottom: 12px;
    }
    
    .header p {
        font-size: 18px;
    }
    
    .card {
        padding: 40px;
        border-radius: 20px;
    }
    
    .user-greeting {
        font-size: 18px;
        margin-bottom: 32px;
    }
    
    .dots {
        font-size: 40px;
        letter-spacing: 16px;
        margin: 28px 0;
        min-height: 52px;
    }
    
    .input-group {
        margin-bottom: 20px;
    }
    
    .input-group label {
        font-size: 16px;
        margin-bottom: 12px;
    }
    
    .input-group input {
        padding: 18px 20px;
        font-size: 18px;
        border-radius: 14px;
    }
    
    .btn {
        padding: 18px;
        font-size: 18px;
        border-radius: 14px;
    }
    
    .keypad {
        gap: 14px;
        margin: 28px 0;
    }
    
    .key {
        height: 72px;
        font-size: 28px;
        border-radius: 14px;
    }
    
    .key.key-special {
        font-size: 24px;
    }
    
    .error-banner,
    .wait-timer,
    .blocked-message {
        padding: 16px 20px;
        font-size: 16px;
        border-radius: 14px;
    }
    
    .attempts-info {
        font-size: 15px;
    }
    
    .footer-links {
        margin-top: 28px;
        font-size: 15px;
    }
    
    /* Efeitos hover para desktop */
    .btn-primary:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
    }
    
    .key:hover {
        transform: scale(1.05);
    }
    
    .footer-links a:hover {
        color: var(--bg-button-hover);
    }
}

/* ============================================
   RESPONSIVIDADE - TELAS MUITO GRANDES
   ============================================ */
@media (min-width: 1440px) {
    .container {
        max-width: 800px;
    }
    
    .header h1 {
        font-size: 40px;
    }
    
    .header p {
        font-size: 19px;
    }
    
    .card {
        padding: 48px;
    }
    
    .dots {
        font-size: 44px;
        letter-spacing: 18px;
    }
    
    .key {
        height: 76px;
        font-size: 30px;
    }
}