/* ======================================
   DP5 ERP Dashboard - Login Page Styles
   Login, Forgot Password, Reset Password
   ====================================== */

/* Login Container - Full screen centered layout */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--bg-main);
  position: relative;
}

/* Theme Toggle - Top right corner */
.login-theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 100;
}

.login-theme-toggle:hover {
  background: var(--bg-main);
  transform: scale(1.05);
}

/* Login Card - Main form container */
.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 450px;
  padding: 40px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Brand Section - Logo and title */
.login-brand {
  text-align: center;
  margin-bottom: 40px;
}

.login-logo {
  /* Increased width to accommodate "DP5 | CloudPOS" text */
  width: auto;
  min-width: 180px;
  height: 60px;
  background: var(--primary);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: white;
  margin: 0 auto 16px;
  padding: 0 20px;
}

.login-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 8px;
}

.login-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
}

/* Form Container - Handles form transitions */
.login-forms {
  position: relative;
  min-height: 300px;
}

.login-form {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.login-form.active {
  opacity: 1;
  visibility: visible;
  position: relative;
}

/* Form Elements - Override defaults for login */
.login-form .form-group {
  margin-bottom: 20px;
}

.login-form .form-control {
  padding: 12px 14px;
  font-size: 15px;
}

.login-form .form-control:-webkit-autofill,
.login-form .form-control:-webkit-autofill:hover,
.login-form .form-control:-webkit-autofill:focus,
.login-form .form-control:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 30px var(--bg-card) inset !important;
  -webkit-text-fill-color: var(--text-main) !important;
  transition: background-color 5000s ease-in-out 0s;
}

.login-form .form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.1);
}

/* Password Input Group - For show/hide toggle */
.password-input-group {
  position: relative;
}

.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: var(--text-secondary);
  padding: 4px;
  transition: color 0.2s ease;
}

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

/* Company Code Input Group - For DP5- prefix */
.company-code-input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.company-code-prefix {
  position: absolute;
  left: 14px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  pointer-events: none;
  z-index: 1;
}

