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

:root {
    --bg-dark: #0a0a0a;
    --bg-secondary: #141414;
    --bg-tertiary: #1a1a1a;
    --gold: #d4af37;
    --gold-light: #f4d03f;
    --gold-dark: #c5a028;
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --error: #e50914;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
}

.main-background {
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: linear-gradient(135deg, #0a0a0a 0%, #0d0d0d 50%, #0a0a0a 100%);
}

.unified-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 1400px;
    gap: 80px;
    animation: fadeInScale 1s ease-out;
}

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

.logo-section {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 60px;
}

.logo-wrapper {
    position: relative;
    z-index: 2;
    text-align: center;
}

.main-logo {
    max-width: 450px;
    width: 100%;
    height: auto;
    filter: drop-shadow(0 0 40px rgba(212, 175, 55, 0.6));
    transition: filter 0.5s ease;
}

.main-logo:hover {
    filter: drop-shadow(0 0 60px rgba(212, 175, 55, 0.8));
}

.logo-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.glow-orb {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(212, 175, 55, 0.3) 0%, transparent 70%);
    filter: blur(50px);
}

.glow-1 {
    width: 300px;
    height: 300px;
    top: 20%;
    left: 10%;
    animation: floatGlow1 8s ease-in-out infinite;
}

.glow-2 {
    width: 250px;
    height: 250px;
    bottom: 10%;
    right: 15%;
    animation: floatGlow2 10s ease-in-out infinite;
}

.glow-3 {
    width: 200px;
    height: 200px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: floatGlow3 12s ease-in-out infinite;
}

@keyframes floatGlow1 {
    0%, 100% { transform: translate(0, 0); opacity: 0.6; }
    50% { transform: translate(20px, -20px); opacity: 0.8; }
}

@keyframes floatGlow2 {
    0%, 100% { transform: translate(0, 0); opacity: 0.5; }
    50% { transform: translate(-15px, 15px); opacity: 0.7; }
}

@keyframes floatGlow3 {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.4; }
    50% { transform: translate(-50%, -50%) scale(1.1); opacity: 0.6; }
}


.auth-section {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 550px;
}

.auth-container {
    width: 100%;
    position: relative;
    background: rgba(20, 20, 20, 0.4);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-radius: 24px;
    padding: 48px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4),
                0 0 80px rgba(212, 175, 55, 0.15),
                inset 0 0 60px rgba(212, 175, 55, 0.05);
    animation: fadeInScale 1s ease-out 0.3s both;
}

.login-box,
.register-box {
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateX(30px);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.login-box.active,
.register-box.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
    position: relative;
}

.form-header {
    margin-bottom: 48px;
    animation: fadeInUp 0.6s ease-out;
}

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

.form-header h2 {
    font-size: 36px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.form-header p {
    font-size: 16px;
    color: var(--text-secondary);
    font-weight: 300;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.input-group {
    position: relative;
    animation: fadeInUp 0.6s ease-out backwards;
}

.input-group:nth-child(1) { animation-delay: 0.1s; }
.input-group:nth-child(2) { animation-delay: 0.2s; }
.input-group:nth-child(3) { animation-delay: 0.3s; }
.input-group:nth-child(4) { animation-delay: 0.4s; }

.input-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
    transition: color 0.3s ease;
    letter-spacing: 0.3px;
}

.input-group input:focus + label,
.input-group input:focus ~ label {
    color: var(--gold);
}

.input-group input {
    width: 100%;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.04);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 15px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    font-weight: 400;
}

.input-group input::placeholder {
    color: rgba(179, 179, 179, 0.5);
}

.input-group input:focus {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--gold);
    box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.1);
    transform: translateY(-2px);
}

.input-group input:hover:not(:focus) {
    border-color: rgba(255, 255, 255, 0.15);
}

.error-message {
    color: var(--error);
    font-size: 13px;
    text-align: center;
    min-height: 20px;
    padding: 8px 12px;
    background: rgba(229, 9, 20, 0.1);
    border-radius: 8px;
    display: none;
    animation: fadeInUp 0.3s ease-out;
}

