/**
 * CS Viagens & Eventos
 * Estilos específicos das páginas de Autenticação de Clientes
 * Login, Criar Conta, Recuperar Senha, Resetar Senha
 */

/* ========================================
   Force Input Padding (Override Tailwind)
   ======================================== */
.auth-input-wrapper input.auth-input,
input.auth-input[type="email"],
input.auth-input[type="password"],
input.auth-input[type="text"],
input.auth-input[type="tel"] {
    padding-left: 2.75rem !important;
}

/* ========================================
   Address Field Group (CEP, Endereço, etc)
   ======================================== */

/* Botão outline para buscar CEP */
.auth-btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    width: 100%;
    height: 3rem;
    padding: 0 1rem;
    background: transparent;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    color: #64748b;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.auth-btn-outline:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #475569;
}

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

.dark .auth-btn-outline {
    border-color: #334155;
    color: #94a3b8;
}

.dark .auth-btn-outline:hover {
    background: rgba(51, 65, 85, 0.5);
    border-color: #475569;
    color: #e2e8f0;
}

/* Select estilizado */
.auth-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    padding-right: 2.5rem !important;
    cursor: pointer;
}

/* Spin animation for loading */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* ========================================
   Background e Layout Base
   ======================================== */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    position: relative;
    overflow: hidden;
}

.auth-bg {
    position: fixed;
    inset: 0;
    z-index: -1;
}

.auth-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(17, 66, 212, 0.85) 0%, rgba(16, 21, 34, 0.95) 100%);
    z-index: 1;
}

.auth-bg-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.5;
}

/* Overlay decorativo */
.auth-bg-pattern {
    position: fixed;
    inset: 0;
    z-index: 0;
    opacity: 0.03;
    pointer-events: none;
    overflow: hidden;
    background-image: radial-gradient(circle at 2px 2px, #1142d4 1px, transparent 0);
    background-size: 40px 40px;
}

/* ========================================
   Container Principal
   ======================================== */
.auth-container {
    width: 100%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    animation: authSlideUp 0.5s ease-out;
}

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

/* ========================================
   Logo Section
   ======================================== */
.auth-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.auth-logo-icon {
    color: #1142d4;
}

.auth-logo img {
    height: 48px;
    width: auto;
}

.auth-logo-title {
    color: white;
    font-size: 1.875rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.auth-logo-subtitle {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.875rem;
}

/* ========================================
   Card Principal
   ======================================== */
.auth-card {
    background: white;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border-radius: 0.75rem;
    padding: 2rem;
    border: 1px solid rgba(226, 232, 240, 0.6);
}

@media (min-width: 640px) {
    .auth-card {
        padding: 2.5rem;
    }
}

.dark .auth-card {
    background: #1c2333;
    border-color: #334155;
}

.auth-card-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.5rem;
}

.dark .auth-card-title {
    color: #f1f5f9;
}

.auth-card-description {
    color: #64748b;
    font-size: 0.875rem;
    margin-bottom: 2rem;
}

.dark .auth-card-description {
    color: #94a3b8;
}

/* ========================================
   Formulários
   ======================================== */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Campo de Formulário */
.auth-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.auth-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
}

.dark .auth-label {
    color: #cbd5e1;
}

.auth-input-wrapper {
    position: relative;
}

.auth-input-icon {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
    font-size: 1.25rem;
    z-index: 1;
}

.auth-input {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 2.75rem;
    padding-left: 2.75rem !important;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    color: #0f172a;
    outline: none;
    transition: all 0.2s;
    text-indent: 0.25rem;
}

.dark .auth-input {
    background: #101522;
    border-color: #334155;
    color: #f1f5f9;
}

.auth-input::placeholder {
    color: #94a3b8;
}

.auth-input:focus {
    border-color: #1142d4;
    box-shadow: 0 0 0 3px rgba(17, 66, 212, 0.15);
}

