/**
 * Modern Split-Screen Login Page
 * Responsive Material Design UI
 */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  font-family: var(--font-sans);
  min-height: 100%;
  background: #f8fafc;
}

/* ============================================
   SPLIT SCREEN LAYOUT
   ============================================ */

.login-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ============================================
   LEFT PANEL - INFO & BRANDING
   ============================================ */

.login-info-panel {
  flex: 1;
  min-width: 0; /* Allow shrinking */
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(1.5rem, 4vw, 3rem);
  position: relative;
  overflow: hidden;
}

.login-info-panel::before {
  content: '';
  position: absolute;
  top: -30%;
  left: -30%;
  width: 160%;
  height: 160%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, transparent 50%);
  animation: pulse-bg 20s ease-in-out infinite;
  pointer-events: none;
}

.login-info-panel::after {
  content: '';
  position: absolute;
  bottom: -20%;
  right: -20%;
  width: 60%;
  height: 60%;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.2) 0%, transparent 60%);
  animation: pulse-bg 15s ease-in-out infinite reverse;
  pointer-events: none;
}

@keyframes pulse-bg {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(15px, 15px) scale(1.03); }
}

/* ============================================
   FLOATING MESSAGES ANIMATION
   ============================================ */

.floating-messages {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.floating-msg {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  opacity: 0;
  animation: floatAway 8s ease-in-out infinite;
}

.floating-msg .material-icons-outlined,
.floating-msg .fab {
  font-size: 20px;
}

/* SMS Messages - Blue */
.msg-sms {
  background: rgba(59, 130, 246, 0.25);
  color: #60a5fa;
  left: 15%;
  bottom: 20%;
  animation-delay: 0s;
}

.msg-sms-2 {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
  left: 70%;
  bottom: 30%;
  animation-delay: 4s;
  width: 34px;
  height: 34px;
}

.msg-sms-2 .material-icons-outlined {
  font-size: 17px;
}

/* Email Messages - Purple */
.msg-email {
  background: rgba(139, 92, 246, 0.25);
  color: #a78bfa;
  left: 45%;
  bottom: 15%;
  animation-delay: 1.5s;
}

.msg-email-2 {
  background: rgba(168, 85, 247, 0.2);
  color: #c4b5fd;
  left: 25%;
  bottom: 35%;
  animation-delay: 5.5s;
  width: 32px;
  height: 32px;
}

.msg-email-2 .material-icons-outlined {
  font-size: 16px;
}

/* WhatsApp Messages - Green */
.msg-whatsapp {
  background: rgba(37, 211, 102, 0.25);
  color: #25D366;
  left: 75%;
  bottom: 25%;
  animation-delay: 3s;
}

@keyframes floatAway {
  0% {
    opacity: 0;
    transform: translateY(0) scale(0.5);
  }
  10% {
    opacity: 0.8;
    transform: translateY(-20px) scale(1);
  }
  30% {
    opacity: 0.9;
    transform: translateY(-80px) scale(1.05) rotate(-5deg);
  }
  50% {
    opacity: 0.7;
    transform: translateY(-160px) scale(0.95) rotate(3deg);
  }
  70% {
    opacity: 0.5;
    transform: translateY(-260px) scale(0.85) rotate(-2deg);
  }
  90%, 100% {
    opacity: 0;
    transform: translateY(-350px) scale(0.6) rotate(5deg);
  }
}

.info-content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}

/* Brand Section */
.brand-section {
  margin-bottom: clamp(1.5rem, 3vw, 2.5rem);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-icon {
  width: clamp(48px, 8vw, 64px);
  height: clamp(48px, 8vw, 64px);
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  border-radius: clamp(12px, 2vw, 16px);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  box-shadow: 0 15px 35px -8px rgba(99, 102, 241, 0.5);
  flex-shrink: 0;
}

.brand-icon .material-icons-outlined {
  font-size: clamp(24px, 4vw, 32px);
  color: white;
}

.brand-name {
  font-size: clamp(1.25rem, 3vw, 2rem);
  font-weight: 700;
  color: white;
  margin-bottom: 0.25rem;
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.brand-tagline {
  font-size: clamp(0.8rem, 1.5vw, 1rem);
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.3;
}

/* Features Grid */
.features-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(0.5rem, 1vw, 0.875rem);
  margin-bottom: clamp(1rem, 2vw, 1.5rem);
}

.feature-item {
  display: flex;
  align-items: center;
  gap: clamp(0.4rem, 0.8vw, 0.625rem);
  padding: clamp(0.6rem, 1.2vw, 0.875rem) clamp(0.7rem, 1.4vw, 1rem);
  background: rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.25s ease;
  min-width: 0; /* Allow text truncation */
}

.feature-item:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
}