.error-message.show {
    display: block;
    animation: shake 0.4s ease, fadeInUp 0.3s ease-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}

.btn-primary {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
    border: none;
    border-radius: 12px;
    color: var(--bg-dark);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(212, 175, 55, 0.3);
    animation: fadeInUp 0.6s ease-out 0.5s backwards;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s ease;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(212, 175, 55, 0.5);
}

.btn-primary:active {
    transform: translateY(-1px);
}

.btn-primary.loading span {
    opacity: 0;
}

.loading-spinner {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0, 0, 0, 0.2);
    border-top-color: var(--bg-dark);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.btn-primary.loading .loading-spinner {
    display: block;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

.form-footer {
    text-align: center;
    margin-top: 12px;
    animation: fadeInUp 0.6s ease-out 0.6s backwards;
}

.forgot-password {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s ease;
    position: relative;
}

.forgot-password::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--gold);
    transition: width 0.3s ease;
}

.forgot-password:hover {
    color: var(--gold);
}

.forgot-password:hover::after {
    width: 100%;
}

.switch-form {
    text-align: center;
    margin-top: 40px;
    padding-top: 40px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    animation: fadeInUp 0.6s ease-out 0.7s backwards;
}

.switch-form p {
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 300;
}

.switch-form a {
    color: var(--gold);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    position: relative;
}

.switch-form a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
}

.switch-form a:hover {
    color: #fff;
}

/* Modal de Recuperação de Senha */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.modal-overlay.show {
    display: flex;
}

.modal-container {
    background: rgba(20, 20, 20, 0.95);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 16px;
    padding: 0;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

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

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 24px 16px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
}

.modal-header h3 {
    font-size: 24px;
    font-weight: 700;
    color: #d4af37;
    margin: 0;
}

.modal-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #999;
}

.modal-close:hover {
    background: rgba(255, 68, 68, 0.15);
    border-color: rgba(255, 68, 68, 0.3);
    color: #ff4444;
}

.modal-close svg {
    width: 20px;
    height: 20px;
}

.modal-body {
    padding: 24px;
}

.modal-description {
    color: #999;
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 24px;
}

.modal-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.modal-message {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    display: none;
    animation: slideDown 0.3s ease;
}

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

.modal-message.show {
    display: block;
}

.modal-message.success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #22c55e;
}

