/**
 * ITSM Login Layout - Dynamic Floating Card
 * Matching landing page color scheme and glass effects
 */

:root {
  /* Landing page color scheme */
  --primary-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 25%, #334155 50%, #475569 75%, #64748b 100%);
  --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --accent-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  --dark-bg: #0f1419;
  --card-bg: rgba(255, 255, 255, 0.95);
  --glass-bg: rgba(255, 255, 255, 0.1);
  --text-primary: #1a202c;
  --text-secondary: #718096;
  --border-radius: 20px;
  --border-radius-btn: 12px;
  --transition: all 0.3s ease;
  --shadow-light: 0 20px 40px rgba(0, 0, 0, 0.1);
  --shadow-heavy: 0 30px 60px rgba(0, 0, 0, 0.15);
}

/* Reset and base styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
  background: var(--primary-gradient);
  min-height: 100vh;
  min-height: -webkit-fill-available; /* iOS Safari viewport fix */
  backdrop-filter: blur(10px);
  position: relative;
  overflow-x: hidden;
  /* Prevent elastic scrolling on iOS */
  -webkit-overflow-scrolling: touch;
  /* Prevent text size adjustment on orientation change */
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
}

/* Animated background particles - same as landing page */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    radial-gradient(circle at 25% 25%, rgba(59, 130, 246, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 75% 75%, rgba(96, 165, 250, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(30, 58, 138, 0.05) 0%, transparent 70%);
  animation: float 20s ease-in-out infinite;
  pointer-events: none;
  z-index: 1;
}

@keyframes float {
  0%, 100% { transform: translateY(0px) rotate(0deg); opacity: 1; }
  33% { transform: translateY(-20px) rotate(1deg); opacity: 0.8; }
  66% { transform: translateY(-10px) rotate(-1deg); opacity: 0.9; }
}

/* Two-column layout */
.login-layout {
  display: flex;
  height: 100vh;
  width: 100%;
  position: relative;
  z-index: 10;
}

/* Left side - Marketing content */
.login-left {
  flex: 1;
  background: transparent;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 4rem;
  color: white;
  position: relative;
  z-index: 10;
}

.brand-content {
  position: relative;
  z-index: 1;
}

.brand-logo {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 50%, #1e40af 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand-tagline {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, #ffffff 0%, #e2e8f0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand-description {
  font-size: 1.1rem;
  opacity: 0.9;
  line-height: 1.6;
  margin-bottom: 2rem;
  color: rgba(255, 255, 255, 0.8);
}

.feature-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.feature-list li {
  display: flex;
  align-items: center;
  margin-bottom: 1rem;
  font-size: 1rem;
  opacity: 0.9;
  color: rgba(255, 255, 255, 0.8);
}

.feature-list li .fas {
  margin-right: 0.75rem;
  color: rgba(255, 255, 255, 0.8);
}

/* Right side - Floating login card */
.login-right {
  flex: 0 0 400px;
  background: transparent;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2rem;
  position: relative;
  z-index: 10;
}

.login-form-container {
  max-width: 350px;
  width: 100%;
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-light);
  padding: 2.5rem;
  position: relative;
  z-index: 10;
  transition: var(--transition);
  animation: cardFloat 6s ease-in-out infinite;
}

@keyframes cardFloat {
  0%, 100% { transform: translateY(0px) scale(1); }
  50% { transform: translateY(-10px) scale(1.02); }
}

.login-form-container:hover {
  transform: translateY(-10px) scale(1.05);
  box-shadow: var(--shadow-heavy);
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 50%, #1e40af 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 400;
}

/* Form styling */
.form-group {
  margin-bottom: 1.5rem;
  position: relative;
}

.form-label {
  display: block;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid #e2e8f0;
  border-radius: var(--border-radius-btn);
  font-size: 1rem;
  background-color: #ffffff;
  outline: none;
  transition: var(--transition);
  font-family: inherit;
}

.form-control:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  transform: translateY(-2px);
}

.form-control.with-icon {
  padding-left: 3rem;
}

.input-group {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  font-size: 1rem;
  z-index: 5;
}

/* Remember me checkbox */
.remember-me {
  display: flex;
  align-items: center;
  margin: 1.5rem 0;
  gap: 0.75rem;
}

.remember-me input[type="checkbox"] {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 4px;
}

.remember-me label {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin: 0;
  font-weight: 400;
}

