/* ======================== */
/* LOGIN PAGE - MODERN STYLE */
/* ======================== */

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

/* ========================
   DARK MODE (Default)
   ======================== */
:root {
  --login-bg: #0a0d14;
  --login-box-bg: rgba(15, 23, 42, 0.5);
  --login-box-border: rgba(34, 197, 94, 0.2);
  --login-box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6);
  --login-input-bg: rgba(15, 23, 42, 0.6);
  --login-input-border: rgba(148, 163, 184, 0.3);
  --accent: #22c55e;
  --accent-strong: #16a34a;
  --text-main: #e5e7eb;
  --text-soft: #94a3b8;
  --danger: #f97373;
}

/* ========================
   LIGHT MODE
   ======================== */
[data-theme="light"] {
  --login-bg: #f0fdf4;
  --login-box-bg: rgba(255, 255, 255, 0.98);
  --login-box-border: rgba(22, 163, 74, 0.3);
  --login-box-shadow: 0 25px 50px rgba(22, 163, 74, 0.15);
  --login-input-bg: #f0fdf4;
  --login-input-border: rgba(22, 163, 74, 0.3);
  --accent: #16a34a;
  --accent-strong: #15803d;
  --text-main: #0f172a;
  --text-soft: #166534;
  --danger: #dc2626;
}

html, body {
  width: 100%;
  height: 100vh;
  margin: 0;
  padding: 0;
  background: var(--login-bg);
  background-attachment: fixed;
  transition: background 0.3s ease;
}

body.login-body {
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", sans-serif;
  color: var(--text-main);
}

.login-wrapper {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: var(--login-bg);
  transition: background 0.3s ease;
}

/* Removed - not needed */
.login-bg-decoration {
  display: none;
}

.login-center {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 480px;
  display: flex;
  justify-content: center;
  animation: slideInUp 0.6s ease-out;
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-box {
  width: 100%;
  background: var(--login-box-bg);
  border-radius: 20px;
  border: 1px solid var(--login-box-border);
  padding: 2.5rem 2rem;
  box-shadow: var(--login-box-shadow);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  position: relative;
  transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
  overflow: hidden;
}

.login-box-header {
  text-align: center;
  margin-bottom: 2rem;
  position: relative;
  z-index: 2;
}

.login-title {
  font-size: clamp(1.5rem, 5vw, 1.8rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.4rem;
  color: var(--text-main);
}

[data-theme="light"] .login-title {
  color: var(--accent);
}

.login-subtitle {
  font-size: 0.95rem;
  color: var(--text-soft);
  margin: 0;
  letter-spacing: 0.02em;
  font-weight: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.login-box-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  position: relative;
  z-index: 2;
}

.login-input-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.login-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: 0.01em;
}

.login-input {
  width: 100%;
  padding: 0.7rem 0.9rem;
  padding-right: 2.5rem;
  border-radius: 10px;
  border: 1px solid var(--login-input-border);
  background: var(--login-input-bg);
  color: var(--text-main);
  font-size: 0.95rem;
  transition: all 0.3s ease;
  font-family: inherit;
  font-weight: 400;
  backdrop-filter: blur(10px);
}

.password-toggle {
  position: absolute;
  right: 0.75rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-soft);
  transition: all 0.2s ease;
  font-size: 1.1rem;
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
}

.password-toggle:hover {
  color: var(--accent);
  background: rgba(34, 197, 94, 0.1);
}

.password-toggle:active {
  transform: scale(0.95);
}

.login-input::placeholder {
  color: var(--text-soft);
  opacity: 0.7;
}

.login-input:hover {
  border-color: rgba(34, 197, 94, 0.3);
}

.login-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
}

/* Disable autofill background color */
.login-input:-webkit-autofill,
.login-input:-webkit-autofill:hover,
.login-input:-webkit-autofill:focus,
.login-input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 30px var(--login-input-bg) inset !important;
  box-shadow: 0 0 0 30px var(--login-input-bg) inset !important;
  -webkit-text-fill-color: var(--text-main) !important;
  caret-color: var(--text-main) !important;
}

.login-input:-webkit-autofill {
  -webkit-text-fill-color: var(--text-main) !important;
}

.login-btn-submit {
  width: 100%;
  padding: 0.75rem 1.25rem;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 10px 30px rgba(34, 197, 94, 0.3);
  margin-top: 1rem;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  position: relative;
  overflow: hidden;
}

.login-btn-submit:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 15px 40px rgba(34, 197, 94, 0.4);
}

.login-btn-submit:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 5px 15px rgba(34, 197, 94, 0.2);
}

.login-btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

