/* ========================================================================== */
/* TEMA SISTEMA - CryptoVision Login                                         */
/* Preto Grafite com Amarelo/Ouro (#F0B90B)                                  */
/* ========================================================================== */

:root {
    --bg-primary: var(--cv-0d0d0d, #0d0d0d);
    --bg-secondary: var(--cv-141414, #141414);
    --bg-card: var(--cv-1a1a1a, #1a1a1a);
    --bg-input: var(--cv-ffffff-a0030, rgba(255, 255, 255, 0.03));
    --primary: #F0B90B;
    --primary-hover: #d4a50a;
    --secondary: #3b82f6;
    --secondary-hover: #2563eb;
    --text-color: var(--cv-e5e5e5, #e5e5e5);
    --text-muted: var(--cv-888888, #888888);
    --border-color: var(--cv-ffffff-a0080, rgba(255, 255, 255, 0.08));
    --border-focus: rgba(240, 185, 11, 0.5);
    --error: #ef4444;
    --success: #22c55e;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
}

html, body {
    overflow-x: hidden;
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
}

html {
    height: 100%;
    width: 100%;
    position: fixed;
}

body {
    background: var(--bg-primary);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
    padding: 20px;
    overflow-y: auto;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
}

/* ========== CONTAINER PRINCIPAL ========== */
.login-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 
        0 4px 24px var(--cv-000000-a0400, rgba(0, 0, 0, 0.4)),
        0 0 0 1px var(--cv-ffffff-a0020, rgba(255, 255, 255, 0.02)) inset;
    width: 100%;
    max-width: 420px;
    padding: 40px;
    touch-action: pan-y;
    -webkit-touch-callout: none;
}

/* ========== HEADER ========== */
.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo {
    width: 80px;
    height: 80px;
    margin-bottom: 16px;
    filter: drop-shadow(0 4px 12px rgba(240, 185, 11, 0.3));
}

.login-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 6px;
    letter-spacing: -0.02em;
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 400;
}

/* ========== TABS ========== */
.login-tabs {
    display: flex;
    margin-bottom: 28px;
    border-bottom: 1px solid var(--border-color);
    gap: 4px;
}

.login-tab {
    flex: 1;
    text-align: center;
    padding: 12px 16px;
    cursor: pointer;
    position: relative;
    user-select: none;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: all 0.2s ease;
    border-radius: 8px 8px 0 0;
}

.login-tab:hover {
    color: var(--text-color);
    background: var(--cv-ffffff-a0020, rgba(255, 255, 255, 0.02));
}

.login-tab.active {
    color: var(--primary);
    font-weight: 600;
}

.login-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary);
    border-radius: 2px 2px 0 0;
}

/* ========== FORMULÁRIOS ========== */
.login-form {
    display: none;
}

.login-form.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========== FORM GROUPS ========== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-color);
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-color);
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.form-input::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--border-focus);
    background: var(--cv-ffffff-a0050, rgba(255, 255, 255, 0.05));
}

/* ========== PASSWORD WRAPPER ========== */
.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper .form-input {
    padding-right: 48px;
}

/* Esconder ícone de olho nativo do navegador */
.form-input::-ms-reveal,
.form-input::-ms-clear {
    display: none;
}

.form-input::-webkit-credentials-auto-fill-button,
.form-input::-webkit-textfield-decoration-container {
    visibility: hidden;
    pointer-events: none;
}

input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear,
input[type="text"]::-ms-reveal,
input[type="text"]::-ms-clear {
    display: none !important;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.password-toggle:hover {
    color: var(--primary);
    background: var(--cv-ffffff-a0050, rgba(255, 255, 255, 0.05));
}

.password-toggle i {
    font-size: 1.2rem;
}

/* ========== FORM ERRORS ========== */
.form-error {
    color: var(--error);
    font-size: 0.8rem;
    margin-top: 6px;
    display: none;
}

.form-error.active {
    display: block;
    animation: shake 0.3s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

/* ========== CODE INPUTS (Recuperar Senha) ========== */
.code-inputs {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 8px;
}

.code-input {
    width: 48px !important;
    height: 56px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 600;
    padding: 8px !important;
    letter-spacing: 0;
}

.code-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--border-focus);
}

/* ========== SUCCESS MESSAGE ========== */
.success-message {
    color: var(--success);
    font-size: 0.9rem;
    text-align: center;
    padding: 12px;
    border-radius: 8px;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.2);
    margin-top: 16px;
    display: none;
}

.success-message.active {
    display: block;
}

/* ========== BOTÕES ========== */
.btn {
    display: block;
    width: 100%;
    padding: 14px 20px;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    margin-top: 8px;
}

.btn-primary {
    background: var(--primary);
    color: #000;
    box-shadow: 0 4px 12px rgba(240, 185, 11, 0.3);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(240, 185, 11, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--primary);
    color: #000;
    box-shadow: 0 4px 12px rgba(240, 185, 11, 0.3);
}

.btn-secondary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(240, 185, 11, 0.4);
}

.btn-secondary:active {
    transform: translateY(0);
}

