/**
 * Theme: Waterworks & Waste Management System (ระบบประปาและค่าขยะ)
 * Organization: องค์การบริหารส่วนตำบลไม้ขาว (Maikhaow Subdistrict Administrative Organization)
 * Author: Antigravity IDE UI Enhancement
 */

:root {
  --primary-water: #0284c7;        /* Clean Water Blue */
  --primary-water-dark: #0369a1;
  --primary-water-light: #e0f2fe;
  --primary-waste: #059669;        /* Eco Environment Emerald */
  --primary-waste-dark: #047857;
  --primary-waste-light: #d1fae5;
  --accent-cyan: #06b6d4;
  --accent-teal: #14b8a6;
  
  --bg-gradient-start: #f0f9ff;
  --bg-gradient-end: #ecfdf5;
  --surface-white: #ffffff;
  --surface-glass: rgba(255, 255, 255, 0.92);
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --border-subtle: #e2e8f0;
  --border-focus: #38bdf8;
  
  --shadow-sm: 0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 8px 20px rgba(2, 132, 199, 0.08);
  --shadow-lg: 0 20px 40px -10px rgba(15, 23, 42, 0.12), 0 0 1px rgba(0, 0, 0, 0.08);
  --shadow-glow: 0 10px 25px -5px rgba(2, 132, 199, 0.35);
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 24px;
  --radius-full: 9999px;
  
  --font-thai: 'Prompt', 'Sarabun', 'SarabunLatin', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Base resets & typography */
body.login-page-body {
  font-family: var(--font-thai) !important;
  margin: 0 !important;
  padding: 0 !important;
  min-height: 100vh;
  display: flex !important;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #e0f2fe 0%, #f0fdf4 50%, #e0f7fa 100%) !important;
  position: relative;
  overflow-x: hidden;
  color: var(--text-main);
  box-sizing: border-box;
}

/* Ambient animated decorative background blobs */
.login-bg-decor {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.blob-water {
  position: absolute;
  top: -10%;
  left: -5%;
  width: 550px;
  height: 550px;
  background: radial-gradient(circle, rgba(14, 165, 233, 0.22) 0%, rgba(56, 189, 248, 0.05) 70%, transparent 100%);
  border-radius: 50%;
  filter: blur(60px);
  animation: floatOrb 18s ease-in-out infinite alternate;
}

.blob-waste {
  position: absolute;
  bottom: -15%;
  right: -5%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.18) 0%, rgba(52, 211, 153, 0.04) 70%, transparent 100%);
  border-radius: 50%;
  filter: blur(70px);
  animation: floatOrbReverse 22s ease-in-out infinite alternate;
}

.blob-center {
  position: absolute;
  top: 40%;
  right: 25%;
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.12) 0%, transparent 70%);
  border-radius: 50%;
  filter: blur(50px);
}

@keyframes floatOrb {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(60px, 40px) scale(1.08); }
  100% { transform: translate(-30px, 70px) scale(0.95); }
}

@keyframes floatOrbReverse {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-50px, -40px) scale(1.06); }
  100% { transform: translate(40px, -60px) scale(0.96); }
}

/* Background Subtle Grid Pattern */
.login-bg-grid {
  position: absolute;
  inset: 0;
  background-image: 
    linear-gradient(to right, rgba(2, 132, 199, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(2, 132, 199, 0.05) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: 0.6;
}

/* Master Layout Container */
.login-main-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1060px;
  margin: 30px auto;
  padding: 16px;
  box-sizing: border-box;
}

/* Main Split Card */
.login-card-wrapper {
  display: flex;
  flex-direction: row;
  background: var(--surface-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   Left Panel: Municipal Brand & System Showcase (Enhanced Background)
   ========================================================================== */
.login-brand-panel {
  flex: 1.15;
  background: radial-gradient(circle at 10% 10%, #0369a1 0%, #075985 25%, #0c4a6e 50%, #064e3b 85%, #022c22 100%) !important;
  padding: 44px 38px;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.12);
}

/* Multi-layer decorative container */
.brand-panel-decor {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}

/* Ambient Glowing Spheres for Depth and Motion */
.brand-glow-sphere {
  position: absolute;
  border-radius: 50%;
  filter: blur(55px);
  pointer-events: none;
}

.sphere-1 {
  top: -10%;
  right: -8%;
  width: 330px;
  height: 330px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.45) 0%, rgba(14, 165, 233, 0.15) 60%, transparent 100%);
  animation: pulseSphere1 9s ease-in-out infinite alternate;
}

.sphere-2 {
  bottom: -6%;
  left: -10%;
  width: 380px;
  height: 380px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.4) 0%, rgba(5, 150, 105, 0.12) 65%, transparent 100%);
  animation: pulseSphere2 11s ease-in-out infinite alternate;
}

