:root {
  --bg-dark: #05070c;
  --light-color: rgba(255, 214, 133, 0.85);
  --light-cone: linear-gradient(to bottom, rgba(255, 214, 133, 0.45) 0%, rgba(255, 214, 133, 0.03) 100%);
  --light-floor: radial-gradient(ellipse at center, rgba(255, 214, 133, 0.15) 0%, rgba(255, 214, 133, 0) 70%);
  
  --glass-bg: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-highlight: rgba(255, 255, 255, 0.15);
  
  --text-main: #ffffff;
  --text-muted: #8b95a5;
  --text-dark: #1a1e27;
  
  --primary-blue: #2563EB;
  --primary-glow: rgba(37, 99, 235, 0.5);
  --gradient-blue: linear-gradient(135deg, #3B82F6 0%, #1D4ED8 100%);
  
  --error-color: #ef4444;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
  overflow: hidden; /* prevent scrolling for cinematic view */
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* =========================================
   CINEMATIC BACKGROUND
========================================= */
.bg-elements {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.abstract-shape {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.15;
  transition: opacity 2s ease;
}

body.lamp-on .abstract-shape {
  opacity: 0.05; /* dim background when lamp is on to focus on card */
}

.shape-1 {
  width: 40vw; height: 40vw;
  background: #1d4ed8;
  top: -10vw; left: -10vw;
}

.shape-2 {
  width: 30vw; height: 30vw;
  background: #8b5cf6;
  bottom: -5vw; right: -5vw;
}

.blurred-chart {
  position: absolute;
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 12px;
  background: rgba(255,255,255,0.02);
  backdrop-filter: blur(5px);
  opacity: 0.3;
  transition: all 1s ease;
}

.chart-1 {
  width: 300px; height: 200px;
  top: 20%; left: 10%;
  transform: perspective(600px) rotateY(15deg) rotateX(5deg);
}

.chart-2 {
  width: 250px; height: 180px;
  bottom: 20%; right: 15%;
  transform: perspective(600px) rotateY(-20deg) rotateX(-5deg);
}

body.lamp-on .blurred-chart {
  opacity: 0.1;
  filter: blur(10px);
}

/* =========================================
   TOP & BOTTOM WIDGETS
========================================= */
.top-right-widget, .bottom-left, .bottom-center, .bottom-right {
  position: absolute;
  z-index: 10;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.5px;
  transition: opacity 1s ease;
}

.top-right-widget {
  top: 30px;
  right: 40px;
  text-align: right;
}

#live-time {
  font-size: 24px;
  font-weight: 300;
  color: var(--text-main);
  margin-top: 4px;
}

.bottom-left {
  bottom: 30px;
  left: 40px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bottom-left span {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bottom-center {
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  line-height: 1.6;
}

.bottom-right {
  bottom: 30px;
  right: 40px;
}

.bottom-right strong {
  color: var(--text-main);
  font-weight: 600;
}

/* =========================================
   LAMP ANIMATION & EFFECTS
========================================= */
.lamp-wrapper {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform-origin: top center;
  animation: lampSwing 8s ease-in-out infinite alternate;
}

@keyframes lampSwing {
  0% { transform: translateX(-50%) rotate(-2deg); }
  100% { transform: translateX(-50%) rotate(2deg); }
}

.lamp-wire {
  width: 4px;
  height: 120px;
  background: #111;
  border-left: 1px solid #333;
}

.lamp-body {
  width: 80px;
  height: 60px;
  background: linear-gradient(to bottom, #222, #0a0a0a);
  border-radius: 40px 40px 10px 10px;
  position: relative;
  box-shadow: inset 0 -4px 10px rgba(0,0,0,0.8);
  border: 1px solid #333;
  border-bottom: 2px solid var(--light-color);
  z-index: 2;
  transition: box-shadow 0.3s;
}

body.lamp-on .lamp-body {
  box-shadow: inset 0 -4px 10px rgba(0,0,0,0.8), 0 10px 30px rgba(255, 214, 133, 0.4);
}

.lamp-switch {
  position: absolute;
  bottom: -40px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 60px;
  cursor: pointer;
  z-index: 3;
}

.pull-string {
  width: 2px;
  height: 40px;
  background: #444;
  margin: 0 auto;
  transition: height 0.1s;
}

.pull-knob {
  width: 12px;
  height: 12px;
  background: #888;
  border-radius: 50%;
  margin: 0 auto;
  transition: transform 0.1s, background 0.3s;
}

.lamp-switch:hover .pull-knob {
  background: #aaa;
}

.lamp-switch:active .pull-string {
  height: 60px;
}
.lamp-switch:active .pull-knob {
  transform: translateY(20px);
}

/* The Light Beam */
.light-cone {
  position: absolute;
  top: 178px; /* below lamp body */
  width: 900px;
  height: 80vh;
  background: var(--light-cone);
  clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.8s ease-in-out, transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
  transform: scaleY(0);
  transform-origin: top center;
  z-index: 1;
  display: flex;
  justify-content: center;
  overflow: hidden;
}

body.lamp-on .light-cone {
  opacity: 1;
  transform: scaleY(1);
}

/* Floating dust particles in light */
.dust-particle {
  position: absolute;
  background: #fff;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
}

@keyframes floatDust {
  0% { transform: translateY(0) translateX(0); opacity: 0; }
  20% { opacity: 0.6; }
  80% { opacity: 0.6; }
  100% { transform: translateY(-200px) translateX(50px); opacity: 0; }
}

/* Floor reflection */
.floor-reflection {
  position: absolute;
  bottom: -100px;
  left: 50%;
  transform: translateX(-50%) rotateX(70deg);
  width: 800px;
  height: 800px;
  background: var(--light-floor);
  opacity: 0;
  transition: opacity 1.2s ease-in-out;
  pointer-events: none;
  z-index: 0;
}

body.lamp-on .floor-reflection {
  opacity: 1;
}

/* Instruction Text */
.instruction-text {
  position: absolute;
  top: 160px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.4);
  font-size: 14px;
  letter-spacing: 1px;
  pointer-events: none;
  transition: opacity 0.5s;
  z-index: 10;
}

body.lamp-on .instruction-text {
  opacity: 0;
}

/* =========================================
   LOGIN CARD
========================================= */
.login-card-wrapper {
  position: relative;
  z-index: 30;
  margin-top: 100px;
  width: 100%;
  max-width: 440px;
  opacity: 0;
  transform: translateY(40px) scale(0.95);
  transition: all 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  perspective: 1000px;
}

body.lamp-on .login-card-wrapper {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  transition-delay: 0.3s;
}

.glass-login-card {
  background: var(--glass-bg);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 48px 40px;
  box-shadow: 0 30px 60px rgba(0,0,0,0.4), inset 0 1px 0 var(--glass-highlight);
  position: relative;
  overflow: hidden;
}

/* Brand Header */
.brand-header {
  text-align: center;
  margin-bottom: 40px;
}

.logo-circle {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0));
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  font-size: 32px;
  color: var(--text-main);
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.brand-header h1 {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.brand-header h2 {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 4px;
}

.brand-header h3 {
  font-size: 13px;
  font-weight: 400;
  color: var(--primary-blue);
  letter-spacing: 0.5px;
}

/* Form Styles */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.input-group, .form-actions, .btn-signin {
  opacity: 0;
  transform: translateY(15px);
  transition: all 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

body.lamp-on .input-group,
body.lamp-on .form-actions,
body.lamp-on .btn-signin {
  opacity: 1;
  transform: translateY(0);
}

body.lamp-on .input-group:nth-child(1) { transition-delay: 0.5s; }
body.lamp-on .input-group:nth-child(2) { transition-delay: 0.6s; }
body.lamp-on .form-actions { transition-delay: 0.7s; }
body.lamp-on .btn-signin { transition-delay: 0.8s; }

.input-group {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 16px;
  top: 16px;
  font-size: 20px;
  color: var(--text-muted);
  transition: color 0.3s;
}

.eye-toggle {
  position: absolute;
  right: 16px;
  top: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  transition: color 0.3s;
}

.eye-toggle:hover {
  color: var(--text-main);
}

.input-group input {
  width: 100%;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 16px 48px;
  color: var(--text-main);
  font-size: 15px;
  font-family: inherit;
  transition: all 0.3s;
}

.input-group input:focus {
  outline: none;
  border-color: var(--primary-blue);
  background: rgba(0, 0, 0, 0.4);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

.input-group input:focus + .input-icon,
.input-group input:not(:placeholder-shown) + .input-icon {
  color: var(--primary-blue);
}

.input-group input::placeholder {
  color: rgba(255,255,255,0.3);
}

.validation-msg {
  color: var(--error-color);
  font-size: 12px;
  margin-top: 6px;
  padding-left: 4px;
  opacity: 0;
  height: 0;
  overflow: hidden;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  gap: 4px;
}
.validation-msg.show {
  opacity: 1;
  height: 18px;
}
.validation-msg::before {
  content: "⚠";
}

.input-error {
  border-color: var(--error-color) !important;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.15) !important;
}

.form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  margin-top: 4px;
  margin-bottom: 10px;
}

.remember-me {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--text-muted);
  transition: color 0.3s;
}

.remember-me:hover {
  color: var(--text-main);
}

.remember-me input {
  appearance: none;
  width: 16px;
  height: 16px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 4px;
  background: rgba(0,0,0,0.2);
  cursor: pointer;
  position: relative;
  transition: all 0.2s;
}

.remember-me input:checked {
  background: var(--primary-blue);
  border-color: var(--primary-blue);
}

.remember-me input:checked::after {
  content: '✓';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 10px;
  color: white;
}

.forgot-pwd {
  color: var(--primary-blue);
  text-decoration: none;
  font-weight: 500;
  transition: text-shadow 0.3s;
}

.forgot-pwd:hover {
  text-shadow: 0 0 8px var(--primary-glow);
}

/* Button */
.btn-signin {
  width: 100%;
  padding: 16px;
  background: var(--gradient-blue);
  border: none;
  border-radius: 12px;
  color: white;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 25px var(--primary-glow);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  justify-content: center;
  align-items: center;
}

.btn-signin::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;
}

.btn-signin:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 35px var(--primary-glow);
}

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

.btn-signin:active {
  transform: translateY(1px);
}

/* Loading State */
.btn-signin.loading .btn-text {
  opacity: 0;
}

.spinner {
  position: absolute;
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  opacity: 0;
  visibility: hidden;
}

.btn-signin.loading .spinner {
  opacity: 1;
  visibility: visible;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.server-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 20px;
  text-align: center;
  backdrop-filter: blur(10px);
}

/* =========================================
   RESPONSIVE
========================================= */
@media (max-width: 768px) {
  .top-right-widget, .bottom-left, .bottom-right {
    display: none;
  }
  .bottom-center {
    bottom: 20px;
    font-size: 12px;
  }
  .login-card-wrapper {
    padding: 0 20px;
  }
  .glass-login-card {
    padding: 40px 24px;
  }
  .lamp-wrapper {
    transform: translateX(-50%) scale(0.8);
  }
  .light-cone {
    width: 600px;
  }
}