.login-message {
  margin-bottom: 1rem;
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  font-size: 0.9rem;
  min-height: 1.2rem;
  line-height: 1.5;
  text-align: center;
  background: transparent;
  color: var(--text-soft);
  transition: all 0.3s ease;
  position: relative;
  z-index: 2;
}
  border: none;
  font-weight: 400;
}

.login-message.error {
  background: transparent;
  border: none;
  color: var(--danger);
  font-weight: 500;
}

.login-message.success {
  background: transparent;
  border: none;
  color: var(--accent);
  font-weight: 500;
}

.login-message.info {
  background: transparent;
  border: none;
  color: var(--accent-strong);
}

.login-box-footer {
  text-align: center;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(34, 197, 94, 0.15);
  position: relative;
  z-index: 2;
}

.login-box-footer p {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  color: var(--text-soft);
  line-height: 1.6;
}

.login-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
  padding: 0;
  border-radius: 6px;
  margin: 0;
  position: relative;
  z-index: 2;
  border: none;
  background: transparent;
}

.login-back-link:hover {
  color: var(--accent-strong);
  opacity: 0.85;
}

.login-back-link i {
  font-size: 0.9rem;
}

/* Responsive Design */
@media (max-width: 768px) {
  .login-wrapper {
    padding: 1.25rem;
  }

  .login-center {
    max-width: 100%;
  }

  .login-box {
    padding: 2rem 1.5rem;
    border-radius: 18px;
  }

  .login-title {
    font-size: 1.5rem;
  }

  .login-box-form {
    gap: 1.25rem;
  }

  .login-label {
    font-size: 0.9rem;
  }

  .login-input {
    padding: 0.65rem 0.85rem;
    font-size: 0.9rem;
  }
}

@media (max-width: 640px) {
  .login-wrapper {
    padding: 1rem;
  }

  .login-center {
    max-width: 100%;
  }

  .login-box {
    padding: 1.75rem 1.25rem;
    border-radius: 16px;
    gap: 0.75rem;
  }

  .login-title {
    font-size: 1.4rem;
    margin-bottom: 0.3rem;
  }

  .login-subtitle {
    font-size: 0.88rem;
  }

  .login-box-header {
    margin-bottom: 1.75rem;
  }

  .login-box-form {
    gap: 1.15rem;
    margin-bottom: 1.25rem;
  }

  .login-label {
    font-size: 0.85rem;
  }

  .login-input {
    padding: 0.6rem 0.8rem;
    padding-right: 2.3rem;
    font-size: 0.9rem;
    border-radius: 9px;
  }

  .password-toggle {
    right: 0.6rem;
    width: 1.8rem;
    height: 1.8rem;
    font-size: 0.95rem;
  }

  .login-btn-submit {
    padding: 0.65rem 1rem;
    font-size: 0.9rem;
    margin-top: 0.8rem;
  }

  .login-message {
    font-size: 0.85rem;
    padding: 0.6rem 0.8rem;
  }

  .login-box-footer {
    padding-top: 1rem;
  }

  .login-box-footer p {
    font-size: 0.8rem;
  }

  .login-back-link {
    font-size: 0.85rem;
  }
}

@media (max-width: 480px) {
  .login-wrapper {
    padding: 0.75rem;
  }

  .login-box {
    padding: 1.5rem 1rem;
  }

  .login-title {
    font-size: 1.25rem;
  }

  .login-subtitle {
    font-size: 0.8rem;
  }

  .login-input {
    padding: 0.55rem 0.75rem;
    font-size: 0.85rem;
  }

  .login-btn-submit {
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
  }
}

/* Print styles */
@media print {
  body.login-body {
    background: white;
  }

  .login-bg-decoration {
    display: none;
  }

  .login-box {
    box-shadow: none;
    border: 1px solid #ccc;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

  .login-btn-submit {
    padding: 0.55rem 1.15rem;
    font-size: 0.9rem;
  }

  .login-box-footer p {
    font-size: 0.8rem;
  }
}

/* ========================
   FLOATING THEME TOGGLE
   ======================== */
.theme-toggle-float {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--login-input-border);
  background: var(--login-box-bg);
  cursor: pointer;
  transition: all 0.3s ease;
  color: var(--text-main);
  font-size: 1.3rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.theme-toggle-float:hover {
  background: rgba(34, 197, 94, 0.1);
  border-color: var(--accent);
  transform: scale(1.05);
}

/* Dark mode: show sun icon */
.theme-toggle-float .icon-sun {
  display: inline;
}
.theme-toggle-float .icon-moon {
  display: none;
}

/* Light mode: show moon icon */
[data-theme="light"] .theme-toggle-float .icon-sun {
  display: none;
}
[data-theme="light"] .theme-toggle-float .icon-moon {
  display: inline;
}
