/* Reset e estilos base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, sans-serif;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    position: relative;
    overflow: hidden;
}

/* Container principal */
.container {
    width: 100%;
    max-width: 700px;
    height: 100%;
    max-height: 800px;
    background: linear-gradient(to bottom, white, #dedede);
    border-radius: 24px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
}

/* Video de fundo */
.background-video {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    object-fit: cover;
    z-index: 0;
    opacity: 0.5;
}

.login-container {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 24px;
    overflow: auto;
    backdrop-filter: blur(15.05px);
    z-index: 1;
    /* Personalização da scrollbar para Firefox */
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) rgba(0, 0, 0, 0.05);
}

/* Personalização da scrollbar para Chrome/Safari/Edge */
.login-container::-webkit-scrollbar {
    width: 8px;
}

.login-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
}

.login-container::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    transition: background 0.2s ease;
}

.login-container::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.35);
}

.content {
    position: relative;
    min-height: 100%;
    width: 100%;
    padding: 1.5rem;
    overflow: auto;
}

/* Fade overlays */
.fade-top {
    pointer-events: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3rem;
    background: linear-gradient(to bottom, white, transparent);
    z-index: 10;
}

.fade-bottom {
    pointer-events: none;
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3rem;
    background: linear-gradient(to top, #dedede, transparent);
    z-index: 10;
}

/* Título e subtítulo */
.title-container {
    text-align: center;
    margin-top: 2.5rem;
    margin-bottom: 4rem;
}

.title {
    font-size: 40.522px;
    font-weight: 700;
    color: black;
    margin-bottom: 1rem;
}

.subtitle {
    font-size: 17.367px;
    font-weight: 300;
    color: #888888;
    margin: 0 auto;
    max-width: 28rem;
}

/* Switch entre login e registro */
.switch-container {
    background-color: #f1f1f1;
    height: 59.095px;
    margin: 0 auto;
    border-radius: 10.131px;
    max-width: 24rem;
    margin-bottom: 3rem;
    position: relative;
}

.switch-inner {
    height: 59.095px;
    overflow: hidden;
    position: relative;
    border-radius: 10.131px;
    width: 100%;
}

.switch-btn {
    position: absolute;
    height: 49.095px;
    top: 5.07px;
    width: calc(50% - 10.14px);
    border-radius: 5.065px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
}

.switch-btn.register {
    right: 5.07px;
}

.switch-btn.login {
    left: 5.07px;
}

.switch-btn.active {
    background-color: #dedede;
}

.switch-btn:not(.active):hover {
    background-color: #f0f0f0;
}

.switch-btn p {
    font-weight: 700;
    font-size: 15.558px;
    line-height: 18.151px;
    text-align: center;
}

.switch-btn.login.active p {
    color: black;
}

.switch-btn.login:not(.active) p {
    color: #676767;
}

.switch-btn.register.active p {
    color: black;
}

.switch-btn.register:not(.active) p {
    color: #676767;
}

/* Container wrapper para formulários */
.content {
    position: relative;
}

/* Formulários */
.form-container {
    max-width: 28rem;
    margin: 0 auto;
}

.register-form-container {
    max-width: 42rem;
    margin: 0 auto;
    margin-bottom: 2.5rem;
}

/* Wrapper para manter altura durante transição */
.forms-wrapper {
    position: relative;
    min-height: 400px;
    width: 100%;
}

/* Garantir que o wrapper mantenha altura durante transição */
.forms-wrapper.transitioning {
    min-height: 600px;
}

.form-group {
    margin-bottom: 1.5rem;
}

.register-form-group {
    margin-bottom: 2rem;
}

.input-container {
    position: relative;
    background-color: white;
    min-height: 45.587px;
    border-radius: 10.131px;
    width: 100%;
    margin-bottom: 0.75rem;
}

.input-inner {
    height: 45.587px;
    overflow: hidden;
    position: relative;
    border-radius: 10.131px;
    width: 100%;
}

.input-wrapper {
    position: absolute;
    display: flex;
    height: 45.587px;
    align-items: center;
    width: 100%;
}

.input-icon {
    position: absolute;
    left: 15px;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.input-field {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 100%;
    background-color: transparent;
    padding-left: 46px;
    padding-right: 15px;
    font-weight: 500;
    font-size: 15.558px;
    outline: none;
    border: none;
}

.input-border {
    position: absolute;
    border: 1.688px solid #d9d9d9;
    inset: 0;
    pointer-events: none;
    border-radius: 10.131px;
    transition: border-color 0.2s;
}

.input-field:focus + .input-border {
    border-color: black;
}

.error-border {
    border-color: #ef4444 !important;
    animation: shake 0.3s ease-in-out;
}

.filled-border {
    border-color: black;
}

/* Toggle de senha (mostrar/ocultar) */
.input-wrapper.has-toggle .input-field {
    padding-right: 46px; /* espaço para o botão no lado direito */
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: #888888;
    cursor: pointer;
}

.password-toggle:hover {
    color: #333;
}

.password-toggle svg {
    width: 18px;
    height: 18px;
}

/* Animação de shake para erros */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Ícone vermelho quando há erro */
.input-container:has(.error-border) .input-icon svg path {
    fill: #ef4444 !important;
}

/* Input com erro */
.input-container:has(.error-border) .input-field {
    color: #dc2626;
}

/* Indicador de campo obrigatório */
.input-field[required]::placeholder::after {
    content: " *";
    color: #ef4444;
}

/* Alternativa: adicionar asterisco vermelho nos placeholders */
input[required]:not([type="checkbox"])::placeholder,
select[required]::placeholder {
    opacity: 1;
}

/* Estilo para campos válidos preenchidos */
.input-container:has(.filled-border):not(:has(.error-border)) .input-icon svg path {
    fill: #10b981 !important;
}

.input-container:has(.filled-border):not(:has(.error-border)) .input-border {
    border-color: #10b981 !important;
}

/* Toast Container */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    min-width: 300px;
    max-width: 500px;
    background: white;
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15), 0 4px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: all;
    animation: slideInRight 0.3s ease-out;
    position: relative;
    overflow: hidden;
}

