/* Login Moderno - Reserva Santa Rosa */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --dark-color: #34495e;
    --light-color: #ecf0f1;
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    --border-radius: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    height: 100%;
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

body.login-body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gradient-primary);
    min-height: 100vh;
    height: 100%;
    min-height: -webkit-fill-available;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 15px;
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
}

/* Animação de fundo */
body.login-body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.05)" stroke-width="1"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    animation: float 20s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(1deg); }
}

/* Container principal */
.login-container {
    max-width: 400px;
    width: 100%;
    position: relative;
    z-index: 1;
    margin: auto;
}

/* Card principal */
.login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    border: 1px solid rgba(255, 255, 255, 0.2);
    overflow: hidden;
    transition: var(--transition);
}

.login-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
}

/* Header do card */
.login-header {
    background: var(--gradient-primary);
    padding: 18px 15px 15px;
    text-align: center;
    position: relative;
}

.login-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 20"><path d="M0,10 Q25,0 50,10 T100,10 V20 H0 Z" fill="rgba(255,255,255,0.1)"/></svg>') no-repeat bottom;
    background-size: cover;
}

/* Logo container */
.logo-container {
    position: relative;
    z-index: 2;
    margin-bottom: 8px;
}

.logo {
    width: 50px;
    height: 50px;
    background: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: var(--transition);
    box-shadow: 
        0 6px 15px rgba(0, 0, 0, 0.1),
        0 3px 8px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: visible;
}

.logo::before {
    content: '';
    position: absolute;
    width: 58px;
    height: 58px;
    top: -4px;
    left: -4px;
    border-radius: 50%;
    background: conic-gradient(
        from 0deg,
        #4a90c2 0deg,
        #5ba3d4 45deg,
        #6bb6e6 90deg,
        #7bc9f8 135deg,
        #5ba3d4 180deg,
        #4a90c2 225deg,
        #3987bf 270deg,
        #2874ac 315deg,
        #4a90c2 360deg
    );
    z-index: -1;
    animation: logoRotate 8s linear infinite;
}

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

.logo:hover {
    transform: scale(1.05);
    box-shadow: 
        0 15px 35px rgba(0, 0, 0, 0.15),
        0 8px 20px rgba(0, 0, 0, 0.1);
}

.logo img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    filter: none;
    transition: var(--transition);
}

.logo:hover img {
    transform: scale(1.02);
}

.logo-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: #ffffff;
    border-radius: 50%;
    color: #4a90c2;
    font-size: 22px;
    font-weight: 800;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    letter-spacing: 1px;
    position: relative;
}

.logo-fallback::before {
    content: '✦';
    position: absolute;
    font-size: 45px;
    color: #4a90c2;
    opacity: 0.3;
    z-index: -1;
    animation: sparkle 2s ease-in-out infinite alternate;
}

@keyframes sparkle {
    0% { transform: scale(1) rotate(0deg); opacity: 0.3; }
    100% { transform: scale(1.1) rotate(15deg); opacity: 0.6; }
}

.logo-fallback-active .logo-fallback {
    display: flex !important;
}

.logo-fallback-active {
    background: #ffffff !important;
    border: 3px solid rgba(255, 255, 255, 0.3) !important;
}

.title {
    color: white;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    letter-spacing: 0.5px;
}