.auth-input.is-invalid {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.auth-input.is-valid {
    border-color: #22c55e;
}

/* Toggle de senha */
.auth-password-toggle {
    position: absolute;
    right: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    color: #94a3b8;
    transition: color 0.2s;
}

.auth-password-toggle:hover {
    color: #64748b;
}

/* ========================================
   Campo Header (Label + Link)
   ======================================== */
.auth-field-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.auth-field-link {
    font-size: 0.75rem;
    font-weight: 600;
    color: #1142d4;
    text-decoration: none;
    transition: all 0.2s;
}

.auth-field-link:hover {
    text-decoration: underline;
}

/* ========================================
   Remember Me / Checkbox
   ======================================== */
.auth-remember {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.auth-checkbox {
    width: 1rem;
    height: 1rem;
    border-radius: 0.25rem;
    border: 1px solid #cbd5e1;
    accent-color: #1142d4;
}

.auth-remember-label {
    font-size: 0.875rem;
    color: #64748b;
}

.dark .auth-remember-label {
    color: #94a3b8;
}

/* ========================================
   Botão Principal
   ======================================== */
.auth-btn {
    width: 100%;
    background: #1142d4;
    color: white;
    font-weight: 700;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 10px 25px -5px rgba(17, 66, 212, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.9375rem;
}

.auth-btn:hover:not(:disabled) {
    background: #0d36a8;
    transform: translateY(-1px);
}

.auth-btn:active {
    transform: translateY(0);
}

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

.auth-btn .spinner {
    display: none;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: authSpin 0.7s linear infinite;
}

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

.auth-btn.loading .btn-text {
    display: none;
}

@keyframes authSpin {
    to { transform: rotate(360deg); }
}

/* ========================================
   Botão Secundário
   ======================================== */
.auth-btn-secondary {
    width: 100%;
    background: transparent;
    color: #374151;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.dark .auth-btn-secondary {
    border-color: #334155;
    color: #cbd5e1;
}

.auth-btn-secondary:hover {
    background: #f1f5f9;
}

.dark .auth-btn-secondary:hover {
    background: #1e293b;
}

/* ========================================
   Divisor
   ======================================== */
.auth-divider {
    position: relative;
    margin: 1.5rem 0;
}

.auth-divider-line {
    width: 100%;
    height: 1px;
    background: #e2e8f0;
}

.dark .auth-divider-line {
    background: #334155;
}

.auth-divider-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 0 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.dark .auth-divider-text {
    background: #1c2333;
    color: #94a3b8;
}

/* ========================================
   Botões Sociais
   ======================================== */
.auth-social-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.auth-social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    background: white;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
}

.dark .auth-social-btn {
    background: #101522;
    border-color: #334155;
    color: #cbd5e1;
}

.auth-social-btn:hover {
    background: #f8fafc;
}

.dark .auth-social-btn:hover {
    background: #1e293b;
}

.auth-social-btn svg {
    width: 1.25rem;
    height: 1.25rem;
}

/* ========================================
   Footer
   ======================================== */
.auth-footer {
    text-align: center;
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.8);
}

.auth-footer-link {
    color: white;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s;
}

.auth-footer-link:hover {
    text-decoration: underline;
}

/* ========================================
   Alertas
   ======================================== */
.auth-alert {
    padding: 0.875rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.auth-alert-icon {
    flex-shrink: 0;
    font-size: 1.25rem;
}

.auth-alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.auth-alert-success .auth-alert-icon {
    color: #22c55e;
}

.auth-alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.auth-alert-error .auth-alert-icon {
    color: #ef4444;
}

.auth-alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.auth-alert-info .auth-alert-icon {
    color: #3b82f6;
}

/* ========================================
   Grid de campos duplos
   ======================================== */
.auth-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 480px) {
    .auth-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ========================================
   Erros de validação
   ======================================== */
.auth-error {
    font-size: 0.75rem;
    color: #ef4444;
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* ========================================
   Link Voltar
   ======================================== */
.auth-back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.875rem;
    text-decoration: none;
    transition: all 0.2s;
    margin-bottom: 1rem;
}

.auth-back-link:hover {
    color: white;
}

/* ========================================
   Strength Password Meter
   ======================================== */
.password-strength {
    margin-top: 0.5rem;
}

.password-strength-bar {
    height: 4px;
    background: #e2e8f0;
    border-radius: 2px;
    overflow: hidden;
}

.password-strength-fill {
    height: 100%;
    width: 0;
    transition: all 0.3s;
    border-radius: 2px;
}

.password-strength-fill.weak {
    width: 25%;
    background: #ef4444;
}

.password-strength-fill.fair {
    width: 50%;
    background: #f59e0b;
}

.password-strength-fill.good {
    width: 75%;
    background: #22c55e;
}

.password-strength-fill.strong {
    width: 100%;
    background: #16a34a;
}

.password-strength-text {
    font-size: 0.75rem;
    margin-top: 0.375rem;
    color: #64748b;
}

/* ========================================
   Termos e Condições
   ======================================== */
.auth-terms {
    font-size: 0.8125rem;
    color: #64748b;
    line-height: 1.5;
}

.dark .auth-terms {
    color: #94a3b8;
}

.auth-terms a {
    color: #1142d4;
    font-weight: 500;
}

.auth-terms a:hover {
    text-decoration: underline;
}

/* ========================================
   Success Page (após reset de senha)
   ======================================== */
.auth-success-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    border-radius: 50%;
    margin: 0 auto 1.5rem;
    box-shadow: 0 10px 25px -5px rgba(34, 197, 94, 0.4);
}

.auth-success-icon .material-symbols-outlined {
    font-size: 2.5rem;
    color: white;
}

/* ========================================
   Ícones decorativos de fundo
   ======================================== */
.auth-deco-icons {
    position: fixed;
    inset: 0;
    z-index: 0;
    opacity: 0.04;
    pointer-events: none;
    overflow: hidden;
}

.auth-deco-icons .material-symbols-outlined {
    position: absolute;
    color: #1142d4;
}

.auth-deco-icons .deco-1 {
    font-size: 200px;
    top: 10%;
    left: 5%;
    transform: rotate(12deg);
}

.auth-deco-icons .deco-2 {
    font-size: 150px;
    bottom: 15%;
    right: 5%;
    transform: rotate(-12deg);
}

.auth-deco-icons .deco-3 {
    font-size: 100px;
    top: 50%;
    left: 15%;
    transform: translateY(-50%);
}

/* ========================================
   Tabs (Login/Criar Conta)
   ======================================== */
.auth-tabs {
    display: flex;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #e2e8f0;
}

.dark .auth-tabs {
    border-color: #334155;
}

.auth-tab {
    flex: 1;
    padding: 0.75rem 1rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #64748b;
    background: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.auth-tab::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: transparent;
    transition: all 0.2s;
}

.auth-tab:hover {
    color: #374151;
}

.dark .auth-tab:hover {
    color: #cbd5e1;
}

.auth-tab.active {
    color: #1142d4;
}

.auth-tab.active::after {
    background: #1142d4;
}

/* ========================================
   Form Sections (Login/Criar Conta)
   ======================================== */
.auth-form-section {
    display: none;
}

.auth-form-section.active {
    display: block;
    animation: authFadeIn 0.3s ease-out;
}

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

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 480px) {
    .auth-social-buttons {
        grid-template-columns: 1fr;
    }
    
    .auth-card {
        padding: 1.5rem;
    }
    
    .auth-card-title {
        font-size: 1.25rem;
    }
}
