/* ============================================================
 Safe.ai-365 Login - Enhanced Theme & Full Responsive
 Palette: security/trust blue-teal theme
 ============================================================ */

.login-page,
body.login-page {
 min-height: 100vh;
 min-height: 100dvh;
 display: flex;
 align-items: center;
 justify-content: center;
 padding: clamp(1rem, 4vw, 3rem);
 background:
  radial-gradient(1200px 600px at 10% 0%, rgba(37, 99, 235, 0.18), transparent 60%),
  radial-gradient(1000px 500px at 100% 100%, rgba(13, 148, 136, 0.15), transparent 55%),
  linear-gradient(160deg, #f8fafc 0%, #eef2f7 100%);
 background-attachment: fixed;
 font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* Card */
.login-container {
 background: rgba(255, 255, 255, 0.94);
 backdrop-filter: blur(10px);
 -webkit-backdrop-filter: blur(10px);
 padding: clamp(1.5rem, 3vw, 2.5rem);
 border-radius: 16px;
 border: 1px solid rgba(255, 255, 255, 0.7);
 box-shadow:
  0 20px 45px -12px rgba(15, 23, 42, 0.18),
  0 0 0 1px rgba(226, 232, 240, 0.6);
 width: 100%;
 max-width: 420px;
 margin: 0 auto;
 animation: slideUp 0.5s ease-out;
}

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

@media (prefers-reduced-motion: reduce) {
 .login-container { animation: none; }
}

/* Logo */
.login-form .logo {
 text-align: center;
 margin-bottom: 1.75rem;
}

.login-form .logo img {
 max-height: 60px;
 width: auto;
 max-width: 100%;
 margin: 0 auto 1rem;
 object-fit: contain;
}

.login-form .logo h1 {
 color: #2563eb;
 margin: 0;
 font-size: clamp(1.5rem, 4vw, 1.9rem);
 font-weight: 700;
 letter-spacing: -0.02em;
}

.login-form .logo p {
 margin-bottom: 0;
 font-size: 0.9rem;
}

.login-form .logo p a {
 color: #64748b;
 text-decoration: none;
 transition: color 0.2s ease;
}

.login-form .logo p a:hover {
 color: #2563eb;
}

.login-form h2 {
 text-align: center;
 color: #64748b;
 margin-bottom: 0.5rem;
 margin-top: 0.5rem;
 font-weight: 600;
 font-size: 1.15rem;
}

/* Form groups */
.login-form .form-group {
 margin-top: 0.75rem;
 margin-bottom: 1rem;
}

.form-group {
 margin-bottom: 1.25rem;
}

.form-group label {
 display: block;
 margin-bottom: 0.4rem;
 color: #1e293b;
 font-weight: 600;
 font-size: 0.9rem;
}

.form-group input {
 width: 100%;
 box-sizing: border-box;
 padding: 0.875rem 1rem;
 border: 2px solid #e2e8f0;
 border-radius: 10px;
 font-size: 16px; /* prevents iOS zoom */
 font-family: inherit;
 transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
 background: #f8fafc;
 color: #1e293b;
}

.form-group input:focus {
 outline: none;
 border-color: #2563eb;
 background: #ffffff;
 box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.form-group input.error {
 border-color: #ef4444;
 background: #fef2f2;
}

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

.password-input-container input {
 padding-right: 3rem;
 flex: 1;
 min-width: 0;
}

.password-toggle {
 position: absolute;
 right: 0.75rem;
 background: none;
 border: none;
 cursor: pointer;
 padding: 0.25rem;
 border-radius: 6px;
 color: #64748b;
 transition: background-color 0.2s, color 0.2s;
 z-index: 1;
}

.password-toggle:hover {
 background-color: rgba(0, 0, 0, 0.05);
 color: #2563eb;
}

.password-toggle:focus {
 outline: 2px solid #2563eb;
 outline-offset: 2px;
}

.toggle-icon {
 font-size: 1.2rem;
 user-select: none;
 display: inline-flex;
}

/* Remember-me checkbox */
.checkbox-container {
 display: flex;
 align-items: center;
 cursor: pointer;
 font-size: 0.9rem;
 color: #475569;
 margin-bottom: 0;
 gap: 0.5rem;
}

.checkbox-container input[type="checkbox"] {
 position: static;
 opacity: 1;
 cursor: pointer;
 height: 18px;
 width: 18px;
 margin: 0;
 flex-shrink: 0;
 accent-color: #2563eb;
}

/* Submit button */
.btn-block {
 width: 100%;
 box-sizing: border-box;
 padding: 0.9rem 1rem;
 background: linear-gradient(135deg, #2563eb, #0d9488);
 color: #ffffff;
 border: none;
 border-radius: 10px;
 font-size: 1rem;
 font-weight: 600;
 font-family: inherit;
 cursor: pointer;
 transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
 margin-top: 1.25rem;
 min-height: 48px;
 -webkit-tap-highlight-color: transparent;
}

.btn-block:hover:not(:disabled) {
 filter: brightness(1.05);
 transform: translateY(-1px);
 box-shadow: 0 8px 20px -6px rgba(37, 99, 235, 0.5);
}

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

.btn-block:disabled {
 opacity: 0.65;
 cursor: not-allowed;
}

.btn-block:focus-visible {
 outline: 3px solid rgba(37, 99, 235, 0.4);
 outline-offset: 2px;
}

/* Footer */
.login-footer {
 text-align: center;
 margin-top: 1.75rem;
 padding-top: 1rem;
 border-top: 1px solid #f1f5f9;
}

.login-footer a {
 color: #2563eb;
 text-decoration: none;
 font-size: 0.9rem;
 transition: color 0.2s;
}

.login-footer a:hover {
 color: #1e40af;
 text-decoration: underline;
}

/* Alerts (inline) */
.alert {
 padding: 0.875rem;
 border-radius: 8px;
 margin-bottom: 1rem;
 font-size: 0.9rem;
}

.alert-error {
 background: #fef2f2;
 color: #b91c1c;
 border: 1px solid #fecaca;
}

.alert-success {
 background: #ecfdf5;
 color: #047857;
 border: 1px solid #a7f3d0;
}

.alert-warning {
 background: #fffbeb;
 color: #b45309;
 border: 1px solid #fde68a;
}

/* Floating toasts */
#loginErrorAlert,
#loginSuccessAlert {
 position: fixed !important;
 right: 16px !important;
 top: 16px !important;
 z-index: 1000;
 max-width: min(360px, calc(100vw - 32px));
 box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
}

#loginSuccessAlert { top: 72px !important; }

.alert-hide {
 opacity: 0 !important;
 transform: translateX(20px) !important;
 transition: opacity 0.25s ease, transform 0.25s ease !important;
}

/* Strengthened error/success alerts - keep overrides from original */
.alert.alert-error {
 display: block !important;
 visibility: visible !important;
 opacity: 1 !important;
 border-left: 4px solid #ef4444 !important;
 background: #fff5f5 !important;
 color: #c0392b !important;
 padding: 1rem !important;
 margin-bottom: 1.25rem !important;
 font-weight: 500;
 line-height: 1.5;
}

.alert.alert-error strong {
 display: block;
 margin-bottom: 0.25rem;
 font-weight: 700;
}

.alert.alert-success {
 display: block !important;
 visibility: visible !important;
 opacity: 1 !important;
 border-left: 4px solid #10b981 !important;
 background: #f0fdf4 !important;
 color: #15803d !important;
 padding: 1rem !important;
 margin-bottom: 1.25rem !important;
 font-weight: 500;
 line-height: 1.5;
}

.alert.alert-success strong {
 display: block;
 margin-bottom: 0.25rem;
 font-weight: 700;
}

/* ===== Responsive ===== */

/* Small tablets / large phones (landscape) */
@media (max-width: 640px) {
 body.login-page {
  padding: 1rem;
  align-items: flex-start;
  overflow-y: auto;
 }

 .login-container {
  padding: 1.5rem 1.25rem;
  border-radius: 14px;
 }
}

/* Phones */
@media (max-width: 480px) {
 .login-form .logo h1 {
  font-size: 1.4rem;
 }

 .login-form h2 {
  font-size: 1.05rem;
 }

 .checkbox-container {
  font-size: 0.85rem;
 }

 #loginErrorAlert,
 #loginSuccessAlert {
  right: 8px !important;
  left: 8px !important;
  top: 8px !important;
  max-width: none;
 }

 #loginSuccessAlert { top: 8px !important; }
}

/* Extra small phones */
@media (max-width: 360px) {
 .login-container {
  padding: 1.25rem 1rem;
 }

 .form-group input {
  padding: 0.75rem 0.875rem;
 }

 .btn-block {
  padding: 0.8rem;
 }
}

/* Large screens */
@media (min-width: 1600px) {
 .login-container {
  max-width: 460px;
 }
}

/* High contrast / forced colors */
@media (forced-colors: active) {
 .login-container {
  border: 1px solid CanvasText;
 }
 .btn-block {
  border: 1px solid ButtonText;
 }
}