.subtitle {
    color: rgba(255, 255, 255, 0.95);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.8px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Body do card */
.login-body {
    padding: 15px 15px;
}

/* Alertas */
.alert {
    border: none;
    border-radius: 10px;
    padding: 12px 15px;
    margin-bottom: 15px;
    font-weight: 500;
    font-size: 14px;
    animation: slideIn 0.3s ease-out;
}

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

.alert-danger {
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    color: white;
    box-shadow: 0 4px 15px rgba(238, 90, 82, 0.3);
}

.alert-success {
    background: linear-gradient(135deg, #51cf66, #40c057);
    color: white;
    box-shadow: 0 4px 15px rgba(64, 192, 87, 0.3);
}

/* Formulário */
.form-group {
    margin-bottom: 15px;
}

.form-label {
    display: block;
    color: var(--dark-color);
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 13px;
    letter-spacing: 0.3px;
}

.input-group {
    position: relative;
}

.form-control {
    width: 100%;
    padding: 12px 15px 12px 40px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 15px;
    transition: var(--transition);
    background: #f8f9fa;
}

.form-control:focus {
    outline: none;
    border-color: var(--secondary-color);
    background: white;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
    transform: translateY(-1px);
}

.input-icon {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    font-size: 16px;
    transition: var(--transition);
    z-index: 2;
}

.form-control:focus + .input-icon {
    color: var(--secondary-color);
}

.form-text {
    font-size: 12px;
    color: #6c757d;
    margin-top: 4px;
    font-style: italic;
}

/* Botão de mostrar senha */
.password-toggle {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    font-size: 18px;
    transition: var(--transition);
    z-index: 2;
}

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

/* Botão principal */
.btn-login {
    width: 100%;
    padding: 12px;
    background: var(--gradient-primary);
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.5px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

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

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

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

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

/* Divider */
.divider {
    text-align: center;
    margin: 18px 0;
    position: relative;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e9ecef;
}

.divider span {
    background: white;
    padding: 0 20px;
    color: #6c757d;
    font-size: 14px;
    position: relative;
}

/* Link de reset */
.reset-link {
    display: inline-block;
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 500;
    padding: 10px 20px;
    border-radius: 8px;
    transition: var(--transition);
}

.reset-link:hover {
    background: rgba(52, 152, 219, 0.1);
    transform: translateX(5px);
}

/* Footer do card */
.login-footer {
    background: #f8f9fa;
    padding: 12px 15px;
    text-align: center;
    border-top: 1px solid #e9ecef;
}

.login-footer small {
    color: #6c757d;
    line-height: 1.4;
    font-size: 12px;
}

/* Formulário de reset */
.reset-form {
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.reset-form.active {
    display: block;
}

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

.btn-secondary {
    background: #6c757d;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    transition: var(--transition);
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

.btn-warning {
    background: linear-gradient(135deg, #ffeaa7, #fdcb6e);
    border: none;
    padding: 16px;
    border-radius: 12px;
    color: #2d3436;
    font-weight: 600;
    transition: var(--transition);
}

.btn-warning:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(253, 203, 110, 0.4);
}

/* Responsividade */
@media (max-width: 768px) {
    body.login-body {
        padding: 10px;
        align-items: center;
        justify-content: center;
    }
    
    .login-container {
        max-width: 100%;
        margin: 0 auto;
    }
    
    .login-header {
        padding: 25px 15px 20px;
    }
    
    .login-body {
        padding: 25px 20px;
    }
    
    .title {
        font-size: 22px;
    }
    
    .subtitle {
        font-size: 14px;
    }
    
    .logo {
        width: 80px;
        height: 80px;
        margin-bottom: 15px;
    }
    
    .logo::before {
        width: 88px;
        height: 88px;
        top: -4px;
        left: -4px;
    }
    
    .logo img {
        width: 55px;
        height: 55px;
    }
    
    .logo-fallback {
        font-size: 22px;
    }
    
    .logo-fallback::before {
        font-size: 45px;
    }
}

@media (max-width: 480px) {
    body.login-body {
        padding: 15px;
        min-height: 100vh;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .login-container {
        max-width: 100%;
        width: 100%;
        margin: 0;
    }
    
    .login-header {
        padding: 20px 15px 15px;
    }
    
    .logo {
        width: 55px;
        height: 55px;
        margin-bottom: 10px;
    }
    
    .logo::before {
        width: 63px;
        height: 63px;
    }
    
    .logo img {
        width: 38px;
        height: 38px;
    }
    
    .title {
        font-size: 22px;
        margin-bottom: 5px;
    }
    
    .subtitle {
        font-size: 13px;
    }
    
    .login-body {
        padding: 18px 15px;
    }
    
    .form-group {
        margin-bottom: 18px;
    }
    
    .alert {
        padding: 14px 16px;
        margin-bottom: 20px;
        font-size: 14px;
    }
    
    .btn-login {
        height: 50px;
        font-size: 16px;
    }
    
    .login-footer {
        padding: 15px;
    }
    
    .login-footer small {
        font-size: 12px;
        line-height: 1.4;
    }
}

/* Animações de entrada */
.login-card {
    animation: slideUp 0.6s ease-out;
}

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

/* Estados de loading */
.btn-login.loading {
    pointer-events: none;
    opacity: 0.8;
}

.btn-login.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Melhorias de acessibilidade */
.form-control:focus,
.btn-login:focus,
.reset-link:focus {
    outline: 2px solid var(--secondary-color);
    outline-offset: 2px;
}

/* Estilo para o autocomplete do navegador */
.form-control:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 30px #f8f9fa inset;
    -webkit-text-fill-color: var(--dark-color);
}

.form-control:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 30px white inset;
}

/* Media Queries para Responsividade */

/* Notebooks e Laptops de 14 polegadas */
@media (max-height: 768px) and (min-width: 900px) {
    body.login-body {
        padding: 10px;
    }
    
    .login-container {
        max-width: 280px;
    }
    
    .login-header {
        padding: 15px 15px 12px;
    }
    
    .logo {
        width: 45px;
        height: 45px;
        margin-bottom: 6px;
    }
    
    .logo::before {
        width: 53px;
        height: 53px;
    }
    
    .logo img {
        width: 28px;
        height: 28px;
    }
    
    .title {
        font-size: 18px;
        margin-bottom: 3px;
    }
    
    .subtitle {
        font-size: 11px;
    }
    
    .login-body {
        padding: 12px 15px;
    }
    
    .form-group {
        margin-bottom: 12px;
    }
    
    .form-label {
        margin-bottom: 4px;
        font-size: 12px;
    }
    
    .form-control {
        padding: 10px 12px 10px 35px;
        font-size: 14px;
    }
    
    .input-icon {
        left: 11px;
        font-size: 14px;
    }
    
    .btn-login {
        padding: 10px;
        font-size: 14px;
    }
    
    .alert {
        padding: 10px 12px;
        margin-bottom: 12px;
        font-size: 13px;
    }
    
    .divider {
        margin: 15px 0;
    }
    
    .login-footer {
        padding: 10px 12px;
    }
    
    .login-footer small {
        font-size: 11px;
        line-height: 1.3;
    }
}

@media (max-width: 480px) {
    body.login-body {
        padding: 15px;
    }
    
    .login-container {
        max-width: 100%;
        width: 100%;
    }
    
    .login-header {
        padding: 20px 15px 15px;
    }
    
    .logo {
        width: 55px;
        height: 55px;
        margin-bottom: 10px;
    }
    
    .logo::before {
        width: 63px;
        height: 63px;
    }
    
    .logo img {
        width: 38px;
        height: 38px;
    }
    
    .title {
        font-size: 22px;
        margin-bottom: 5px;
    }
    
    .subtitle {
        font-size: 13px;
    }
    
    .login-body {
        padding: 18px 15px;
    }
    
    .form-group {
        margin-bottom: 18px;
    }
    
    .alert {
        padding: 14px 16px;
        margin-bottom: 20px;
        font-size: 14px;
    }
    
    .btn-login {
        height: 50px;
        font-size: 16px;
    }
    
    .login-footer {
        padding: 15px;
    }
    
    .login-footer small {
        font-size: 12px;
        line-height: 1.4;
    }
}

@media (max-width: 360px) {
    body.login-body {
        padding: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .login-container {
        margin: 0;
    }
    
    .login-header {
        padding: 18px 12px 12px;
    }
    
    .logo {
        width: 50px;
        height: 50px;
    }
    
    .logo::before {
        width: 58px;
        height: 58px;
    }
    
    .logo img {
        width: 35px;
        height: 35px;
    }
    
    .title {
        font-size: 20px;
    }
    
    .subtitle {
        font-size: 12px;
    }
    
    .login-body {
        padding: 15px 12px;
    }
    
    .form-group {
        margin-bottom: 16px;
    }
    
    .form-control {
        padding: 14px 16px;
        font-size: 16px; /* Evita zoom no iOS */
    }
}

@media (max-height: 600px) {
    body.login-body {
        padding: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .login-header {
        padding: 15px 20px 12px;
    }
    
    .logo {
        width: 50px;
        height: 50px;
        margin-bottom: 8px;
    }
    
    .logo::before {
        width: 58px;
        height: 58px;
    }
    
    .logo img {
        width: 35px;
        height: 35px;
    }
    
    .title {
        font-size: 20px;
        margin-bottom: 4px;
    }
    
    .subtitle {
        font-size: 13px;
    }
    
    .login-body {
        padding: 15px 20px;
    }
    
    .form-group {
        margin-bottom: 15px;
    }
    
    .alert {
        padding: 12px 16px;
        margin-bottom: 15px;
    }
}

/* Otimizações para landscape em dispositivos móveis */
@media (max-height: 500px) and (orientation: landscape) {
    body.login-body {
        padding: 10px;
    }
    
    .login-header {
        padding: 12px 20px 10px;
    }
    
    .logo-container {
        margin-bottom: 5px;
    }
    
    .logo {
        width: 45px;
        height: 45px;
        margin-bottom: 6px;
    }
    
    .logo::before {
        width: 53px;
        height: 53px;
    }
    
    .logo img {
        width: 30px;
        height: 30px;
    }
    
    .title {
        font-size: 18px;
        margin-bottom: 3px;
    }
    
    .subtitle {
        font-size: 12px;
    }
    
    .login-body {
        padding: 12px 20px;
    }
    
    .form-group {
        margin-bottom: 12px;
    }
    
    .alert {
        padding: 10px 14px;
        margin-bottom: 12px;
        font-size: 13px;
    }
    
    .btn-login {
        height: 45px;
        font-size: 15px;
    }
    
    .login-footer {
        padding: 10px 15px;
    }
    
    .login-footer small {
        font-size: 11px;
    }
}

/* Garantir centralização em TODOS os dispositivos móveis */
@media screen and (max-width: 768px) {
    html {
        height: 100%;
        width: 100%;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
        background-attachment: fixed;
    }
    
    body {
        height: 100%;
        width: 100%;
        background: transparent !important;
    }
    
    body.login-body {
        display: flex !important;
        flex-direction: column;
        align-items: center !important;
        justify-content: center !important;
        min-height: 100vh;
        min-height: -webkit-fill-available;
        padding: 15px;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
        background-attachment: fixed;
    }
    
    .login-container {
        width: 100%;
        max-width: 420px;
        margin: auto;
        flex-shrink: 0;
    }
}

/* Ajuste específico para Android WebView */
@media screen and (max-width: 480px) {
    html, body, body.login-body {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
        background-attachment: fixed;
    }
    
    body.login-body {
        padding: 10px;
    }
    
    .login-container {
        max-width: 100%;
    }
    
    .login-card {
        margin: 0;
    }
}