.toast::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
}

.toast.toast-success::before {
    background: #10b981;
}

.toast.toast-error::before {
    background: #ef4444;
}

.toast.toast-info::before {
    background: #3b82f6;
}

.toast.toast-warning::before {
    background: #f59e0b;
}

.toast-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-success .toast-icon {
    background: #d1fae5;
    color: #10b981;
}

.toast-error .toast-icon {
    background: #fee2e2;
    color: #ef4444;
}

.toast-info .toast-icon {
    background: #dbeafe;
    color: #3b82f6;
}

.toast-warning .toast-icon {
    background: #fef3c7;
    color: #f59e0b;
}

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

.toast-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.toast-title {
    font-weight: 600;
    font-size: 14px;
    color: #111827;
}

.toast-message {
    font-size: 13px;
    color: #6b7280;
    line-height: 1.4;
}

.toast-close {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border: none;
    background: transparent;
    color: #9ca3af;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.toast-close:hover {
    background: #f3f4f6;
    color: #111827;
}

.toast-close svg {
    width: 14px;
    height: 14px;
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: rgba(0, 0, 0, 0.1);
    animation: toastProgress 5s linear forwards;
}

.toast.removing {
    animation: slideOutRight 0.3s ease-out forwards;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

@keyframes toastProgress {
    from {
        width: 100%;
    }
    to {
        width: 0%;
    }
}

/* Alertas (manter para compatibilidade, mas ocultar) */
.alert {
    display: none;
}

.error-message {
    color: #ef4444;
    font-size: 0.75rem;
    margin-top: 0.25rem;
    margin-left: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    animation: slideDown 0.2s ease-out;
}
/* Dica textual abaixo dos inputs (hints) */
.input-hint {
    color: #6b7280; /* gray-500 */
    font-size: 0.75rem;
    margin-top: 0.35rem;
    margin-left: 0.5rem;
}

.error-message::before {
    content: "⚠";
    font-size: 0.875rem;
}

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

/* Botões */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10.131px;
    height: 52px;
    width: 100%;
    font-weight: 500;
    font-size: 15.558px;
    cursor: pointer;
    transition: background-color 0.2s;
    position: relative;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn.loading span {
    visibility: hidden;
    opacity: 0;
}

.btn.loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    left: calc(50% - 8px);
    top: calc(50% - 8px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }   
}

