/* ==========================================================================
   SRT DRUGSTORE CLUB - LOGIN PAGE UX DESIGN
   Modern Pharmacy Color Palette with Professional UX
   ========================================================================== */

:root {
  /* === Pharmacy Color Palette === */
  --primary-green: #2E7D32;
  --primary-green-light: #4CAF50;
  --primary-green-dark: #1B5E20;
  --secondary-blue: #1976D2;
  --secondary-blue-light: #42A5F5;
  --accent-teal: #00695C;
  --accent-teal-light: #4DB6AC;
  
  /* === Gradients === */
  --gradient-primary: linear-gradient(135deg, var(--primary-green) 0%, var(--primary-green-light) 100%);
  --gradient-secondary: linear-gradient(135deg, var(--secondary-blue) 0%, var(--secondary-blue-light) 100%);
  --gradient-accent: linear-gradient(135deg, var(--accent-teal) 0%, var(--accent-teal-light) 100%);
  --gradient-overlay: linear-gradient(135deg, rgba(46, 125, 50, 0.9) 0%, rgba(76, 175, 80, 0.9) 100%);
  
  /* === Neutral Colors === */
  --white: #FFFFFF;
  --gray-50: #FAFAFA;
  --gray-100: #F5F5F5;
  --gray-200: #EEEEEE;
  --gray-300: #E0E0E0;
  --gray-400: #BDBDBD;
  --gray-500: #9E9E9E;
  --gray-600: #757575;
  --gray-700: #616161;
  --gray-800: #424242;
  --gray-900: #212121;
  
  /* === Status Colors === */
  --success: #4CAF50;
  --warning: #FF9800;
  --error: #F44336;
  --info: #2196F3;
  
  /* === Shadows === */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.15);
  --shadow-xl: 0 12px 24px rgba(0, 0, 0, 0.18);
  
  /* === Border Radius === */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 20px;
  
  /* === Spacing === */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;
  
  /* === Typography === */
  --font-family: 'Sarabun', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 1.875rem;
  --font-size-4xl: 2.25rem;
  
  /* === Transitions === */
  --transition-fast: 0.15s ease-in-out;
  --transition-base: 0.3s ease-in-out;
  --transition-slow: 0.5s ease-in-out;
  
  /* === Z-Index === */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
}

/* ==========================================================================
   RESET & BASE STYLES
   ========================================================================== */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

*::before,
*::after {
  box-sizing: border-box;
}

html {
  line-height: 1.15;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: 1.6;
  color: var(--gray-800);
  background: linear-gradient(-45deg, #2E7D32, #4CAF50, #00BCD4, #3F51B5, #9C27B0, #E91E63);
  background-size: 400% 400%;
  animation: gradientShift 8s ease infinite;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   LOGIN CONTAINER & LAYOUT
   ========================================================================== */

.login-container {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: var(--space-lg);
  position: relative;
}

.login-content {
  width: 100%;
  max-width: 420px;
  background: var(--white);
  border-radius: var(--radius-2xl);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  animation: fadeInUp 0.6s ease-out;
  border: 1px solid rgba(255, 255, 255, 0.3);
  position: relative;
}

/* ==========================================================================
   LOGIN HEADER
   ========================================================================== */

.login-header {
  background: var(--gradient-primary);
  padding: var(--space-xl) var(--space-lg);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.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 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.1)" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
  pointer-events: none;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-md);
  position: relative;
  z-index: 1;
}

.logo-image {
  max-width: 80px;
  height: auto;
}

.login-header h2 {
  color: var(--white);
  font-size: var(--font-size-3xl);
  font-weight: 700;
  margin-bottom: var(--space-sm);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  position: relative;
  z-index: 1;
}

.login-header p {
  color: rgba(255, 255, 255, 0.9);
  font-size: var(--font-size-base);
  font-weight: 400;
  position: relative;
  z-index: 1;
}

/* ==========================================================================
   BACK HOME BUTTON
   ========================================================================== */

.back-home-btn {
  position: absolute;
  top: var(--space-lg);
  left: var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: rgba(255, 255, 255, 0.2);
  color: var(--white);
  text-decoration: none;
  border-radius: var(--radius-lg);
  font-size: var(--font-size-sm);
  font-weight: 500;
  transition: var(--transition-base);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  z-index: 2;
}

.back-home-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