/* Button styling - matching landing page */
.btn-primary {
  width: 100%;
  background: var(--primary-gradient);
  border: none;
  border-radius: var(--border-radius-btn);
  padding: 12px 24px;
  font-weight: 500;
  letter-spacing: 0.5px;
  color: white;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  font-size: 1rem;
  margin: 1rem 0;
}

.btn-primary::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-primary:hover::before {
  left: 100%;
}

.btn-primary:hover {
  transform: scale(1.05);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.btn-primary:focus {
  outline: 2px solid rgba(255, 255, 255, 0.5);
  outline-offset: 2px;
}

.btn-primary:active {
  transform: scale(0.98);
}

.forgot-password-container {
  text-align: center;
  margin-top: 1.5rem;
}

.forgot-password-link {
  color: #3b82f6;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: var(--transition);
}

.forgot-password-link:hover {
  color: #1e40af;
  text-decoration: underline;
}

/* Alert styling */
.alert {
  padding: 1rem;
  border-radius: var(--border-radius-btn);
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  border: none;
}

.alert-danger {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-success {
  background: rgba(34, 197, 94, 0.1);
  color: #16a34a;
  border: 1px solid rgba(34, 197, 94, 0.2);
}

/* Enhanced Mobile Responsive Design */
@media (max-width: 1024px) {
  .login-layout {
    flex-direction: column;
  }
  
  .login-left {
    flex: 0 0 350px;
    padding: 3rem 2rem;
    text-align: center;
    align-items: center;
  }
  
  .login-right {
    flex: 1;
    padding: 2rem 1rem;
    min-height: calc(100vh - 350px);
  }
  
  .login-form-container {
    max-width: 100%;
    padding: 2.5rem;
    margin: 0 auto;
  }
}

@media (max-width: 768px) {
  html, body {
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 100vh;
  }
  
  .login-layout {
    flex-direction: column;
    min-height: 100vh;
  }
  
  .login-left {
    flex: 0 0 280px;
    padding: 2rem 1.5rem;
    text-align: center;
    align-items: center;
  }
  
  .login-right {
    flex: 1;
    padding: 1.5rem 1rem 2rem;
    justify-content: flex-start;
    padding-top: 2rem;
  }
  
  .login-form-container {
    max-width: 100%;
    padding: 2rem 1.5rem;
    margin: 0;
    border-radius: 16px;
    animation: none; /* Disable floating animation on mobile */
  }
  
  .brand-tagline {
    font-size: 1.5rem;
    line-height: 1.3;
  }
  
  .brand-description {
    font-size: 1rem;
    margin-bottom: 1.5rem;
  }
  
  .feature-list {
    display: none; /* Hide feature list on mobile to save space */
  }
  
  /* Enhanced touch targets for mobile */
  .form-control {
    padding: 1rem 1.25rem;
    font-size: 16px; /* Prevents zoom on iOS */
    border-radius: 12px;
    min-height: 48px; /* Minimum touch target size */
  }
  
  .form-control.with-icon {
    padding-left: 3.5rem;
  }
  
  .input-icon {
    left: 1.25rem;
    font-size: 1.1rem;
  }
  
  .btn-primary {
    padding: 1rem 1.5rem;
    font-size: 1rem;
    min-height: 48px;
    border-radius: 12px;
    margin: 1.5rem 0;
  }
  
  .remember-me {
    margin: 1.5rem 0;
    gap: 1rem;
  }
  
  .remember-me input[type="checkbox"] {
    width: 1.5rem;
    height: 1.5rem;
    min-width: 1.5rem;
  }
  
  .remember-me label {
    font-size: 1rem;
    line-height: 1.4;
  }
  
  .form-group {
    margin-bottom: 1.75rem;
  }
  
  .form-label {
    font-size: 1rem;
    margin-bottom: 0.75rem;
  }
}

@media (max-width: 640px) {
  .login-left {
    flex: 0 0 240px;
    padding: 1.5rem 1rem;
  }
  
  .login-right {
    padding: 1rem 0.75rem 2rem;
  }
  
  .login-form-container {
    padding: 1.5rem 1rem;
    border-radius: 12px;
    margin: 0;
  }
  
  .brand-tagline {
    font-size: 1.25rem;
  }
  
  .brand-description {
    font-size: 0.9rem;
    margin-bottom: 1rem;
  }
  
  .login-title {
    font-size: 1.25rem;
  }
  
  .login-subtitle {
    font-size: 0.875rem;
  }
  
  .login-header {
    margin-bottom: 1.5rem;
  }
}

@media (max-width: 480px) {
  .login-left {
    flex: 0 0 200px;
    padding: 1rem;
  }
  
  .login-right {
    padding: 0.75rem 0.5rem 1.5rem;
  }
  
  .login-form-container {
    padding: 1.25rem 0.75rem;
    border-radius: 10px;
  }
  
  .brand-logo {
    font-size: 1.4rem;
    margin-bottom: 1rem;
  }
  
  .brand-tagline {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
  }
  
  .brand-description {
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
  }
  
  .login-title {
    font-size: 1.1rem;
  }
  
  .login-subtitle {
    font-size: 0.8rem;
  }
  
  .form-control {
    padding: 0.875rem 1rem;
    font-size: 16px;
    min-height: 44px;
  }
  
  .form-control.with-icon {
    padding-left: 3rem;
  }
  
  .input-icon {
    left: 1rem;
    font-size: 1rem;
  }
  
  .btn-primary {
    padding: 0.875rem 1.25rem;
    font-size: 0.95rem;
    min-height: 44px;
  }
  
  .form-group {
    margin-bottom: 1.5rem;
  }
  
  .form-label {
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
  }
}

/* Landscape mobile orientation */
@media (max-width: 896px) and (orientation: landscape) and (max-height: 480px) {
  .login-layout {
    flex-direction: row;
  }
  
  .login-left {
    flex: 0 0 40%;
    padding: 1rem;
    min-height: 100vh;
  }
  
  .login-right {
    flex: 1;
    padding: 1rem;
    min-height: 100vh;
  }
  
  .login-form-container {
    max-width: 350px;
    padding: 1.5rem;
  }
  
  .brand-tagline {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
  }
  
  .brand-description {
    font-size: 0.8rem;
    margin-bottom: 1rem;
  }
  
  .feature-list {
    display: none;
  }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
  .login-form-container:hover {
    transform: none;
    box-shadow: var(--shadow-light);
  }
  
  .btn-primary:hover {
    transform: none;
    box-shadow: none;
  }
  
  .btn-primary:active {
    transform: scale(0.95);
    background: var(--accent-gradient);
  }
  
  .form-control:focus {
    transform: none;
  }
  
  /* Disable floating animation on touch devices */
  .login-form-container {
    animation: none;
  }
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
  .login-layout {
    min-height: -webkit-fill-available;
  }
  
  /* Fix iOS Safari input zoom */
  .form-control {
    font-size: 16px !important;
    -webkit-appearance: none;
    border-radius: 12px;
  }
  
  /* Prevent iOS Safari from adding blue highlight */
  .btn-primary {
    -webkit-tap-highlight-color: transparent;
  }
  
  /* Fix iOS Safari viewport issues */
  html {
    height: -webkit-fill-available;
  }
  
  body {
    min-height: -webkit-fill-available;
  }
}

/* Android Chrome specific optimizations */
@media screen and (-webkit-min-device-pixel-ratio: 1) {
  .form-control {
    zoom: 1;
  }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .login-form-container {
    border: 0.5px solid rgba(255, 255, 255, 0.2);
  }
}

/* Prevent zoom on input focus for mobile browsers */
@media screen and (max-width: 768px) {
  .form-control,
  select,
  textarea {
    font-size: 16px !important;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
  }
  
  /* Better touch targets */
  .btn-primary,
  .form-control,
  .remember-me input[type="checkbox"] {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* Improve readability on small screens */
  .login-title {
    font-size: 1.5rem !important;
    line-height: 1.2;
  }
  
  .login-subtitle {
    font-size: 1rem !important;
    margin-bottom: 1rem;
  }
}

/* Extra small devices optimization */
@media screen and (max-width: 375px) {
  .login-form-container {
    margin: 0.5rem;
    padding: 1rem;
    min-width: calc(100vw - 1rem);
    box-sizing: border-box;
  }
  
  .form-group {
    margin-bottom: 1.25rem;
  }
  
  .btn-primary {
    padding: 1rem;
    font-size: 1rem;
    font-weight: 600;
  }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
  .login-form-container,
  .btn-primary,
  .btn-primary::before,
  .form-control,
  body::before {
    transition: none;
    animation: none;
  }
  
  .login-form-container:hover {
    transform: none;
  }
  
  .btn-primary:hover {
    transform: none;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .login-form-container {
    border: 2px solid #000;
    background: rgba(255, 255, 255, 1);
  }
}
