/* Modern Professional Login Styles - Mobile First Responsive */

:root {
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --secondary-color: #64748b;
  --success-color: #10b981;
  --danger-color: #ef4444;
  --warning-color: #f59e0b;
  --background-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --card-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --border-radius: 12px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --touch-target-min: 44px;
  --safe-top: env(safe-area-inset-top, 0);
  --safe-bottom: env(safe-area-inset-bottom, 0);
  --safe-left: env(safe-area-inset-left, 0);
  --safe-right: env(safe-area-inset-right, 0);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--background-gradient);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

/* Login Container - Flexbox with safe scrolling for mobile */
.login-container {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 16px;
  padding-top: max(16px, var(--safe-top));
  padding-bottom: max(16px, var(--safe-bottom));
  padding-left: max(16px, var(--safe-left));
  padding-right: max(16px, var(--safe-right));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Background Animation */
.bg-animation {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  overflow: hidden;
}

.floating-shapes {
  position: relative;
  width: 100%;
  height: 100%;
}

.shape {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  animation: float 6s ease-in-out infinite;
}

.shape-1 {
  width: 80px;
  height: 80px;
  top: 20%;
  left: 10%;
  animation-delay: 0s;
}

.shape-2 {
  width: 120px;
  height: 120px;
  top: 60%;
  right: 15%;
  animation-delay: 2s;
}

.shape-3 {
  width: 60px;
  height: 60px;
  bottom: 20%;
  left: 20%;
  animation-delay: 4s;
}

.shape-4 {
  width: 100px;
  height: 100px;
  top: 30%;
  right: 30%;
  animation-delay: 1s;
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px) rotate(0deg);
  }
  50% {
    transform: translateY(-20px) rotate(180deg);
  }
}

/* Login Card */
.login-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--border-radius);
  box-shadow: var(--card-shadow);
  padding: 1.5rem 1.25rem;
  width: 100%;
  max-width: 420px;
  min-width: 0;
  position: relative;
  z-index: 10;
  border: 1px solid rgba(255, 255, 255, 0.2);
  animation: slideUp 0.6s ease-out;
  flex-shrink: 0;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Login Header */
.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.logo-container {
  margin-bottom: 1.5rem;
}

.logo {
  height: 60px;
  width: auto;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

.login-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 0.5rem;
  letter-spacing: -0.025em;
}

.login-subtitle {
  color: var(--secondary-color);
  font-size: 0.95rem;
  margin: 0;
  font-weight: 400;
}

/* Form Styles */
.form-group {
  margin-bottom: 1.5rem;
}

.input-group {
  position: relative;
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: var(--transition);
  display: flex;
  flex-wrap: nowrap;
  min-width: 0;
}