/* ========== FOOTER ========== */
.login-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.login-footer a {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.login-footer a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* ========== MENSAGEM GLOBAL ========== */
#mensagem-global {
    display: none;
    font-size: 0.9rem;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
    transition: all 0.3s ease;
}

/* ========================================================================== */
/* RESPONSIVIDADE                                                             */
/* ========================================================================== */

/* Desktop Grande */
@media (min-width: 1440px) {
    .login-container {
        max-width: 460px;
        padding: 48px;
    }
    
    .login-logo {
        width: 90px;
        height: 90px;
    }
    
    .login-title {
        font-size: 2rem;
    }
}

/* Tablet */
@media (max-width: 1024px) {
    .login-container {
        max-width: 420px;
        padding: 36px;
    }
    
    .login-logo {
        width: 76px;
        height: 76px;
    }
    
    .login-title {
        font-size: 1.65rem;
    }
}

/* Mobile */
@media (max-width: 768px) {
    body {
        padding: 16px;
        align-items: center;
    }
    
    .login-container {
        max-width: 100%;
        padding: 28px 24px;
        border-radius: 14px;
    }
    
    .login-header {
        margin-bottom: 28px;
    }
    
    .login-logo {
        width: 70px;
        height: 70px;
        margin-bottom: 14px;
    }
    
    .login-title {
        font-size: 1.5rem;
    }
    
    .login-subtitle {
        font-size: 0.85rem;
    }
    
    .login-tabs {
        margin-bottom: 24px;
    }
    
    .login-tab {
        padding: 10px 12px;
        font-size: 0.9rem;
    }
    
    .form-group {
        margin-bottom: 18px;
    }
    
    .form-group label {
        font-size: 0.85rem;
        margin-bottom: 6px;
    }
    
    .form-input {
        padding: 11px 14px;
        font-size: 0.9rem;
        border-radius: 8px;
    }
    
    .password-wrapper .form-input {
        padding-right: 44px;
    }
    
    .password-toggle {
        right: 10px;
        padding: 5px;
    }
    
    .password-toggle i {
        font-size: 1.1rem;
    }
    
    .btn {
        padding: 12px 18px;
        font-size: 0.95rem;
        border-radius: 8px;
    }
    
    .login-footer {
        margin-top: 20px;
        padding-top: 18px;
    }
    
    .login-footer a {
        font-size: 0.85rem;
    }
    
    /* Code inputs mobile */
    .code-inputs {
        gap: 6px;
    }
    
    .code-input {
        width: 42px !important;
        height: 50px;
        font-size: 1.3rem;
    }
}

/* Mobile Pequeno */
@media (max-width: 480px) {
    body {
        padding: 12px;
    }
    
    .login-container {
        padding: 24px 20px;
        border-radius: 12px;
    }
    
    .login-header {
        margin-bottom: 24px;
    }
    
    .login-logo {
        width: 64px;
        height: 64px;
        margin-bottom: 12px;
    }
    
    .login-title {
        font-size: 1.35rem;
    }
    
    .login-subtitle {
        font-size: 0.8rem;
    }
    
    .login-tabs {
        margin-bottom: 20px;
    }
    
    .login-tab {
        padding: 9px 10px;
        font-size: 0.85rem;
    }
    
    .form-group {
        margin-bottom: 16px;
    }
    
    .form-group label {
        font-size: 0.8rem;
    }
    
    .form-input {
        padding: 10px 12px;
        font-size: 0.875rem;
    }
    
    .password-wrapper .form-input {
        padding-right: 40px;
    }
    
    .password-toggle {
        right: 8px;
        padding: 4px;
    }
    
    .password-toggle i {
        font-size: 1rem;
    }
    
    .btn {
        padding: 11px 16px;
        font-size: 0.9rem;
    }
    
    .login-footer {
        margin-top: 18px;
        padding-top: 16px;
    }
    
    .login-footer a {
        font-size: 0.8rem;
    }
    
    .form-error {
        font-size: 0.75rem;
    }
    
    /* Code inputs mobile pequeno */
    .code-inputs {
        gap: 5px;
    }
    
    .code-input {
        width: 38px !important;
        height: 46px;
        font-size: 1.2rem;
    }
}

/* Telas muito pequenas */
@media (max-width: 360px) {
    body {
        padding: 8px;
    }
    
    .login-container {
        padding: 20px 16px;
    }
    
    .login-logo {
        width: 56px;
        height: 56px;
    }
    
    .login-title {
        font-size: 1.25rem;
    }
    
    .login-tab {
        padding: 8px;
        font-size: 0.8rem;
    }
    
    .form-input {
        padding: 9px 10px;
        font-size: 0.85rem;
    }
    
    .btn {
        padding: 10px 14px;
        font-size: 0.85rem;
    }
    
    /* Code inputs telas pequenas */
    .code-inputs {
        gap: 4px;
    }
    
    .code-input {
        width: 34px !important;
        height: 42px;
        font-size: 1.1rem;
        padding: 6px !important;
    }
}

/* ========== SAFE AREA (iPhone X+) ========== */
@supports (padding: max(0px)) {
    body {
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
}