.btn-primary {
    background-color: black;
    color: white;
    margin-bottom: 1rem;
}

.btn-primary:hover {
    background-color: #333;
}

.btn-primary:active {
    background-color: #444;
}

.btn-google {
    background-color: white;
    border: 1px solid #ddd;
    color: #333;
    margin-bottom: 0.75rem;
}

.btn-google:hover {
    background-color: #f9f9f9;
}

.btn-apple {
    background-color: black;
    color: white;
}

.btn-apple:hover {
    background-color: #333;
}

.social-icon {
    margin-right: 0.5rem;
    width: 20px;
    height: 20px;
}

/* Seções do formulário de registro */
.section-title {
    font-weight: 700;
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: black;
}

.section-subtitle {
    margin-left: 0.5rem;
    font-size: 0.875rem;
    color: #6b7280;
}

.input-space {
    margin-bottom: 1rem;
}

/* Upload de arquivos */
.file-upload {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1rem;
    cursor: pointer;
    border: 1.688px solid #d9d9d9;
    border-radius: 10.131px;
}

.file-upload.error {
    border-color: #ef4444;
}

.file-upload.filled {
    border-color: black;
}

.file-icon {
    margin-right: 0.75rem;
}

.file-label {
    flex: 1;
    font-weight: 500;
    font-size: 15.558px;
}

.file-input {
    display: none;
}

/* Checkbox para termos */
.terms-container {
    display: flex;
    align-items: flex-start;
}

.checkbox-container {
    display: flex;
    align-items: center;
    height: 1.25rem;
}

.checkbox {
    width: 1rem;
    height: 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.25rem;
}

.checkbox:focus {
    outline: 2px solid black;
    outline-offset: 2px;
}

.terms-label {
    margin-left: 0.75rem;
    font-weight: 500;
    font-size: 0.875rem;
}

.terms-link {
    color: #2563eb;
    text-decoration: underline;
    cursor: pointer;
}

.terms-link:hover {
    color: #1d4ed8;
}

/* Modal de termos */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    overflow-x: hidden;
    background-color: rgba(0, 0, 0, 0.7);
}

.modal-container {
    position: relative;
    width: 100%;
    max-width: 56rem;
    margin: 0 auto;
    z-index: 10;
    padding: 1rem;
}

.modal-content {
    background-color: white;
    border-radius: 1rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    position: sticky;
    top: 0;
    background-color: white;
    z-index: 10;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top-left-radius: 1rem;
    border-top-right-radius: 1rem;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
}

.modal-close {
    color: #6b7280;
    padding: 0.25rem;
    cursor: pointer;
}

.modal-close:hover {
    color: #374151;
}

.modal-body {
    overflow-y: auto;
    padding: 1.5rem;
    flex-grow: 1;
}

.modal-footer {
    position: sticky;
    bottom: 0;
    background-color: white;
    border-top: 1px solid #e5e7eb;
    padding: 1rem;
    display: flex;
    justify-content: flex-end;
    border-bottom-left-radius: 1rem;
    border-bottom-right-radius: 1rem;
}

.modal-btn {
    background-color: black;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: background-color 0.2s;
    border: none;
    cursor: pointer;
}

.modal-btn:hover {
    background-color: #333;
}