.sphere-3 {
  top: 42%;
  right: 18%;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.35) 0%, transparent 70%);
  animation: pulseSphere3 8s ease-in-out infinite alternate;
}

@keyframes pulseSphere1 {
  0% { transform: scale(1) translate(0, 0); opacity: 0.7; }
  50% { transform: scale(1.15) translate(-20px, 15px); opacity: 1; }
  100% { transform: scale(0.95) translate(15px, 25px); opacity: 0.7; }
}

@keyframes pulseSphere2 {
  0% { transform: scale(1) translate(0, 0); opacity: 0.65; }
  50% { transform: scale(1.12) translate(25px, -15px); opacity: 0.95; }
  100% { transform: scale(0.92) translate(-10px, -20px); opacity: 0.65; }
}

@keyframes pulseSphere3 {
  0% { transform: scale(0.9) translate(0, 0); opacity: 0.5; }
  100% { transform: scale(1.2) translate(-15px, -10px); opacity: 0.85; }
}

/* Modern Civic Dot Grid Pattern */
.brand-pattern-grid {
  position: absolute;
  inset: 0;
  background-image: 
    radial-gradient(circle, rgba(255, 255, 255, 0.15) 1.2px, transparent 1.2px),
    linear-gradient(to right, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 26px 26px, 52px 52px, 52px 52px;
  opacity: 0.65;
  mask-image: radial-gradient(ellipse at center, rgba(0,0,0,1) 40%, rgba(0,0,0,0.2) 100%);
  -webkit-mask-image: radial-gradient(ellipse at center, rgba(0,0,0,1) 40%, rgba(0,0,0,0.2) 100%);
}

/* Concentric Ripple Rings (Water Motif) */
.brand-ripple-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(56, 189, 248, 0.2);
  pointer-events: none;
}

.ripple-1 {
  top: 55px;
  left: 35px;
  width: 140px;
  height: 140px;
  animation: ripplePulse 7s ease-out infinite;
}

.ripple-2 {
  top: 35px;
  left: 15px;
  width: 180px;
  height: 180px;
  border-color: rgba(52, 211, 153, 0.15);
  animation: ripplePulse 7s ease-out infinite 2.5s;
}

@keyframes ripplePulse {
  0% { transform: scale(0.85); opacity: 0.3; }
  50% { opacity: 0.7; }
  100% { transform: scale(1.15); opacity: 0.2; }
}

/* Layered Fluid Waves at bottom (Aqua to Eco Emerald) */
.brand-svg-waves {
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 270px;
  pointer-events: none;
  z-index: 1;
  opacity: 0.85;
}

.wave-layer {
  transition: all 0.5s ease;
}

.wave-1 {
  animation: waveSway1 12s ease-in-out infinite alternate;
}

.wave-2 {
  animation: waveSway2 15s ease-in-out infinite alternate;
}

.wave-3 {
  animation: waveSway3 9s ease-in-out infinite alternate;
}

@keyframes waveSway1 {
  0% { transform: translateX(0) translateY(0); }
  100% { transform: translateX(-20px) translateY(8px); }
}

@keyframes waveSway2 {
  0% { transform: translateX(0) translateY(0); }
  100% { transform: translateX(25px) translateY(-6px); }
}

@keyframes waveSway3 {
  0% { transform: translateX(0) translateY(0); }
  100% { transform: translateX(-15px) translateY(5px); }
}

/* Header Area */
.brand-header-area {
  position: relative;
  z-index: 2;
}