/* ==========================================================================
   LOGIN FORM
   ========================================================================== */

.login-form {
  padding: var(--space-xl) var(--space-2xl);
  background: var(--white);
}

.form-group {
  margin-bottom: var(--space-lg);
  position: relative;
}

.input-container {
  position: relative;
  margin-bottom: var(--space-lg);
  min-height: 60px;
}

.input-container input {
  width: 85%;
  margin: 0 auto;
  display: block;
  padding: var(--space-md) var(--space-xl) var(--space-md) calc(var(--space-2xl) + 24px);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-xl);
  font-size: var(--font-size-base);
  font-family: var(--font-family);
  transition: all var(--transition-base);
  background: rgba(255, 255, 255, 0.9);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-sm);
  outline: none;
}

.input-container input:focus {
  border-color: var(--primary-green);
  box-shadow: 0 0 0 4px rgba(46, 125, 50, 0.15), var(--shadow-md);
  background: var(--white);
}

.input-container input:hover {
  border-color: var(--primary-green-light);
  box-shadow: var(--shadow-md);
}

.input-icon {
  position: absolute;
  left: calc(7.5% + var(--space-md));
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  font-size: var(--font-size-base);
  transition: var(--transition-base);
  z-index: 1;
}

.input-container.focused .input-icon,
.input-container.has-value .input-icon {
  color: var(--primary-green);
}

.input-container label {
  position: absolute;
  left: calc(7.5% + var(--space-2xl) + 24px);
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  font-size: var(--font-size-base);
  font-weight: 400;
  transition: all var(--transition-base);
  pointer-events: none;
  background: transparent;
  z-index: 1;
}

.input-container.focused label,
.input-container.has-value label {
  top: -8px;
  left: calc(7.5% + var(--space-md));
  font-size: var(--font-size-sm);
  color: var(--primary-green);
  background: var(--white);
  padding: 0 var(--space-xs);
  font-weight: 600;
}

.toggle-password {
  position: absolute;
  right: calc(7.5% + var(--space-md));
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--gray-400);
  cursor: pointer;
  font-size: var(--font-size-base);
  transition: var(--transition-base);
  padding: var(--space-xs);
  z-index: 2;
}

.toggle-password:hover {
  color: var(--primary-green);
}

/* ==========================================================================
   FORM OPTIONS
   ========================================================================== */

.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-xl);
  font-size: var(--font-size-sm);
}

.remember-me {
  display: flex;
  align-items: center;
  cursor: pointer;
  color: var(--gray-600);
  font-weight: 500;
}

.remember-me input[type="checkbox"] {
  display: none;
}

.checkmark {
  width: 18px;
  height: 18px;
  border: 2px solid var(--gray-300);
  border-radius: var(--radius-sm);
  margin-right: var(--space-sm);
  position: relative;
  transition: var(--transition-base);
}

.remember-me input[type="checkbox"]:checked + .checkmark {
  background: var(--gradient-primary);
  border-color: var(--primary-green);
}

.remember-me input[type="checkbox"]:checked + .checkmark::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--white);
  font-size: var(--font-size-xs);
  font-weight: 700;
}

.forgot-password {
  color: var(--primary-green);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition-base);
}

.forgot-password:hover {
  color: var(--primary-green-dark);
  text-decoration: underline;
}

/* ==========================================================================
   LOGIN BUTTON
   ========================================================================== */

.login-btn {
  width: 85%;
  margin: var(--space-sm) auto var(--space-lg);
  display: block;
  padding: var(--space-md) var(--space-xl);
  background: var(--gradient-primary);
  color: var(--white);
  border: none;
  border-radius: var(--radius-xl);
  font-size: var(--font-size-base);
  font-weight: 600;
  font-family: var(--font-family);
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
  text-align: center;
  box-shadow: var(--shadow-md);
}

/* Button content layout */
.login-btn-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
}

.login-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.login-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.btn-text,
.btn-icon {
  transition: var(--transition-base);
}

.loading-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
}

.loading-spinner.hidden {
  display: none;
}

/* ==========================================================================
   LOGIN STATUS
   ========================================================================== */

.login-status {
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: 500;
  text-align: center;
  margin-bottom: var(--space-md);
  display: none;
  animation: slideDown 0.3s ease-out;
}

.login-status.success {
  background: rgba(76, 175, 80, 0.1);
  color: var(--success);
  border: 1px solid rgba(76, 175, 80, 0.3);
}