.feature-item .material-icons-outlined,
.feature-item .fab {
  font-size: clamp(18px, 2.5vw, 22px);
  color: #a5b4fc;
  flex-shrink: 0;
}

.feature-item.whatsapp .fab {
  color: #25D366;
}

.feature-item span:last-child {
  font-size: clamp(0.7rem, 1.1vw, 0.875rem);
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Stats Row */
.stats-row {
  display: flex;
  gap: clamp(0.5rem, 1.5vw, 1rem);
  padding: clamp(0.75rem, 1.5vw, 1rem);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.stat {
  flex: 1;
  text-align: center;
  font-size: clamp(0.6rem, 1vw, 0.75rem);
  color: rgba(255, 255, 255, 0.6);
  min-width: 0;
}

.stat strong {
  display: block;
  font-size: clamp(0.9rem, 1.8vw, 1.25rem);
  font-weight: 700;
  color: white;
  margin-bottom: 2px;
}

/* Info Footer */
.info-footer {
  position: absolute;
  bottom: clamp(1rem, 2vw, 1.5rem);
  left: clamp(1.5rem, 4vw, 3rem);
  z-index: 1;
  font-size: clamp(0.7rem, 1vw, 0.8rem);
  color: rgba(255, 255, 255, 0.4);
}

/* ============================================
   RIGHT PANEL - LOGIN FORM
   ============================================ */

.login-form-panel {
  flex: 1;
  min-width: 0; /* Allow shrinking */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1.5rem, 4vw, 3rem);
  background: white;
}

.form-container {
  width: 100%;
  max-width: 380px;
}

.form-header {
  margin-bottom: clamp(1.25rem, 2.5vw, 2rem);
}

.form-header h2 {
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 0.35rem;
}

.form-header p {
  font-size: clamp(0.85rem, 1.2vw, 0.95rem);
  color: #64748b;
}

/* ============================================
   ALERTS
   ============================================ */

.alert-material {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  margin-bottom: 1.25rem;
  font-size: 0.85rem;
  font-weight: 500;
}

.alert-material .material-icons-outlined {
  font-size: 20px;
  flex-shrink: 0;
}

.alert-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
}

.alert-success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #15803d;
}

/* ============================================
   FORM STYLES
   ============================================ */

.material-form {
  margin-bottom: 1.25rem;
}

.form-field {
  margin-bottom: 1.1rem;
}

.input-container {
  position: relative;
}

.input-container.focused .input-icon {
  color: #6366f1;
}

.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 20px;
  pointer-events: none;
  transition: color 0.2s;
  z-index: 1;
}

.material-input {
  width: 100%;
  padding: 0.9rem 2.75rem 0.9rem 46px;
  font-size: 0.95rem;
  font-weight: 500;
  color: #1e293b;
  background: #f1f5f9;
  border: 2px solid transparent;
  border-radius: 12px;
  transition: all 0.2s;
  outline: none;
}

.material-input::placeholder { color: transparent; }

