:root {
    --primary: #1C2B4B;
    --primary-light: #2A3B5B;
    --accent: #C5A059;
    --accent-light: #D4B67A;
    --surface: #FDFBF7;
    --white: #FFFFFF;
    --error: #E57373;
    --text-main: #1A1A1A;
    --text-muted: #666666;
    --glass: rgba(255, 255, 255, 0.85);
    --shadow: 0 8px 32px rgba(28, 43, 75, 0.1);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color-scheme: light;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Source Sans Pro', sans-serif;
}

h1,
h2,
h3,
.brand-font {
    font-family: 'Playfair Display', serif;
}

body {
    background-color: var(--surface);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(197, 160, 89, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(28, 43, 75, 0.05) 0%, transparent 40%);
}

.auth-container {
    width: 100%;
    max-width: 420px;
    padding: 2rem;
    animation: fadeIn 0.8s ease-out;
}

.auth-card {
    background: var(--glass);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: var(--shadow);
    text-align: center;
}

.logo-container {
    margin-bottom: 2rem;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
}

.logo-container h1 {
    color: var(--primary);
    font-size: 1.5rem;
}

.logo-container p {
    color: var(--accent);
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    font-weight: 600;
}

.logo-container img,
.auth-logo {
    height: 52px;
    max-width: calc(100% - 10px);
    width: auto;
    display: block;
    margin: 0 auto;
    object-fit: contain;
}

.auth-header {
    margin-bottom: 2.5rem;
}

.auth-header h2 {
    color: var(--primary);
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.auth-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.input-wrapper {
    position: relative;
}

.btn-eye {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0;
    display: flex;
    align-items: center;
    line-height: 1;
    z-index: 2;
}

.btn-eye:hover {
    color: var(--primary);
}

/* Garante que o texto do input não fique sob o botão olho */
.input-wrapper input[type="password"],
.input-wrapper input[type="text"] {
    padding-right: 42px;
}

input {
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1.5px solid rgba(28, 43, 75, 0.1);
    background: var(--white);
    font-size: 1rem;
    color: var(--text-main);
    transition: var(--transition);
    box-sizing: border-box;
}

input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(197, 160, 89, 0.1);
}

.btn-gold,
.btn-primary {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    font-size: 0.95rem;
    border-radius: 16px;
    padding: 14px 32px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #fff;
    font-weight: 700;
    text-decoration: none;
    border: none;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(28, 43, 75, 0.15);
    letter-spacing: 0.02em;
    margin-top: 1rem;
}

.btn-gold:hover,
.btn-primary:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 12px 25px rgba(28, 43, 75, 0.3);
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
    color: #fff;
}

.auth-footer {
    margin-top: 2rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.auth-footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
}

.auth-footer a:hover {
    color: var(--accent-light);
    text-decoration: underline;
}

.social-login {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(28, 43, 75, 0.05);
}

.social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    border: 1.5px solid rgba(28, 43, 75, 0.1);
    background: var(--white);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
    transition: var(--transition);
}