.login-status.error {
  background: rgba(244, 67, 54, 0.1);
  color: var(--error);
  border: 1px solid rgba(244, 67, 54, 0.3);
}

.login-status.info {
  background: rgba(33, 150, 243, 0.1);
  color: var(--info);
  border: 1px solid rgba(33, 150, 243, 0.3);
}

/* ==========================================================================
   CONTACT INFO
   ========================================================================== */

.contact-info {
  text-align: center;
  margin-top: var(--space-sm);
  padding: var(--space-sm);
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.contact-info p {
  color: var(--white);
  font-size: var(--font-size-sm);
  margin-bottom: var(--space-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
}

.contact-info p:last-child {
  margin-bottom: 0;
}

.contact-info i {
  color: rgba(255, 255, 255, 0.8);
  width: 16px;
  text-align: center;
}

/* ==========================================================================
   FIELD ERROR STYLES
   ========================================================================== */

.input-container.error input {
  border-color: var(--error);
  box-shadow: 0 0 0 4px rgba(244, 67, 54, 0.15);
}

.field-error {
  display: block;
  color: var(--error);
  font-size: var(--font-size-sm);
  margin-top: var(--space-xs);
  margin-left: 7.5%;
  margin-right: 7.5%;
  font-weight: 500;
  animation: slideDown 0.3s ease-out;
}

/* ==========================================================================
   OVERLAY STATUS
   ========================================================================== */

.overlay-status {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

.overlay-status.show {
  opacity: 1;
  visibility: visible;
}

.status-content {
  background: var(--white);
  padding: var(--space-2xl);
  border-radius: var(--radius-2xl);
  text-align: center;
  max-width: 400px;
  width: 90%;
  box-shadow: var(--shadow-xl);
  animation: statusPopIn 0.3s ease-out;
}

.status-content.loading .status-icon {
  color: var(--primary-green);
}

.status-content.success .status-icon {
  color: var(--success);
}

.status-content.error .status-icon {
  color: var(--error);
}

.status-icon {
  font-size: var(--font-size-4xl);
  margin-bottom: var(--space-lg);
}

#statusTitle {
  font-size: var(--font-size-xl);
  font-weight: 600;
  margin-bottom: var(--space-sm);
  color: var(--gray-800);
}

#statusMessage {
  color: var(--gray-600);
  font-size: var(--font-size-base);
}

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes statusPopIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */

@media (max-width: 768px) {
  .login-container {
    padding: var(--space-md);
  }
  
  .login-content {
    max-width: 95%;
  }
  
  .login-header {
    padding: var(--space-lg) var(--space-md);
  }
  
  .login-form {
    padding: var(--space-xl) var(--space-lg) var(--space-lg);
  }
  
  .input-container {
    min-height: 55px;
  }
  
  .input-container input {
    width: 100%;
    margin: 0;
  }
  
  .input-icon {
    left: calc(var(--space-md) + var(--space-sm));
  }
  
  .input-container label {
    left: calc(var(--space-2xl) + 24px);
  }
  
  .input-container.focused label,
  .input-container.has-value label {
    left: calc(var(--space-md) + var(--space-xs));
  }
  
  .toggle-password {
    right: calc(var(--space-md) + var(--space-sm));
  }
  
  .field-error {
    margin-left: 0;
    margin-right: 0;
  }
  
  .login-btn {
    width: 100%;
  }
  
  .contact-info {
    margin-top: var(--space-sm);
    padding: var(--space-sm);
  }
}

@media (max-width: 480px) {
  .back-home-btn span {
    display: none;
  }
  
  .back-home-btn {
    padding: var(--space-sm);
    width: 40px;
    height: 40px;
    justify-content: center;
  }
  
  .logo-image {
    max-width: 70px;
  }
  
  .login-header h2 {
    font-size: var(--font-size-2xl);
  }
  
  .form-options {
    flex-direction: column;
    gap: var(--space-sm);
    align-items: flex-start;
  }
}

/* Focus styles for better accessibility */
.back-home-btn:focus,
.login-btn:focus,
.toggle-password:focus {
  outline: 2px solid var(--primary-green);
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .input-container input {
    border-width: 3px;
  }
  
  .login-btn {
    border: 3px solid var(--primary-green-dark);
  }
  
  .login-header {
    background: var(--primary-green-dark);
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