.material-input:focus {
  background: white;
  border-color: #6366f1;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

.material-input:hover:not(:focus) {
  background: #e2e8f0;
}

/* Floating Label */
.floating-label {
  position: absolute;
  left: 46px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.95rem;
  color: #64748b;
  pointer-events: none;
  transition: all 0.15s ease;
  background: transparent;
}

.material-input:focus ~ .floating-label,
.material-input:not(:placeholder-shown) ~ .floating-label {
  top: 0;
  left: 40px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #6366f1;
  background: white;
  padding: 0 6px;
}

.material-input:not(:focus):not(:placeholder-shown) ~ .floating-label {
  color: #475569;
  background: linear-gradient(to bottom, white 50%, #f1f5f9 50%);
}

/* Password Toggle */
.password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  color: #94a3b8;
  transition: all 0.2s;
  z-index: 2;
}

.password-toggle:hover {
  background: #f1f5f9;
  color: #475569;
}

.password-toggle .material-icons-outlined {
  font-size: 20px;
  display: block;
}

/* ============================================
   SUBMIT BUTTON
   ============================================ */

.btn-material-primary {
  width: 100%;
  padding: 0.9rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: white;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.25s;
  box-shadow: 0 6px 20px -4px rgba(99, 102, 241, 0.4);
  margin-top: 1.5rem;
}

.btn-material-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px -6px rgba(99, 102, 241, 0.5);
}

.btn-material-primary:active {
  transform: translateY(0);
}

.btn-material-primary .material-icons-outlined {
  font-size: 20px;
  transition: transform 0.2s;
}

.btn-material-primary:hover .material-icons-outlined {
  transform: translateX(4px);
}

/* Security Info */
.security-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  color: #94a3b8;
  font-size: 0.8rem;
}

.security-info .material-icons-outlined {
  font-size: 16px;
  color: #10b981;
}


/* ============================================
   RESPONSIVE - SWITCH TO MOBILE WHEN CRAMPED
   ============================================ */

/* When viewport is narrow OR zoomed in - switch to stacked layout */
@media (max-width: 900px), (max-width: 1200px) and (min-resolution: 120dpi) {
  .login-wrapper {
    flex-direction: column;
    min-height: 100vh;
    height: auto;
  }
  
  .login-info-panel {
    flex: 0 0 auto;
    padding: 1.5rem;
  }
  
  .floating-messages {
    display: none;
  }
  
  .info-content {
    max-width: 100%;
  }
  
  .brand-section {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.875rem;
    margin-bottom: 1.25rem;
  }
  
  .brand-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 0;
    flex-shrink: 0;
  }
  
  .brand-icon .material-icons-outlined {
    font-size: 24px;
  }
  
  .brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
  }
  
  .brand-name {
    font-size: 1.35rem;
    margin-bottom: 0.125rem;
    line-height: 1.2;
  }
  
  .brand-tagline {
    font-size: 0.8rem;
    line-height: 1.3;
  }
  
  .features-grid {
    gap: 0.5rem;
    margin-bottom: 1rem;
  }
  
  .feature-item {
    padding: 0.65rem 0.75rem;
    gap: 0.5rem;
  }
  
  .feature-item .material-icons-outlined,
  .feature-item .fab {
    font-size: 18px;
  }
  
  .feature-item span:last-child {
    font-size: 0.75rem;
  }
  
  .stats-row {
    padding: 0.75rem;
    gap: 0.5rem;
  }
  
  .stat strong {
    font-size: 1rem;
  }
  
  .stat {
    font-size: 0.65rem;
  }
  
  .info-footer {
    display: none;
  }
  
  .login-form-panel {
    flex: 1;
    padding: 1.5rem;
    align-items: flex-start;
  }
  
  .form-container {
    max-width: 100%;
  }
  
  .form-header {
    margin-bottom: 1.25rem;
  }
  
  .form-header h2 {
    font-size: 1.4rem;
  }
  
  .form-header p {
    font-size: 0.9rem;
  }
}

