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

:root {
    --primary-color: #8B1A1A;
    --primary-dark: #6B1414;
    --primary-light: #A52A2A;
    --accent-color: #D4AF37;
    --accent-light: #E8D48B;
    --bg-dark: #0A0A0F;
    --bg-card: rgba(16, 16, 26, 0.88);
    --text-primary: #FFFFFF;
    --text-secondary: #B8B8C8;
    --text-muted: #6B6B7A;
    --border-color: rgba(255, 255, 255, 0.08);
    --input-bg: rgba(255, 255, 255, 0.05);
    --input-focus: rgba(139, 26, 26, 0.2);
    --error-color: #FF6B6B;
    --success-color: #51CF66;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.5);
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* ═══════════════════════════════════════════════════
   BACKGROUND IMAGE (Login)
   ═══════════════════════════════════════════════════ */
.login-bg-image {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
}

.login-bg-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 30%;
    filter: brightness(0.3) saturate(1.1) blur(2px);
    transform: scale(1.05);
}

/* Particulas animadas de fundo */
.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    overflow: hidden;
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--accent-color);
    border-radius: 50%;
    opacity: 0.4;
    animation: float 20s infinite ease-in-out;
    box-shadow: 0 0 12px rgba(212, 175, 55, 0.5);
}

.particle:nth-child(1) { left: 10%; animation-delay: 0s; animation-duration: 15s; }
.particle:nth-child(2) { left: 20%; animation-delay: 2s; animation-duration: 18s; }
.particle:nth-child(3) { left: 30%; animation-delay: 4s; animation-duration: 22s; }
.particle:nth-child(4) { left: 40%; animation-delay: 1s; animation-duration: 16s; }
.particle:nth-child(5) { left: 50%; animation-delay: 3s; animation-duration: 20s; }
.particle:nth-child(6) { left: 60%; animation-delay: 5s; animation-duration: 17s; }
.particle:nth-child(7) { left: 70%; animation-delay: 2.5s; animation-duration: 19s; }
.particle:nth-child(8) { left: 80%; animation-delay: 4.5s; animation-duration: 21s; }

@keyframes float {
    0%, 100% {
        transform: translateY(100vh) translateX(0) scale(0);
        opacity: 0;
    }
    10% { opacity: 0.3; }
    50% {
        transform: translateY(-10vh) translateX(40px) scale(1);
        opacity: 0.5;
    }
    90% { opacity: 0.3; }
    100% {
        transform: translateY(-100vh) translateX(80px) scale(0);
        opacity: 0;
    }
}

/* Container principal */
.main-container {
    position: relative;
    z-index: 2;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

/* Ambient light effects */
.main-container::before,
.main-container::after {
    content: '';
    position: fixed;
    width: 700px;
    height: 700px;
    border-radius: 50%;
    filter: blur(140px);
    opacity: 0.5;
    pointer-events: none;
    z-index: 0;
}

.main-container::before {
    background: radial-gradient(circle, rgba(139, 26, 26, 0.6) 0%, transparent 70%);
    top: -250px;
    left: -250px;
    animation: lightMove1 18s ease-in-out infinite;
}

.main-container::after {
    background: radial-gradient(circle, rgba(212, 175, 55, 0.4) 0%, transparent 70%);
    bottom: -250px;
    right: -250px;
    animation: lightMove2 22s ease-in-out infinite;
}

@keyframes lightMove1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(150px, 100px) scale(1.2); }
    66% { transform: translate(-80px, 200px) scale(0.8); }
}

@keyframes lightMove2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(-120px, -150px) scale(1.3); }
    66% { transform: translate(100px, -80px) scale(0.85); }
}

/* Card de login */
.login-card {
    width: 100%;
    max-width: 460px;
    background: var(--bg-card);
    backdrop-filter: blur(24px) saturate(1.5);
    -webkit-backdrop-filter: blur(24px) saturate(1.5);
    border-radius: 22px;
    padding: 44px 36px;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
    animation: cardReveal 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    z-index: 1;
    overflow: hidden;
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color), var(--primary-color));
    background-size: 200% 100%;
    animation: shimmer 3s infinite;
}