.brand-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  color: #f0fdf4;
  margin-bottom: 22px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.brand-badge-pill .pill-dot {
  width: 8px;
  height: 8px;
  background-color: #34d399;
  border-radius: 50%;
  box-shadow: 0 0 10px #34d399;
  animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.brand-title-box {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.brand-title-text h1 {
  font-size: 24px;
  font-weight: 700;
  margin: 0;
  line-height: 1.3;
  color: #ffffff;
  letter-spacing: -0.3px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

.brand-title-text p {
  margin: 5px 0 0 0;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 400;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.2);
}

/* Feature List with Glossy Glassmorphism & Accent Left Borders */
.brand-feature-list {
  position: relative;
  z-index: 2;
  margin: 28px 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.brand-feature-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: rgba(255, 255, 255, 0.1) !important;
  border: 1px solid rgba(255, 255, 255, 0.22) !important;
  border-left: 3.5px solid transparent !important;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.brand-feature-item:nth-child(1) {
  border-left-color: #38bdf8 !important; /* Water Cyan */
}

.brand-feature-item:nth-child(2) {
  border-left-color: #34d399 !important; /* Eco Emerald */
}

.brand-feature-item:nth-child(3) {
  border-left-color: #fbbf24 !important; /* Finance Amber */
}

.brand-feature-item:hover {
  background: rgba(255, 255, 255, 0.18) !important;
  transform: translateX(6px) translateY(-1px) !important;
  border-color: rgba(255, 255, 255, 0.4) !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15) !important;
}

.feature-icon-wrapper {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 18px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.feature-icon-water {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.4), rgba(14, 165, 233, 0.5));
  color: #e0f2fe;
  border: 1px solid rgba(125, 211, 252, 0.5);
}

.feature-icon-waste {
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.4), rgba(16, 185, 129, 0.5));
  color: #ecfdf5;
  border: 1px solid rgba(110, 231, 183, 0.5);
}

.feature-icon-report {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.4), rgba(245, 158, 11, 0.5));
  color: #fffbeb;
  border: 1px solid rgba(253, 230, 138, 0.5);
}

.feature-content h4 {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 3px 0;
  color: #ffffff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.feature-content p {
  font-size: 12.5px;
  margin: 0;
  color: rgba(255, 255, 255, 0.84);
  line-height: 1.45;
}

.brand-footer-note {
  position: relative;
  z-index: 2;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  padding-top: 16px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-footer-note i {
  margin-right: 6px;
  color: #38bdf8;
}

/* ==========================================================================
   Right Panel: Modern Login Form
   ========================================================================== */
.login-form-panel {
  flex: 1;
  background: var(--surface-white);
  padding: 44px 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
}

.form-header-area {
  margin-bottom: 26px;
  text-align: left;
}

.form-welcome-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 6px 0;
  letter-spacing: -0.3px;
}

.form-welcome-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.5;
}

/* Form Controls with modern icons and states */
.custom-form-group {
  margin-bottom: 20px;
  position: relative;
}

.custom-form-label {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 7px;
  letter-spacing: 0.2px;
}

.custom-form-label .required-mark {
  color: #ef4444;
  margin-left: 2px;
}

.custom-input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon-lead {
  position: absolute;
  left: 15px;
  color: #94a3b8;
  font-size: 16px;
  pointer-events: none;
  transition: color 0.2s ease;
  z-index: 2;
}

.custom-input.form-control,
.custom-input {
  width: 100% !important;
  height: 48px !important;
  padding: 10px 44px 10px 42px !important;
  font-size: 14.5px !important;
  font-family: var(--font-thai) !important;
  color: var(--text-main) !important;
  background-color: #f8fafc !important;
  border: 1.5px solid var(--border-subtle) !important;
  border-radius: var(--radius-md) !important;
  outline: none !important;
  box-shadow: none !important;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
  box-sizing: border-box !important;
}

.custom-input.form-control:focus,
.custom-input:focus {
  background-color: #ffffff !important;
  border-color: var(--border-focus) !important;
  box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.15) !important;
}

.custom-input:focus + .input-icon-lead,
.custom-input:focus ~ .input-icon-lead {
  color: var(--primary-water);
}

/* Password Toggle Button */
.input-toggle-pass {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 16px;
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease, background-color 0.2s ease;
  z-index: 3;
}