.input-group:hover {
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.input-group.focused {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.input-group-text {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-right: none;
  color: var(--secondary-color);
  padding: 0.75rem 0.875rem;
  font-size: 1rem;
  min-width: var(--touch-target-min);
  transition: var(--transition);
}

.input-group.focused .input-group-text {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.form-control {
  border: 1px solid #e2e8f0;
  border-left: none;
  padding: 0.75rem 1rem;
  font-size: 16px;
  min-height: var(--touch-target-min);
  min-width: 0;
  flex: 1 1 auto;
  background: white;
  transition: var(--transition);
}

.form-control:focus {
  border-color: var(--primary-color);
  box-shadow: none;
  background: white;
}

.form-control::placeholder {
  color: #94a3b8;
  font-weight: 400;
}

/* Password Toggle Button - min touch target for mobile */
#togglePassword {
  border: 1px solid #e2e8f0;
  border-left: none;
  background: #f8fafc;
  color: var(--secondary-color);
  padding: 0 1rem;
  min-width: var(--touch-target-min);
  min-height: var(--touch-target-min);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

#togglePassword:hover {
  background: #e2e8f0;
  color: var(--primary-color);
}

/* Form Options */
.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.form-check {
  margin: 0;
}

.form-check-input {
  border-radius: 4px;
  border: 1px solid #d1d5db;
}

.form-check-input:checked {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

.form-check-label {
  color: var(--secondary-color);
  font-weight: 400;
}

.forgot-password {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
  word-break: break-word;
  flex-shrink: 0;
}

.forgot-password:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

/* Login Button */
.btn-login {
  width: 100%;
  padding: 0.875rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--border-radius);
  background: var(--primary-color);
  border: none;
  color: white;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.btn-login:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.3);
}

.btn-login:active {
  transform: translateY(0);
}

.btn-login:disabled {
  background: #94a3b8;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-spinner {
  margin-left: 0.5rem;
}

/* Login Footer */
.login-footer {
  text-align: center;
  margin-top: 1rem;
}

.register-text {
  color: var(--secondary-color);
  font-size: 0.9rem;
  margin: 0;
  word-wrap: break-word;
}

.register-link {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 600;
  transition: var(--transition);
}

.register-link:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

/* Alert Container */
.alert-container {
  margin-top: 1rem;
}

.alert {
  border-radius: var(--border-radius);
  border: none;
  font-size: 0.9rem;
  padding: 0.875rem 1rem;
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Footer Bottom - part of flow on mobile to prevent overlap */
.login-footer-bottom {
  text-align: center;
  padding: 1rem;
  padding-bottom: max(1rem, var(--safe-bottom));
  padding-left: max(1rem, var(--safe-left));
  padding-right: max(1rem, var(--safe-right));
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  z-index: 5;
  flex-shrink: 0;
  margin-top: auto;
}

.login-footer-bottom p {
  margin: 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.8rem;
  line-height: 1.4;
}

/* ====== RESPONSIVE - Mobile First ====== */

/* Small phones (320px - 479px) */
@media (max-width: 479px) {
  .login-container {
    padding: 12px;
    padding-top: max(12px, var(--safe-top));
    padding-bottom: max(12px, var(--safe-bottom));
    justify-content: flex-start;
    align-items: stretch;
  }
  
  .login-card {
    padding: 1.25rem 1rem;
    max-width: 100%;
    margin: auto 0;
    align-self: center;
  }
  
  .login-header {
    margin-bottom: 1.25rem;
  }
  
  .logo-container {
    margin-bottom: 1rem;
  }
  
  .logo {
    height: 48px;
    max-width: 100%;
    object-fit: contain;
  }
  
  .login-title {
    font-size: 1.25rem;
    line-height: 1.3;
    word-wrap: break-word;
  }
  
  .login-subtitle {
    font-size: 0.875rem;
  }
  
  .form-group {
    margin-bottom: 1.25rem;
  }
  
  .form-options {
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
    margin-bottom: 1.25rem;
  }
  
  .form-options .form-check-label,
  .form-options .forgot-password {
    font-size: 0.875rem;
  }
  
  .btn-login {
    padding: 0.875rem 1rem;
    font-size: 1rem;
    margin-bottom: 1.25rem;
  }
  
  .login-footer-bottom {
    padding: 0.875rem 12px;
    padding-bottom: max(0.875rem, var(--safe-bottom));
  }
  
  .login-footer-bottom p {
    font-size: 0.75rem;
  }
  
  /* Reduce background animation on small screens for performance */
  .shape {
    display: none;
  }
}

/* Medium phones / large phones (480px - 767px) */
@media (min-width: 480px) and (max-width: 767px) {
  .login-container {
    padding: 20px;
  }
  
  .login-card {
    padding: 2rem 1.5rem;
  }
  
  .login-title {
    font-size: 1.5rem;
  }
  
  .form-options {
    flex-direction: column;
    gap: 0.75rem;
    align-items: flex-start;
  }
  
  .login-footer-bottom {
    position: relative;
    margin-top: 1.5rem;
  }
}

/* Tablets and up (768px+) */
@media (min-width: 768px) {
  .login-container {
    padding: 24px;
    padding-bottom: 80px;
  }
  
  .login-card {
    padding: 2.5rem;
  }
  
  .login-footer-bottom {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    margin-top: 0;
  }
}

/* Loading Animation */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.fa-spinner {
  animation: spin 1s linear infinite;
}

/* Focus States for Accessibility */
.form-control:focus,
.btn-login:focus,
#togglePassword:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  .login-card {
    background: white;
    border: 2px solid #000;
  }
  
  .form-control {
    border: 2px solid #000;
  }
  
  .btn-login {
    border: 2px solid #000;
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .shape {
    animation: none;
  }
}