/* SnapBiz Authentication Pages Enhanced Styles
   Professional and Modern Design for Login/Logout/Password Reset
   Versione: 1.0.0
*/

/* ============================================================================
   VARIABILI CSS PER CONSISTENZA CROMATICA
   ============================================================================ */
:root {
  /* Auth-specific colors */
  --auth-gradient-primary: linear-gradient(135deg, var(--bs-primary) 0%, var(--purple) 100%);
  --auth-gradient-success: linear-gradient(135deg, var(--bs-success) 0%, var(--bs-info) 100%);
  --auth-gradient-warning: linear-gradient(135deg, var(--bs-warning) 0%, var(--bs-primary) 100%);
  
  /* Glass morphism */
  --auth-glass-bg: rgba(255, 255, 255, 0.98);
  --auth-glass-border: rgba(255, 255, 255, 0.2);
  --auth-glass-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
  --auth-glass-blur: blur(20px);
  
  /* Animation timings */
  --auth-transition-fast: 0.3s ease;
  --auth-transition-medium: 0.6s ease-out;
  
  /* Spacing */
  --auth-border-radius: 20px;
  --auth-border-radius-sm: 12px;
  --auth-padding-lg: 3rem;
  --auth-padding-md: 2rem;
  --auth-padding-sm: 1.5rem;
}

/* ============================================================================
   LAYOUT BASE PER PAGINE DI AUTENTICAZIONE/* ============================================================================
   AUTH PAGE BACKGROUNDS - FIXED AND GRADIENT SPECIFIC
   ============================================================================ */
body.auth-page,
.auth-page {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  overflow-x: hidden;
  background-attachment: fixed !important;
  background-repeat: no-repeat !important;
  background-size: cover !important;
  min-height: 100vh;
}

/* Specific backgrounds for each auth page - Higher specificity */
body.auth-page.login-page,
.auth-page.login-page {
  background: linear-gradient(135deg, var(--bs-primary) 0%, var(--purple) 100%) !important;
  background-color: transparent !important;
}

body.auth-page.logout-success,
.auth-page.logout-success {
  background: linear-gradient(135deg, var(--bs-success) 0%, var(--bs-info) 100%) !important;
  background-color: transparent !important;
}

body.auth-page.password-reset,
.auth-page.password-reset {
  background: linear-gradient(135deg, var(--bs-warning) 0%, var(--bs-primary) 100%) !important;
  background-color: transparent !important;
}

body.auth-page.password-complete,
.auth-page.password-complete {
  background: linear-gradient(135deg, var(--bs-success) 0%, var(--bs-primary) 100%) !important;
  background-color: transparent !important;
}