@keyframes cardReveal {
    from { opacity: 0; transform: translateY(24px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Logo */
.logo-wrapper {
    text-align: center;
    margin-bottom: 28px;
    animation: fadeInScale 0.8s ease-out 0.2s both;
}

.main-logo {
    max-width: 240px;
    width: 100%;
    height: auto;
    filter: drop-shadow(0 4px 12px rgba(212, 175, 55, 0.25));
    transition: transform 0.3s ease;
}

.main-logo:hover {
    transform: scale(1.03);
}

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

/* Secao de boas-vindas */
.welcome-section {
    text-align: center;
    margin-bottom: 36px;
    animation: fadeIn 0.8s ease-out 0.3s both;
}

.welcome-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    font-weight: 400;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Formulario */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.form-group {
    position: relative;
    animation: fadeInUp 0.6s ease-out both;
}

.form-group .form-input {
    position: relative;
    z-index: 0;
}

.form-group:nth-child(1) { animation-delay: 0.35s; }
.form-group:nth-child(2) { animation-delay: 0.45s; }

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

.input-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.label-icon {
    font-size: 14px;
    opacity: 0.6;
}

.form-input {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 13px 16px;
    color: var(--text-primary);
    font-size: 15px;
    transition: all 0.3s ease;
    outline: none;
    font-family: inherit;
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-input:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--input-focus);
}

.input-line {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 0 0 12px 12px;
    z-index: 2;
    pointer-events: none;
    transform: translateZ(0);
    will-change: width;
}

.form-group:has(.form-input:focus) .input-line,
.form-group:has(.password-wrapper .form-input:focus) .input-line {
    width: 100%;
}

/* Password wrapper */
.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper .form-input {
    padding-right: 48px;
}

.toggle-password {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
    z-index: 1;
}

.toggle-password:hover {
    color: var(--text-primary);
}

.toggle-password:active {
    transform: scale(0.95);
}

/* Opcoes do formulario */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    animation: fadeInUp 0.6s ease-out 0.55s both;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.custom-checkbox {
    display: none;
}

.checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-radius: 5px;
    background: var(--input-bg);
    position: relative;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.custom-checkbox:checked + .checkmark {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.custom-checkbox:checked + .checkmark::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 5px;
    width: 5px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-text {
    font-size: 13px;
    color: var(--text-secondary);
}

.forgot-link {
    font-size: 13px;
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.3s ease;
    font-weight: 500;
}

.forgot-link:hover {
    color: var(--accent-light);
}

/* Botao de login */
.login-button {
    width: 100%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border: none;
    border-radius: 12px;
    padding: 15px;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    margin-top: 4px;
    animation: fadeInUp 0.6s ease-out 0.65s both;
    box-shadow: 0 4px 16px rgba(139, 26, 26, 0.3);
}

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

.login-button:hover::before {
    left: 100%;
}

.login-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(139, 26, 26, 0.4);
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-color) 100%);
}

.login-button:active {
    transform: translateY(0);
}

.login-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.button-text {
    position: relative;
    z-index: 1;
}

.button-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.spinner {
    width: 24px;
    height: 24px;
    color: white;
}

/* Mensagem de erro */
.error-message {
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid rgba(255, 107, 107, 0.2);
    border-radius: 10px;
    padding: 12px 16px;
    color: var(--error-color);
    font-size: 14px;
    text-align: center;
    animation: shake 0.5s ease;
    margin-top: 4px;
}

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

/* Rodape */
.footer {
    margin-top: 28px;
    text-align: center;
    animation: fadeIn 1s ease-out 0.8s both;
}

.copyright {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.6;
}

/* Responsividade */
@media (max-width: 768px) {
    .login-card {
        padding: 32px 24px;
        border-radius: 18px;
    }

    .main-logo {
        max-width: 200px;
    }

    .welcome-title {
        font-size: 24px;
    }

    .welcome-subtitle {
        font-size: 14px;
    }

    .form-options {
        flex-direction: column;
        align-items: flex-start;
    }

    .forgot-link {
        align-self: flex-end;
    }
}

@media (max-width: 480px) {
    .main-container {
        padding: 20px 16px;
    }

    .login-card {
        padding: 24px 20px;
    }

    .main-logo {
        max-width: 170px;
    }

    .welcome-title {
        font-size: 22px;
    }
}

/* Migration notice */
.migration-notice {
    background: rgba(212, 175, 55, 0.08);
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-radius: 12px;
    padding: 16px 18px;
    margin-bottom: 28px;
    text-align: center;
    animation: fadeInUp 0.6s ease-out 0.15s both;
}

.migration-notice p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0 0 4px 0;
}

.migration-notice p:last-child {
    margin-bottom: 0;
}

.migration-notice strong {
    color: var(--accent-color);
    font-weight: 600;
}

.migration-notice a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
}

.migration-notice a:hover {
    text-decoration: underline;
}

/* Melhorias de acessibilidade */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