/* Small mobile */
@media (max-width: 480px) {
  .login-info-panel {
    padding: 1.25rem 1rem;
  }
  
  .brand-section {
    gap: 0.75rem;
    margin-bottom: 1rem;
  }
  
  .brand-icon {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
  }
  
  .brand-icon .material-icons-outlined {
    font-size: 22px;
  }
  
  .brand-text {
    min-width: 0;
    flex: 1;
  }
  
  .brand-name {
    font-size: 1.2rem;
    line-height: 1.2;
    margin-bottom: 0.125rem;
  }
  
  .brand-tagline {
    font-size: 0.75rem;
    line-height: 1.3;
  }
  
  .features-grid {
    gap: 0.4rem;
  }
  
  .feature-item {
    padding: 0.55rem 0.65rem;
    border-radius: 8px;
  }
  
  .feature-item .material-icons-outlined,
  .feature-item .fab {
    font-size: 16px;
  }
  
  .feature-item span:last-child {
    font-size: 0.7rem;
  }
  
  .stats-row {
    padding: 0.625rem;
  }
  
  .stat strong {
    font-size: 0.9rem;
  }
  
  .stat {
    font-size: 0.6rem;
  }
  
  .login-form-panel {
    padding: 1.25rem 1rem;
  }
  
  .form-header h2 {
    font-size: 1.25rem;
  }
  
  .form-header p {
    font-size: 0.85rem;
  }
  
  .material-input {
    padding: 0.8rem 2.5rem 0.8rem 42px;
    font-size: 0.9rem;
  }
  
  .input-icon {
    left: 12px;
    font-size: 18px;
  }
  
  .floating-label {
    left: 42px;
    font-size: 0.9rem;
  }
  
  .material-input:focus ~ .floating-label,
  .material-input:not(:placeholder-shown) ~ .floating-label {
    left: 36px;
    font-size: 0.68rem;
  }
  
  .btn-material-primary {
    padding: 0.8rem 1rem;
    font-size: 0.9rem;
    margin-top: 1.25rem;
  }
  
  .security-info {
    font-size: 0.75rem;
  }
}

/* Landscape phones - keep side by side but compact */
@media (max-height: 500px) and (orientation: landscape) {
  .login-wrapper {
    flex-direction: row;
    height: 100vh;
    overflow: hidden;
  }
  
  .login-info-panel {
    flex: 0 0 40%;
    padding: 1rem;
    overflow-y: auto;
  }
  
  .brand-section {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
  }
  
  .brand-icon {
    width: 36px;
    height: 36px;
    margin-bottom: 0;
    flex-shrink: 0;
  }
  
  .brand-icon .material-icons-outlined {
    font-size: 18px;
  }
  
  .brand-text {
    min-width: 0;
    flex: 1;
  }
  
  .brand-name {
    font-size: 1rem;
    line-height: 1.2;
    margin-bottom: 0.125rem;
  }
  
  .brand-tagline {
    font-size: 0.7rem;
    line-height: 1.3;
  }
  
  .features-grid {
    gap: 0.35rem;
    margin-bottom: 0.5rem;
  }
  
  .feature-item {
    padding: 0.4rem 0.5rem;
  }
  
  .feature-item .material-icons-outlined,
  .feature-item .fab {
    font-size: 14px;
  }
  
  .feature-item span:last-child {
    font-size: 0.65rem;
  }
  
  .stats-row {
    display: none;
  }
  
  .login-form-panel {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
  }
  
  .form-header {
    margin-bottom: 0.75rem;
  }
  
  .form-header h2 {
    font-size: 1.1rem;
  }
  
  .form-header p {
    font-size: 0.8rem;
  }
  
  .form-field {
    margin-bottom: 0.75rem;
  }
  
  .material-input {
    padding: 0.65rem 2.25rem 0.65rem 38px;
    font-size: 0.85rem;
  }
  
  .input-icon {
    font-size: 16px;
    left: 10px;
  }
  
  .floating-label {
    left: 38px;
    font-size: 0.85rem;
  }
  
  .material-input:focus ~ .floating-label,
  .material-input:not(:placeholder-shown) ~ .floating-label {
    left: 32px;
    font-size: 0.65rem;
  }
  
  .btn-material-primary {
    padding: 0.6rem 0.875rem;
    font-size: 0.85rem;
    margin-top: 0.875rem;
  }
  
  .security-info {
    font-size: 0.7rem;
    padding-top: 0.5rem;
  }
}

/* ============================================
   CONTAINER QUERY FALLBACK - WIDTH BASED
   ============================================ */

/* Force mobile layout when wrapper is too narrow */
@container (max-width: 700px) {
  .login-wrapper {
    flex-direction: column;
  }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

.material-input:focus-visible,
.btn-material-primary:focus-visible,
.password-toggle:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

/* High contrast mode */
@media (prefers-contrast: high) {
  .material-input {
    border: 2px solid #475569;
  }
  
  .feature-item {
    border: 1px solid rgba(255, 255, 255, 0.3);
  }
}