body.auth-page.registration-page,
.auth-page.registration-page {
  background: linear-gradient(135deg, #0f4c75 0%, #3282b8 30%, #6d28d9 70%, #4338ca 100%) !important;
  background-color: transparent !important;
}

.auth-page .navbar {
  background: rgba(255, 255, 255, 0.1) !important;
  backdrop-filter: var(--auth-glass-blur);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-page .navbar-brand {
  color: white !important;
  font-weight: 700;
}

.auth-page .navbar-nav .nav-link {
  color: rgba(255, 255, 255, 0.9) !important;
}

.auth-page .navbar-nav .nav-link:hover {
  color: white !important;
}

/* ============================================================================
   COMPONENTI CARD CONDIVISI
   ============================================================================ */
.auth-card,
.logout-card,
.success-card {
  background: var(--auth-glass-bg);
  backdrop-filter: var(--auth-glass-blur);
  border-radius: var(--auth-border-radius);
  border: 1px solid var(--auth-glass-border);
  box-shadow: var(--auth-glass-shadow);
  position: relative;
  overflow: hidden;
  animation: slideInUp 0.8s ease-out;
}

@keyframes slideInUp {
  0% {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ============================================================================
   SEZIONI VISIVE
   ============================================================================ */
.auth-visual {
  position: relative;
  overflow: hidden;
}

.auth-visual::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.1'%3E%3Ccircle cx='30' cy='30' r='2'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") repeat;
  animation: float 20s infinite linear;
  z-index: 1;
}

.auth-visual > * {
  position: relative;
  z-index: 2;
}

@keyframes float {
  0% { transform: translateX(0) translateY(0); }
  100% { transform: translateX(-60px) translateY(-60px); }
}

.feature-icon,
.logout-icon,
.success-icon,
.email-icon {
  animation: iconBounce 0.8s ease-out 0.3s both;
}

@keyframes iconBounce {
  0% {
    opacity: 0;
    transform: scale(0.3) rotate(-45deg);
  }
  50% {
    opacity: 1;
    transform: scale(1.1) rotate(-22deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

/* ============================================================================
   COMPONENTI FORM
   ============================================================================ */
.auth-form {
    padding: var(--auth-padding-lg);
    background: white;
}

.auth-form h1 {
    color: var(--bs-primary);
    font-weight: 700;
    margin-bottom: 0.5rem;
    font-size: 2rem;
}

.auth-form .subtitle {
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 1rem;
}

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

.form-floating .form-control {
    border: 2px solid #e2e8f0;
    border-radius: var(--auth-border-radius-sm);
    padding: 1rem 0.75rem 0.25rem;
    height: auto;
    font-size: 1rem;
    transition: var(--auth-transition-fast);
}

.form-floating .form-control:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 4px rgba(var(--bs-primary-rgb), 0.1);
}

.form-floating label {
    color: var(--text-muted);
    font-weight: 500;
}

/* ============================================================================
   PULSANTI DI AUTENTICAZIONE
   ============================================================================ */
.btn-auth {
    background: var(--bs-primary);
    border: none;
    border-radius: var(--auth-border-radius-sm);
    padding: 0.875rem 2rem;
    font-weight: 600;
    font-size: 1rem;
    width: 100%;
    margin-bottom: 1rem;
    transition: var(--auth-transition-fast);
    color: white;
}

.btn-auth::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 ease;
}

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

.btn-auth:hover {
    background: var(--bs-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(var(--bs-primary-rgb), 0.3);
    color: white;
}

.btn-secondary-auth {
    background: transparent;
    border: 2px solid #e2e8f0;
    border-radius: var(--auth-border-radius-sm);
    padding: 0.875rem 2rem;
    font-weight: 600;
    font-size: 1rem;
    width: 100%;
    color: var(--text-secondary);
    transition: var(--auth-transition-fast);
    text-decoration: none;
    display: block;
    text-align: center;
}

.btn-secondary-auth:hover {
    border-color: var(--bs-primary);
    color: var(--bs-primary);
    background: rgba(var(--bs-primary-rgb), 0.05);
    text-decoration: none;
}

/* ============================================================================
   COMPONENTI INFORMATIVI
   ============================================================================ */
.info-box,
.warning-box,
.security-info,
.steps-container,
.password-requirements,
.form-errors {
  border-radius: var(--auth-border-radius-sm);
  position: relative;
  overflow: hidden;
  animation: fadeIn 0.6s ease-out;
}

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

.step {
  animation: slideInRight 0.6s ease-out;
  animation-fill-mode: both;
}

.step:nth-child(1) { animation-delay: 0.1s; }
.step:nth-child(2) { animation-delay: 0.2s; }
.step:nth-child(3) { animation-delay: 0.3s; }
.step:nth-child(4) { animation-delay: 0.4s; }

@keyframes slideInRight {
  0% {
    opacity: 0;
    transform: translateX(-20px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ============================================================================
   EFFETTI DI HOVER E FOCUS AVANZATI
   ============================================================================ */
.auth-links a {
  position: relative;
  transition: all var(--auth-transition-fast);
}

.auth-links a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--bs-primary);
  transition: width var(--auth-transition-fast);
}

.auth-links a:hover::after {
  width: 100%;
}

/* ============================================================================
   AUTH LINKS - CHECKBOX E FORGOT PASSWORD ALIGNMENT
   ============================================================================ */
.auth-links {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 0 0.75rem; /* Allineamento con i form-floating inputs */
}

.auth-links .form-check {
    margin-bottom: 0; /* Rimuovi il margin per l'allineamento */
    display: flex;
    align-items: center;
}

.auth-links .form-check-input {
    margin-right: 0.5rem;
    margin-top: 0; /* Rimuovi il margin top di default */
}

.auth-links .form-check-label {
    margin-bottom: 0;
    color: var(--text-secondary);
    font-weight: 500;
}

.auth-links a {
    color: var(--bs-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
    white-space: nowrap; /* Previene il wrap del testo del link */
    position: relative;
}

.auth-links a:hover {
    color: var(--bs-primary-dark);
}

/* ============================================================================
   RESPONSIVE DESIGN AVANZATO
   ============================================================================ */
@media (max-width: 991.98px) {
  .auth-visual {
    display: none;
  }
  
  .auth-form,
  .logout-card,
  .success-card {
    padding: var(--auth-padding-md) var(--auth-padding-sm);
  }
}

@media (max-width: 575.98px) {
  .auth-container,
  .logout-container,
  .success-container {
    padding: 20px 0;
  }
  
  .auth-card,
  .logout-card,
  .success-card {
    margin: 1rem;
    border-radius: 16px;
  }
  
  .btn-auth,
  .btn-secondary-auth {
    display: block;
    width: 100%;
    margin: 0.5rem 0;
  }
  
  /* Mobile fallback for fixed backgrounds */
  body.auth-page,
  .auth-page {
    background-attachment: scroll !important;
  }
}

/* ============================================================================
   ACCESSIBILITÀ E FOCUS
   ============================================================================ */
.auth-page *:focus-visible {
  outline: 3px solid rgba(var(--bs-primary-rgb), 0.5);
  outline-offset: 2px;
}

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

/* ============================================================================
   DARK MODE SUPPORT (per future implementazioni)
   ============================================================================ */
@media (prefers-color-scheme: dark) {
  .auth-page {
    /* Future dark mode variables */
  }
}

/* ============================================================================
   PRINT STYLES
   ============================================================================ */
@media print {
  .auth-page {
    background: white !important;
  }
  
  .auth-card,
  .logout-card,
  .success-card {
    box-shadow: none !important;
    border: 1px solid #ddd !important;
  }
  
  .auth-visual {
    display: none !important;
  }
}

/* ============================================================================
   HIGH CONTRAST TEXT FIXES FOR GRADIENT BACKGROUNDS
   ============================================================================ */

/* Force white text for all elements in auth-visual sections */
.auth-visual,
.auth-visual *:not(.btn):not(.form-control) {
    color: white !important;
}

.auth-visual h1,
.auth-visual h2,
.auth-visual h3,
.auth-visual h4,
.auth-visual h5,
.auth-visual h6 {
    color: white !important;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.auth-visual p,
.auth-visual span,
.auth-visual small,
.auth-visual div:not(.feature-icon):not(.btn) {
    color: white !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Icons in auth-visual */
.auth-visual i {
    color: white !important;
}

/* Grid layouts in auth-visual */
.auth-visual .row .col-4,
.auth-visual .row .col-6,
.auth-visual .row .col-8,
.auth-visual .row .col-12,
.auth-visual .row .col-lg-6 {
    color: white !important;
}

/* Special sections with enhanced contrast */
.auth-visual .security-features,
.auth-visual .steps-container {
    background: rgba(255, 255, 255, 0.15) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    backdrop-filter: blur(10px);
}

.auth-visual .security-features h6,
.auth-visual .steps-container h6 {
    color: white !important;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.auth-visual .security-features li,
.auth-visual .steps-container li {
    color: white !important;
    opacity: 0.95;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.auth-visual .security-features i,
.auth-visual .steps-container i {
    color: white !important;
}

/* Step numbers in visual sections */
.auth-visual .step-number {
    background: rgba(255, 255, 255, 0.2) !important;
    color: white !important;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

/* Feature icons with better contrast */
.auth-visual .feature-icon {
    background: rgba(255, 255, 255, 0.25) !important;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* ============================================================================
   ACCESSIBILITY AND HIGH CONTRAST MODE
   ============================================================================ */
@media (prefers-contrast: high) {
    .auth-visual {
        background: #000 !important;
    }
    
    .auth-visual,
    .auth-visual * {
        color: #fff !important;
        text-shadow: none !important;
    }
    
    .auth-visual .feature-icon {
        background: rgba(255, 255, 255, 0.9) !important;
        border: 3px solid white !important;
    }
    
    .auth-visual .feature-icon i {
        color: #000 !important;
    }
}

/* ============================================================================
   REDUCED MOTION SUPPORT
   ============================================================================ */
@media (prefers-reduced-motion: reduce) {
    .auth-visual::before {
        animation: none;
    }
    
    * {
        transition: none !important;
        animation: none !important;
    }
}

/* ============================================================================
   SPECIFIC PAGE BACKGROUNDS
   ============================================================================ */
.auth-page.password-reset {
    background: linear-gradient(135deg, var(--bs-warning) 0%, var(--bs-primary) 100%) !important;
}

.auth-page.logout-success {
    background: linear-gradient(135deg, var(--bs-success) 0%, var(--bs-info) 100%) !important;
}

.auth-page.password-complete {
    background: linear-gradient(135deg, var(--bs-success) 0%, var(--bs-primary) 100%) !important;
}

.auth-page.registration-page {
    background: linear-gradient(135deg, #0f4c75 0%, #3282b8 30%, #6d28d9 70%, #4338ca 100%) !important;
}

/* Mobile fallback for background-attachment fixed */
@media (max-width: 768px) {
    .auth-page {
        background-attachment: scroll !important;
        background-repeat: no-repeat !important;
        background-size: cover !important;
    }
}