/* Estilos para termos */
.terms-section {
    margin-bottom: 1.5rem;
}

.terms-heading {
    font-weight: 700;
    font-size: 1.125rem;
    margin-bottom: 1rem;
}

.terms-paragraph {
    margin-bottom: 1rem;
}

.terms-list {
    list-style-type: disc;
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

.terms-list li {
    margin-bottom: 0.5rem;
}

.terms-footer {
    margin-top: 2rem;
    font-size: 0.875rem;
    color: #6b7280;
}

/* Responsividade */
@media (min-width: 640px) {
    .social-buttons {
        display: flex;
        gap: 1rem;
    }
    
    .social-btn {
        width: 50%;
    }
    
    .btn-google {
        margin-bottom: 0;
    }
}

@media (max-width: 639px) {
    .social-buttons {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }
}

/* Animações */
.form-animation {
    opacity: 0;
    transform: translateX(0);
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1), transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.login-form-animation {
    transform: translateX(-30px);
}

.register-form-animation {
    transform: translateX(30px);
}

.form-animation.active {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
    position: relative;
    z-index: 2;
}

.form-animation.fade-out {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    opacity: 0;
    transform: translateX(30px);
    pointer-events: none;
    z-index: 1;
}

.login-form-animation.fade-out {
    transform: translateX(-30px);
}

/* Garantir que o formulário saindo não empurre outros elementos fora do wrapper */
.forms-wrapper .form-animation.fade-out {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
}

/* Formulário entrando durante transição */
.form-animation.fade-in {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1;
}

/* Garantir que o formulário entrando não empurre outros elementos fora do wrapper */
.forms-wrapper .form-animation.fade-in {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
}

/* Garantir que os formulários ocupem espaço apenas quando ativos */
.form-container.form-animation:not(.active):not(.fade-out),
.register-form-container.form-animation:not(.active):not(.fade-out) {
    display: none;
}

.form-container.form-animation.active,
.register-form-container.form-animation.active {
    display: block;
}

/* Bloquear scroll durante transição */
.login-container.scroll-locked {
    overflow: hidden;
}

/* Note: Global scroll locking is handled via JS listeners to avoid scrollbar reflow/flicker. */

.modal-animation {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.modal-animation.active {
    opacity: 1;
}

.modal-content-animation {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
}

.modal-content-animation.active {
    opacity: 1;
    transform: scale(1) translateY(0);
}

/* Borda branca ao redor do container */
.container-border {
    position: absolute;
    border: 1px solid white;
    inset: 0;
    pointer-events: none;
    border-radius: 24px;
    z-index: 2;
}

/* Back button (top-left) */
.back-button {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: rgba(255,255,255,0.9);
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 8px;
    padding: 0.45rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 20;
    transition: background-color 0.15s, transform 0.12s;
    box-shadow: 0 6px 18px rgba(0,0,0,0.06);
}

.back-button:hover {
    background: rgba(255,255,255,1);
    transform: translateY(-1px);
}

.back-button svg {
    color: #111;
}

/* Responsive Toast para Mobile */
@media (max-width: 640px) {
    .toast-container {
        top: auto;
        bottom: 20px;
        right: 10px;
        left: 10px;
        width: auto;
    }
    
    .toast {
        min-width: auto;
        width: 100%;
        animation: slideInUp 0.3s ease-out;
    }
    
    .toast.removing {
        animation: slideOutDown 0.3s ease-out forwards;
    }
    
    @keyframes slideInUp {
        from {
            transform: translateY(100px);
            opacity: 0;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }
    
    @keyframes slideOutDown {
        from {
            transform: translateY(0);
            opacity: 1;
        }
        to {
            transform: translateY(100px);
            opacity: 0;
        }
    }
}

/* Estilo para mensagem de erro nos termos */
.terms-error {
    color: #ef4444;
    font-size: 0.875rem;
    margin-top: 0.5rem;
    animation: slideDown 0.3s ease-out;
}

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