.input-toggle-pass:hover {
  color: var(--primary-water);
  background-color: #f1f5f9;
}

/* Submit Action Button */
.login-submit-container {
  margin-top: 24px;
  margin-bottom: 22px;
}

.btn-modern-login.btn-login,
.btn-modern-login {
  width: 100% !important;
  height: 50px !important;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 50%, #059669 100%) !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: var(--radius-md) !important;
  font-size: 16px !important;
  font-weight: 600 !important;
  font-family: var(--font-thai) !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 10px !important;
  box-shadow: var(--shadow-glow) !important;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
  position: relative !important;
  overflow: hidden !important;
}

.btn-modern-login::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.6s ease;
}

.btn-modern-login:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px -5px rgba(2, 132, 199, 0.45) !important;
}

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

.btn-modern-login:active {
  transform: translateY(0);
  box-shadow: 0 5px 12px rgba(2, 132, 199, 0.3) !important;
}

/* Form Footer / Official Contact Info */
.login-contact-card {
  background: #f8fafc;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.6;
  text-align: center;
}

.contact-card-org {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 2px;
}

.contact-card-location {
  font-size: 12.5px;
  font-weight: 600;
  color: #475569;
  margin-bottom: 4px;
}

.contact-details-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 16px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed #e2e8f0;
}

.contact-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #475569;
  font-size: 12px;
}

.contact-chip i {
  color: var(--primary-water);
  font-size: 12px;
}

.contact-chip a {
  color: #0284c7;
  text-decoration: none;
  transition: color 0.15s ease;
}

.contact-chip a:hover {
  text-decoration: underline;
  color: #0369a1;
}

/* ==========================================================================
   Responsive Adaptations for Multi-device Support
   ========================================================================== */

/* Tablets and small laptops (< 992px) */
@media screen and (max-width: 991px) {
  .login-card-wrapper {
    flex-direction: column;
    max-width: 580px;
    margin: 0 auto;
  }
  
  .login-brand-panel {
    padding: 32px 28px;
  }
  
  .brand-feature-list {
    margin: 18px 0;
    gap: 12px;
  }
  
  .login-form-panel {
    padding: 34px 28px;
  }
}

/* Mobile Devices (< 640px) */
@media screen and (max-width: 639px) {
  body.login-page-body {
    padding: 12px;
    align-items: flex-start;
  }

  .login-main-container {
    margin: 10px auto 20px auto;
    padding: 0;
  }

  .login-card-wrapper {
    border-radius: 18px;
  }

  .login-brand-panel {
    padding: 24px 20px 20px 20px;
  }

  .brand-title-box {
    gap: 12px;
    margin-bottom: 12px;
  }

  .brand-title-text h1 {
    font-size: 19px;
  }

  .brand-title-text p {
    font-size: 12.5px;
  }

  /* Compact features on mobile to keep form readily visible */
  .brand-feature-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin: 14px 0 10px 0;
  }

  .brand-feature-item {
    padding: 10px 12px;
    gap: 10px;
  }

  .feature-icon-wrapper {
    width: 32px;
    height: 32px;
    font-size: 14px;
    border-radius: 8px;
  }

  .feature-content h4 {
    font-size: 13.5px;
  }

  .feature-content p {
    font-size: 11.5px;
  }

  .brand-footer-note {
    display: none;
  }

  .login-form-panel {
    padding: 26px 20px;
  }

  .form-welcome-title {
    font-size: 20px;
  }

  .form-welcome-subtitle {
    font-size: 13px;
  }

  .custom-input.form-control,
  .custom-input {
    height: 46px !important;
    font-size: 14px !important;
  }

  .btn-modern-login.btn-login,
  .btn-modern-login {
    height: 48px !important;
    font-size: 15px !important;
  }

  .contact-details-row {
    flex-direction: column;
    align-items: center;
    gap: 6px;
  }
}

/* Extra Small Phones (< 380px) */
@media screen and (max-width: 380px) {
  .brand-feature-list {
    display: none;
  }
  
  .brand-badge-pill {
    font-size: 11.5px;
    padding: 4px 10px;
  }
}