.modal-message.error {
    background: rgba(255, 68, 68, 0.1);
    border: 1px solid rgba(255, 68, 68, 0.3);
    color: #ff4444;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.modal-actions .btn-secondary,
.modal-actions .btn-primary {
    flex: 1;
    margin: 0;
}

.btn-secondary {
    padding: 14px 24px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

@media (max-width: 1200px) {
    .unified-container {
        gap: 60px;
    }
    
    .main-logo {
        max-width: 350px;
    }
    
    .auth-container {
        padding: 40px 36px;
    }
}

@media (max-width: 1024px) {
    .unified-container {
        flex-direction: column;
        gap: 40px;
        padding: 40px 20px;
    }
    
    .logo-section {
        padding: 20px;
    }
    
    .main-logo {
        max-width: 300px;
    }
    
    .auth-section {
        max-width: 100%;
        width: 100%;
    }
    
    .auth-container {
        padding: 40px 32px;
    }
}

@media (max-width: 768px) {
    .main-background {
        padding: 24px 20px;
    }
    
    .unified-container {
        gap: 32px;
    }
    
    .logo-section {
        padding: 20px;
    }
    
    .auth-container {
        padding: 32px 24px;
        border-radius: 20px;
    }
    
    .main-logo {
        max-width: 240px;
    }
}

@media (max-width: 480px) {
    .main-background {
        padding: 20px 16px;
        min-height: 100vh;
        align-items: flex-start;
    }
    
    .unified-container {
        gap: 24px;
        padding: 20px 0;
    }
    
    .logo-section {
        padding: 16px;
    }
    
    .auth-container {
        padding: 28px 20px;
        border-radius: 16px;
    }
    
    .form-header {
        margin-bottom: 32px;
    }
    
    .form-header h2 {
        font-size: 24px;
    }
    
    .form-header p {
        font-size: 14px;
    }
    
    .main-logo {
        max-width: 180px;
    }
    
    .auth-form {
        gap: 20px;
    }
    
    .input-group {
        margin-bottom: 0;
    }
    
    .input-group label {
        font-size: 13px;
        margin-bottom: 6px;
    }
    
    .input-group input {
        padding: 12px 14px;
        font-size: 14px;
    }
    
    .btn-primary {
        padding: 14px;
        font-size: 15px;
    }
    
    .switch-form {
        font-size: 13px;
        margin-top: 24px;
        padding-top: 24px;
    }
    
    .form-footer {
        margin-top: 16px;
    }
    
    .forgot-password {
        font-size: 13px;
    }
    
    .logo-glow {
        display: none;
    }
}

/* ==================== TOGGLE SWITCH DOURADO ==================== */

.account-type-toggle {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    height: 56px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 4px;
    margin-top: 8px;
}

.account-type-toggle input[type="radio"] {
    display: none;
}

.account-type-toggle .toggle-option {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 12px 16px;
    font-size: 15px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    z-index: 2;
    transition: all 0.3s ease;
    border-radius: 8px;
    user-select: none;
}

.account-type-toggle .toggle-slider {
    position: absolute;
    top: 4px;
    left: 4px;
    width: calc(50% - 4px);
    height: calc(100% - 8px);
    background: linear-gradient(135deg, #d4af37 0%, #c5a028 100%);
    border-radius: 8px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.4);
    z-index: 1;
    overflow: hidden;
}

/* Quando Agente estiver selecionado */
.account-type-toggle input[name="loginUserType"]:nth-of-type(1):checked ~ .toggle-slider,
.account-type-toggle input[name="regUserType"]:nth-of-type(1):checked ~ .toggle-slider {
    transform: translateX(0);
}

/* Quando Consultor estiver selecionado */
.account-type-toggle input[name="loginUserType"]:nth-of-type(2):checked ~ .toggle-slider,
.account-type-toggle input[name="regUserType"]:nth-of-type(2):checked ~ .toggle-slider {
    transform: translateX(calc(100% + 4px));
}

/* Texto do lado selecionado fica PRETO para aparecer */
.account-type-toggle input[name="loginUserType"]:nth-of-type(1):checked ~ label[for="loginAgente"],
.account-type-toggle input[name="regUserType"]:nth-of-type(1):checked ~ label[for="regAgente"] {
    color: #0a0a0a;
    font-weight: 700;
}

.account-type-toggle input[name="loginUserType"]:nth-of-type(2):checked ~ label[for="loginConsultor"],
.account-type-toggle input[name="regUserType"]:nth-of-type(2):checked ~ label[for="regConsultor"] {
    color: #0a0a0a;
    font-weight: 700;
}

/* Hover suave apenas nos lados NÃO selecionados */
.account-type-toggle .toggle-option:hover {
    color: rgba(255, 255, 255, 0.7);
}

/* Lado selecionado sempre PRETO, mesmo no hover */
.account-type-toggle input[name="loginUserType"]:nth-of-type(1):checked ~ label[for="loginAgente"]:hover,
.account-type-toggle input[name="regUserType"]:nth-of-type(1):checked ~ label[for="regAgente"]:hover {
    color: #0a0a0a;
}

.account-type-toggle input[name="loginUserType"]:nth-of-type(2):checked ~ label[for="loginConsultor"]:hover,
.account-type-toggle input[name="regUserType"]:nth-of-type(2):checked ~ label[for="regConsultor"]:hover {
    color: #0a0a0a;
}

/* Brilho suave fixo no slider */
.account-type-toggle .toggle-slider::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.2) 0%, transparent 50%, rgba(0, 0, 0, 0.1) 100%);
    border-radius: 8px;
    pointer-events: none;
}

/* Reflexo animado que passa lentamente */
.account-type-toggle .toggle-slider::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    border-radius: 8px;
    animation: slideShine 6s ease-in-out infinite;
    pointer-events: none;
}

@keyframes slideShine {
    0% {
        left: -100%;
    }
    50% {
        left: 150%;
    }
    100% {
        left: 150%;
    }
}