.company-code-input {
  padding-left: 52px !important;
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* Remember Me Checkbox */
.login-remember {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.login-remember .checkbox {
  margin-bottom: 0;
}

/* Forgot Password Link */
.login-link {
  color: var(--primary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.2s ease;
}

.login-link:hover {
  color: var(--primary-dark);
  /* Removed underline on hover */
}

/* Submit Button - Full width */
.login-submit {
  width: 100%;
  padding: 14px;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 20px;
}

/* Back Link - Return to login */
/* Converted back link to button style */
.login-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-main);
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 24px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.login-back-btn:hover {
  background: var(--bg-card);
  border-color: var(--primary);
  color: var(--primary);
}

/* Password Strength Indicator */
.password-strength {
  margin-top: 8px;
  margin-bottom: 16px;
}

.password-strength-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.password-strength-text {
  font-weight: 600;
}

.password-strength-text.weak {
  color: var(--danger);
}

.password-strength-text.medium {
  color: var(--warning);
}

.password-strength-text.strong {
  color: var(--success);
}

.password-strength-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.password-strength-fill {
  height: 100%;
  width: 0%;
  transition: width 0.3s ease, background 0.3s ease;
  border-radius: 3px;
}

.password-strength-fill.weak {
  width: 33%;
  background: var(--danger);
}

.password-strength-fill.medium {
  width: 66%;
  background: var(--warning);
}

.password-strength-fill.strong {
  width: 100%;
  background: var(--success);
}

/* Password Requirements */
.password-requirements {
  margin-top: 12px;
  padding: 12px;
  background: var(--bg-main);
  border-radius: var(--radius);
  font-size: 12px;
}

.password-requirement {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

.password-requirement:last-child {
  margin-bottom: 0;
}

.password-requirement-icon {
  font-size: 14px;
}

/* Divider with text */
.login-divider {
  display: flex;
  align-items: center;
  gap: 15px;
  margin: 24px 0;
}

.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.login-divider span {
  color: var(--text-secondary);
  font-size: 13px;
}

/* Color Scheme Selector - Footer */
.login-footer {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.login-footer-title {
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.login-color-schemes {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.login-color-scheme {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s ease;
  position: relative;
}

.login-color-scheme:hover {
  transform: scale(1.1);
}

.login-color-scheme.active {
  border-color: var(--text-main);
  box-shadow: 0 0 0 2px var(--bg-card);
}

.login-color-scheme.active::after {
  content: "✓";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 18px;
  font-weight: 700;
}

.login-color-scheme[data-scheme="sky"] {
  background: linear-gradient(135deg, #0284c7 0%, #38bdf8 100%);
}

.login-color-scheme[data-scheme="desert"] {
  background: linear-gradient(135deg, #ea580c 0%, #fb923c 100%);
}

.login-color-scheme[data-scheme="grass"] {
  background: linear-gradient(135deg, #16a34a 0%, #4ade80 100%);
}

.login-color-scheme[data-scheme="space"] {
  background: linear-gradient(135deg, #7c3aed 0%, #a78bfa 100%);
}

/* Loading State */
.login-submit.loading {
  position: relative;
  color: transparent;
  pointer-events: none;
}

.login-submit.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* Success Message */
.login-success {
  text-align: center;
  padding: 20px;
}

.login-success-icon {
  width: 60px;
  height: 60px;
  background: var(--success);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: white;
  margin: 0 auto 16px;
}

.login-success-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 8px;
}

.login-success-message {
  font-size: 14px;
  color: var(--text-secondary);
}

/* Responsive Design */
@media (max-width: 768px) {
  .login-card {
    padding: 30px 24px;
  }

  .login-brand {
    margin-bottom: 32px;
  }

  .login-logo {
    /* Adjusted responsive sizing for longer text */
    min-width: 160px;
    height: 50px;
    font-size: 16px;
    padding: 0 16px;
  }

  .login-title {
    font-size: 20px;
  }

  .login-theme-toggle {
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    font-size: 18px;
  }

  .login-footer {
    margin-top: 32px;
    padding-top: 20px;
  }

  .login-color-scheme {
    width: 36px;
    height: 36px;
  }
}

/* Animation */
@keyframes spin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

/* Hide create account button and color scheme selector by default */
.login-create-account,
.login-footer {
  display: none;
}

/* Show elements when dev mode is active */
.login-dev-mode .login-create-account,
.login-dev-mode .login-footer {
  display: block;
}

/* Debug Console - Fixed position at bottom */
.login-debug-console {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-top: 2px solid var(--border);
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  max-height: 60vh;
  display: flex;
  flex-direction: column;
}

.login-debug-console.hidden {
  display: none;
}

.login-debug-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--bg-main);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
}

.login-debug-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}

.login-debug-icon {
  font-size: 16px;
}

.login-debug-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  color: var(--text-secondary);
  transition: transform 0.3s ease;
}

.login-debug-toggle-icon {
  display: inline-block;
  transition: transform 0.3s ease;
}

.login-debug-console.collapsed .login-debug-toggle-icon {
  transform: rotate(-90deg);
}

.login-debug-content {
  overflow-y: auto;
  padding: 20px;
  max-height: calc(60vh - 50px);
  transition: max-height 0.3s ease;
}

.login-debug-console.collapsed .login-debug-content {
  max-height: 0;
  padding: 0 20px;
  overflow: hidden;
}

.login-debug-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
  font-size: 14px;
}

/* Debug Steps */
.login-debug-steps {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-debug-step {
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: all 0.2s ease;
}

.login-debug-step-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.login-debug-step-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}

.login-debug-step-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.login-debug-step-status.success {
  background: rgba(34, 197, 94, 0.1);
  color: var(--success);
}

.login-debug-step-status.error {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

.login-debug-step-status.warning {
  background: rgba(251, 146, 60, 0.1);
  color: var(--warning);
}

.login-debug-step-status.attempting {
  background: rgba(59, 130, 246, 0.1);
  color: var(--primary);
}

.login-debug-step-message {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.login-debug-step-data {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  font-family: "Courier New", monospace;
  font-size: 12px;
  overflow-x: auto;
}

.login-debug-step-data-row {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
  line-height: 1.6;
}

.login-debug-step-data-row:last-child {
  margin-bottom: 0;
}

.login-debug-step-data-key {
  color: var(--primary);
  font-weight: 600;
  min-width: 140px;
}

.login-debug-step-data-value {
  color: var(--text-main);
  word-break: break-all;
}

.login-debug-step-timestamp {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 8px;
  font-style: italic;
}

/* Debug Summary */
.login-debug-summary {
  background: var(--bg-main);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}

.login-debug-summary-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.login-debug-summary-message {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.login-debug-summary.success {
  border-color: var(--success);
  background: rgba(34, 197, 94, 0.05);
}

.login-debug-summary.success .login-debug-summary-title {
  color: var(--success);
}

.login-debug-summary.error {
  border-color: var(--danger);
  background: rgba(239, 68, 68, 0.05);
}

.login-debug-summary.error .login-debug-summary-title {
  color: var(--danger);
}

/* Debug Password Modal */
.debug-password-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
}

.debug-password-modal.active {
  display: flex;
}

.debug-password-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.debug-password-content {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 90%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.debug-password-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

.debug-password-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-main);
  margin: 0;
}

.debug-password-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  transition: all 0.2s ease;
}

.debug-password-close:hover {
  background: var(--bg-main);
  color: var(--text-main);
}

.debug-password-body {
  padding: 20px;
}

.debug-password-description {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.5;
}

.debug-password-error {
  margin-top: 12px;
  padding: 10px 12px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  color: var(--danger);
  font-size: 13px;
  display: none;
}

.debug-password-error.active {
  display: block;
}

.debug-password-footer {
  display: flex;
  gap: 12px;
  padding: 20px;
  border-top: 1px solid var(--border);
  justify-content: flex-end;
}

.debug-password-footer .btn {
  min-width: 100px;
}

/* Responsive Debug Password Modal */
@media (max-width: 768px) {
  .debug-password-content {
    width: 95%;
  }

  .debug-password-header,
  .debug-password-body,
  .debug-password-footer {
    padding: 16px;
  }

  .debug-password-footer {
    flex-direction: column;
  }

  .debug-password-footer .btn {
    width: 100%;
  }
}

/* User Information Display Styles */
.login-debug-user-info {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 12px;
}

.login-debug-user-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.login-debug-user-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  color: white;
  overflow: hidden;
}

.login-debug-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.login-debug-user-details {
  flex: 1;
}

.login-debug-user-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.login-debug-user-email {
  font-size: 14px;
  color: var(--text-secondary);
}

.login-debug-user-data {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-debug-user-data-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
}

.login-debug-user-data-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.login-debug-user-data-value {
  font-size: 14px;
  color: var(--text-main);
  font-weight: 600;
}

/* License Information Display Styles */
.login-debug-license-info {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 12px;
}

.login-debug-license-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.login-debug-license-icon {
  font-size: 32px;
}

.login-debug-license-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}

.login-debug-license-data {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-debug-license-data-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
}

.login-debug-license-data-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.login-debug-license-data-value {
  font-size: 14px;
  color: var(--text-main);
  font-weight: 600;
}

.login-debug-license-data-value.license-key {
  font-family: "Courier New", monospace;
  font-size: 12px;
  background: var(--bg-main);
  padding: 4px 8px;
  border-radius: 4px;
}

.login-debug-license-type-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  background: rgba(2, 132, 199, 0.1);
  color: var(--primary);
}

/* Status Badge Styles */
.login-debug-status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.login-debug-status-badge.active {
  background: rgba(34, 197, 94, 0.1);
  color: var(--success);
}

.login-debug-status-badge.inactive {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

/* Responsive Debug Console */
@media (max-width: 768px) {
  .login-debug-console {
    max-height: 50vh;
  }

  .login-debug-content {
    padding: 16px;
    max-height: calc(50vh - 50px);
  }

  .login-debug-step {
    padding: 12px;
  }

  .login-debug-step-data-key {
    min-width: 100px;
  }

  .login-debug-summary {
    padding: 16px;
  }

  /* Responsive user and license info */
  .login-debug-user-header {
    flex-direction: column;
    text-align: center;
  }

  .login-debug-user-data-row,
  .login-debug-license-data-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
}