.social-btn:hover {
    background: #f8f9fa;
    border-color: rgba(28, 43, 75, 0.2);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Toast de Feedback da Autenticação ── */
.auth-toast-container {
    position: fixed;
    top: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
    pointer-events: none;
}

@media (max-width: 600px) {
    .auth-toast-container {
        top: auto;
        bottom: 1.5rem;
    }
}

.auth-toast {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.85rem 1.25rem;
    border-radius: 14px;
    font-size: 0.92rem;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(8px);
    opacity: 0;
    transform: translateY(-12px);
    transition: opacity 0.35s ease, transform 0.35s ease;
    pointer-events: auto;
    max-width: 90vw;
    text-align: left;
}

.auth-toast.show {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 600px) {
    .auth-toast {
        transform: translateY(12px);
    }

    .auth-toast.show {
        transform: translateY(0);
    }
}

.auth-toast--error {
    background: rgba(229, 57, 53, 0.95);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.auth-toast--success {
    background: rgba(46, 125, 50, 0.95);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.auth-toast i {
    font-size: 1.15rem;
    flex-shrink: 0;
}

.auth-container.register {
    max-width: 600px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-section {
    display: none;
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: rgba(28, 43, 75, 0.03);
    border-radius: 16px;
    border: 1px dashed rgba(28, 43, 75, 0.1);
    animation: fadeIn 0.5s ease-out;
}

.form-section.active {
    display: block;
}

/* User Type Toggle */
.user-type-toggle {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 2rem;
    padding: 0.5rem;
    background: rgba(28, 43, 75, 0.05);
    border-radius: 16px;
}

.type-option {
    flex: 1;
    padding: 0.75rem;
    border-radius: 12px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
    color: var(--text-muted);
}

.type-option.active {
    background: var(--white);
    color: var(--primary);
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-section-header {
    margin-bottom: 1.25rem;
    text-align: left;
    border-bottom: 1px solid rgba(28, 43, 75, 0.1);
    padding-bottom: 0.5rem;
}

.form-section-header h3 {
    color: var(--primary);
    font-size: 1.1rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* Removed old toggle styles */

.checkbox-field {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 1.5rem;
    padding: 12px;
    background: rgba(197, 160, 89, 0.08);
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
}

.checkbox-field:hover {
    background: rgba(197, 160, 89, 0.15);
}

.checkbox-field input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}

.checkbox-field span {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary);
}

@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .auth-card {
        padding: 1.5rem;
    }

    .auth-container {
        padding: 1rem;
    }
}

/* ── Botão Instalar PWA ── */
.pwa-install-wrapper {
    display: none;
    margin-top: 1.25rem;
}

.pwa-install-wrapper.visible {
    display: block !important;
}

.btn-install {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 12px 24px;
    border-radius: 16px;
    border: 1.5px solid var(--primary);
    background: transparent;
    color: var(--primary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    letter-spacing: 0.02em;
}

.btn-install:hover {
    background: var(--primary);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(28, 43, 75, 0.2);
}

/* ── Modal instruções iOS ── */
.ios-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    align-items: flex-end;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}

.ios-modal-content {
    background: var(--white);
    border-radius: 24px 24px 0 0;
    padding: 2rem 2rem 2.5rem;
    width: 100%;
    max-width: 480px;
    position: relative;
}

.ios-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(28, 43, 75, 0.08);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: var(--transition);
}

.ios-modal-close:hover {
    background: rgba(28, 43, 75, 0.15);
}

.ios-modal-title {
    font-family: 'Playfair Display', serif;
    color: var(--primary);
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    padding-right: 2rem;
}

.ios-modal-steps {
    padding-left: 1.4rem;
    color: var(--text-main);
    line-height: 2;
    font-size: 0.95rem;
}

.ios-modal-steps li {
    margin-bottom: 0.25rem;
}

.ios-share-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #007AFF;
    color: white;
    border-radius: 6px;
    width: 22px;
    height: 22px;
    font-size: 0.85rem;
    font-weight: 700;
    vertical-align: middle;
}

/* ── Link Esqueci minha senha ── */
.forgot-password-link {
    text-align: right;
    margin-top: -0.75rem;
    margin-bottom: 0.5rem;
}

.forgot-password-link a {
    font-size: 0.82rem;
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
}

.forgot-password-link a:hover {
    color: var(--accent-light);
    text-decoration: underline;
}

/* ── Modal Esqueci minha senha ── */
.forgot-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(28, 43, 75, 0.55);
    backdrop-filter: blur(4px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}

.forgot-modal-overlay.active {
    display: flex;
}

.forgot-modal-card {
    background: var(--white);
    border-radius: 24px;
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 400px;
    margin: 1rem;
    position: relative;
    box-shadow: 0 16px 48px rgba(28, 43, 75, 0.2);
    animation: fadeIn 0.3s ease-out;
}

.forgot-modal-card h3 {
    color: var(--primary);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.forgot-modal-card>p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.75rem;
    line-height: 1.5;
}

.forgot-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(28, 43, 75, 0.08);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: var(--transition);
}

.forgot-modal-close:hover {
    background: rgba(28, 43, 75, 0.15);
}