/**
 * PandaDunDun Auth Theme - Split Layout Design
 * Based on MCenter Purple Design System
 *
 * Layout: Left brand panel + Right form panel
 * Primary Color: #821ffc (Violet Purple)
 */

/* ============================================
   1. CSS Variables (Inherit from MCenter)
   ============================================ */
:root {
  /* Primary Colors - Purple Spectrum */
  --auth-primary: #821ffc;
  --auth-primary-light: #A666FF;
  --auth-primary-lighter: #C9A7FF;
  --auth-primary-dark: #6B1AD9;
  --auth-primary-darker: #4C13A8;
  --auth-primary-bg: #FDF4FF;
  --auth-primary-bg-subtle: #F8F0FF;

  /* Accent Colors - Gold */
  --auth-accent: #CA8A04;
  --auth-accent-light: #EAB308;

  /* Neutral Colors */
  --auth-white: #FFFFFF;
  --auth-bg: #F4F6F8;
  --auth-text: #2E1065;
  --auth-text-secondary: #6B21A8;
  --auth-text-muted: #A1A1AA;
  --auth-border: #E5E7EB;
  --auth-border-light: #F3F4F6;

  /* Shadows */
  --auth-shadow: 0 4px 6px -1px rgba(130, 31, 252, 0.1);
  --auth-shadow-lg: 0 10px 15px -3px rgba(130, 31, 252, 0.15);
  --auth-shadow-xl: 0 20px 25px -5px rgba(130, 31, 252, 0.2);
  --auth-shadow-card: 0 8px 32px rgba(130, 31, 252, 0.12);
  --auth-shadow-glow: 0 0 40px rgba(130, 31, 252, 0.3);

  /* Typography */
  --auth-font-family: 'Fira Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --auth-font-size-sm: 13px;
  --auth-font-size-base: 14px;
  --auth-font-size-lg: 16px;
  --auth-font-size-xl: 20px;
  --auth-font-size-2xl: 28px;
  --auth-font-size-3xl: 36px;

  /* Layout */
  --auth-border-radius: 8px;
  --auth-border-radius-lg: 12px;
  --auth-border-radius-xl: 16px;

  /* Transitions */
  --auth-transition: 200ms ease;
  --auth-transition-slow: 300ms ease;
}

/* Google Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=Fira+Sans:wght@400;500;600;700&display=swap');

/* ============================================
   2. Base Auth Page Styles
   ============================================ */
.auth-page {
  font-family: var(--auth-font-family);
  background: var(--auth-bg);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ============================================
   3. Split Layout Container
   ============================================ */
.auth-container {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* ============================================
   4. Left Brand Panel
   ============================================ */
.auth-brand-panel {
  flex: 0 0 55%;
  max-width: 720px;
  background: linear-gradient(135deg, var(--auth-primary) 0%, var(--auth-primary-dark) 50%, var(--auth-primary-darker) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 60px;
}

.auth-brand-content {
  text-align: center;
  color: var(--auth-white);
  z-index: 2;
  max-width: 400px;
}

.auth-brand-logo {
  margin-bottom: 24px;
}

.auth-brand-logo img {
  width: 100px;
  height: 100px;
  border-radius: var(--auth-border-radius-lg);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  background: var(--auth-white);
  padding: 12px;
}

.auth-brand-title {
  font-size: var(--auth-font-size-3xl);
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
  color: var(--auth-white);
}

.auth-brand-subtitle {
  font-size: var(--auth-font-size-lg);
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 48px;
  font-weight: 400;
}

.auth-brand-features {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-feature-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--auth-border-radius);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all var(--auth-transition);
}

.auth-feature-item:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.auth-feature-item i {
  font-size: 20px;
  color: var(--auth-accent-light);
}

.auth-feature-item span {
  font-size: var(--auth-font-size-base);
  font-weight: 500;
}

/* Decoration Circles */
.auth-brand-decoration {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  overflow: hidden;
}

.decoration-circle {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.circle-1 {
  width: 300px;
  height: 300px;
  top: -100px;
  left: -100px;
  animation: float 6s ease-in-out infinite;
}

.circle-2 {
  width: 200px;
  height: 200px;
  bottom: 50px;
  right: -50px;
  animation: float 8s ease-in-out infinite reverse;
}

.circle-3 {
  width: 150px;
  height: 150px;
  top: 50%;
  left: 10%;
  animation: float 10s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-20px) rotate(5deg); }
}

/* ============================================
   5. Right Form Panel
   ============================================ */
.auth-form-panel {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--auth-white);
  padding: 60px;
  position: relative;
}

.auth-form-wrapper {
  width: 100%;
  max-width: 480px;
  padding: 20px;
}

/* ============================================
   6. Auth Form Card
   ============================================ */
.auth-form-card {
  background: var(--auth-white);
  border-radius: var(--auth-border-radius-xl);
  box-shadow: var(--auth-shadow-card);
  padding: 40px;
  border: 1px solid var(--auth-border-light);
}

.auth-form-header {
  text-align: center;
  margin-bottom: 32px;
}

.auth-form-title {
  font-size: var(--auth-font-size-2xl);
  font-weight: 600;
  color: var(--auth-text);
  margin-bottom: 8px;
}

.auth-form-desc {
  font-size: var(--auth-font-size-base);
  color: var(--auth-text-muted);
}

/* Error Icon for forbidden/error pages */
.auth-error-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #FEE2E2 0%, #FECACA 100%);
  border-radius: 50%;
  color: #DC2626;
}

.auth-error-icon i {
  font-size: 40px;
}

/* ============================================
   7. Form Elements
   ============================================ */
.auth-form-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.auth-form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-form-label {
  font-size: var(--auth-font-size-sm);
  font-weight: 500;
  color: var(--auth-text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.auth-form-label i {
  font-size: 16px;
  color: var(--auth-primary);
}

.auth-form-control {
  width: 100%;
  padding: 14px 16px;
  font-size: var(--auth-font-size-base);
  font-family: var(--auth-font-family);
  color: var(--auth-text);
  background: var(--auth-white);
  border: 2px solid var(--auth-border);
  border-radius: var(--auth-border-radius);
  transition: all var(--auth-transition);
  outline: none;
}

.auth-form-control::placeholder {
  color: var(--auth-text-muted);
}

.auth-form-control:hover {
  border-color: var(--auth-primary-lighter);
}

.auth-form-control:focus {
  border-color: var(--auth-primary);
  box-shadow: 0 0 0 3px var(--auth-primary-bg);
  outline: none;
}

/* Override Bootstrap form-control focus */
.auth-form-panel .form-control:focus,
.auth-form-card input:focus {
  border-color: var(--auth-primary);
  box-shadow: 0 0 0 3px var(--auth-primary-bg);
  outline: none;
}

.auth-form-error {
  font-size: var(--auth-font-size-sm);
  color: #DC2626;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
}

/* Checkbox */
.auth-form-checkbox {
  margin-top: -8px;
}

.auth-form-checkbox .form-check {
  display: flex;
  align-items: center;
  gap: 8px;
}

.auth-form-checkbox .form-check-input {
  width: 18px;
  height: 18px;
  margin-top: 0;
  cursor: pointer;
  background-color: var(--auth-white);
  border: 2px solid var(--auth-border);
  border-radius: var(--auth-border-radius);
  transition: all var(--auth-transition);
  appearance: none;
  -webkit-appearance: none;
}

.auth-form-checkbox .form-check-input:hover {
  border-color: var(--auth-primary);
}

.auth-form-checkbox .form-check-input:focus {
  border-color: var(--auth-primary);
  box-shadow: 0 0 0 3px var(--auth-primary-bg);
  outline: none;
}

.auth-form-checkbox .form-check-input:checked {
  background-color: var(--auth-primary);
  border-color: var(--auth-primary);
  background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e");
  background-size: 12px 12px;
  background-position: center;
  background-repeat: no-repeat;
}

.auth-form-checkbox .form-check-input:checked:hover {
  background-color: var(--auth-primary-dark);
  border-color: var(--auth-primary-dark);
}

.auth-form-checkbox .form-check-label {
  font-size: var(--auth-font-size-sm);
  color: var(--auth-text-secondary);
  cursor: pointer;
  user-select: none;
}

/* ============================================
   8. Buttons
   ============================================ */
.auth-form-actions {
  margin-top: 8px;
}

.auth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 16px 24px;
  font-size: var(--auth-font-size-lg);
  font-weight: 600;
  font-family: var(--auth-font-family);
  border-radius: var(--auth-border-radius);
  border: none;
  cursor: pointer;
  transition: all var(--auth-transition);
  text-decoration: none;
}

.auth-btn-primary {
  background: linear-gradient(135deg, var(--auth-primary) 0%, var(--auth-primary-dark) 100%);
  color: var(--auth-white);
  box-shadow: 0 4px 16px rgba(130, 31, 252, 0.3);
}

.auth-btn-primary:hover {
  background: linear-gradient(135deg, var(--auth-primary-dark) 0%, var(--auth-primary-darker) 100%);
  box-shadow: 0 6px 24px rgba(130, 31, 252, 0.4);
  transform: translateY(-2px);
}

.auth-btn-primary:active {
  transform: translateY(0);
}

/* Loading State */
.auth-btn-loading,
.auth-btn-loading:hover {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
  box-shadow: 0 4px 16px rgba(130, 31, 252, 0.3);
}

.auth-btn-spinner .spinner-border {
  width: 20px;
  height: 20px;
  border-width: 2px;
}

.auth-btn i {
  font-size: 20px;
}

/* Danger Button */
.auth-btn-danger {
  background: linear-gradient(135deg, #DC2626 0%, #B91C1C 100%);
  color: var(--auth-white);
  box-shadow: 0 4px 16px rgba(220, 38, 38, 0.3);
}

.auth-btn-danger:hover {
  background: linear-gradient(135deg, #B91C1C 0%, #991B1B 100%);
  box-shadow: 0 6px 24px rgba(220, 38, 38, 0.4);
  transform: translateY(-2px);
}

/* ============================================
   9. Footer Links
   ============================================ */
.auth-form-footer {
  text-align: center;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--auth-border-light);
}

.auth-form-footer p {
  font-size: var(--auth-font-size-base);
  color: var(--auth-text-muted);
}

.auth-link {
  color: var(--auth-primary);
  font-weight: 500;
  text-decoration: none;
  transition: color var(--auth-transition);
}

.auth-link:hover {
  color: var(--auth-primary-dark);
  text-decoration: underline;
}

/* ============================================
   10. Flash Messages
   ============================================ */
.auth-flashes {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1060;
  min-width: 320px;
  max-width: 400px;
}

.auth-flashes .alert {
  padding: 16px 20px;
  border-radius: var(--auth-border-radius-lg);
  border: none;
  box-shadow: var(--auth-shadow-xl);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 500;
  animation: slideDown 0.3s ease-out;
}

.auth-flashes .alert-success {
  background: linear-gradient(135deg, #16A34A 0%, #15803D 100%);
  color: var(--auth-white);
}

.auth-flashes .alert-warning {
  background: linear-gradient(135deg, var(--auth-accent) 0%, #A16207 100%);
  color: var(--auth-white);
}

.auth-flashes .alert-danger {
  background: linear-gradient(135deg, #DC2626 0%, #B91C1C 100%);
  color: var(--auth-white);
}

.auth-flashes .alert-info {
  background: linear-gradient(135deg, var(--auth-primary) 0%, var(--auth-primary-dark) 100%);
  color: var(--auth-white);
}

.auth-flashes .alert i {
  font-size: 20px;
}

.auth-flashes .btn-close {
  filter: brightness(0) invert(1);
  opacity: 0.8;
}

.auth-flashes .btn-close:hover {
  opacity: 1;
}

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

/* ============================================
   11. Responsive Design
   ============================================ */
@media (max-width: 1024px) {
  .auth-brand-panel {
    flex: 0 0 50%;
    padding: 40px;
  }

  .auth-form-panel {
    padding: 40px;
  }

  .auth-brand-title {
    font-size: var(--auth-font-size-2xl);
  }

  .auth-brand-subtitle {
    font-size: var(--auth-font-size-base);
    margin-bottom: 32px;
  }
}

@media (max-width: 768px) {
  .auth-container {
    flex-direction: column;
  }

  .auth-brand-panel {
    flex: 0 0 auto;
    max-width: 100%;
    min-height: 200px;
    padding: 30px 20px;
    order: 1;
  }

  .auth-brand-logo img {
    width: 80px;
    height: 80px;
  }

  .auth-brand-title {
    font-size: var(--auth-font-size-xl);
  }

  .auth-brand-subtitle {
    font-size: var(--auth-font-size-sm);
    margin-bottom: 20px;
  }

  .auth-brand-features {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
  }

  .auth-feature-item {
    padding: 8px 12px;
    font-size: var(--auth-font-size-sm);
  }

  .auth-feature-item span {
    display: none;
  }

  .auth-feature-item i {
    font-size: 18px;
  }

  .auth-decoration {
    display: none;
  }

  .auth-form-panel {
    flex: 1;
    padding: 20px;
    order: 2;
  }

  .auth-form-wrapper {
    padding: 0;
  }

  .auth-form-card {
    padding: 24px;
    border-radius: var(--auth-border-radius-lg);
  }

  .auth-form-title {
    font-size: var(--auth-font-size-xl);
  }

  .auth-btn {
    padding: 14px 20px;
    font-size: var(--auth-font-size-base);
  }
}

@media (max-width: 480px) {
  .auth-brand-panel {
    min-height: 160px;
    padding: 20px 16px;
  }

  .auth-brand-logo img {
    width: 60px;
    height: 60px;
    border-radius: var(--auth-border-radius);
  }

  .auth-form-panel {
    padding: 16px;
  }

  .auth-form-card {
    padding: 20px;
    box-shadow: var(--auth-shadow-lg);
  }

  .auth-form-header {
    margin-bottom: 24px;
  }

  .auth-form-body {
    gap: 16px;
  }

  .auth-form-control {
    padding: 12px 14px;
  }

  .auth-flashes {
    min-width: 280px;
    left: 16px;
    right: 16px;
    transform: none;
  }
}

/* ============================================
   12. NProgress Override
   ============================================ */
#nprogress .bar {
  background: var(--auth-primary-light);
  height: 3px;
}

#nprogress .peg {
  box-shadow: 0 0 10px var(--auth-primary), 0 0 5px var(--auth-primary);
}

/* ============================================
   13. Accessibility
   ============================================ */
.auth-form-control:focus-visible {
  outline: none;
}

.auth-btn:focus-visible {
  outline: 2px solid var(--auth-primary);
  outline-offset: 2px;
}

.auth-link:focus-visible {
  outline: 2px solid var(--auth-primary);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ============================================
   14. Print Styles
   ============================================ */
@media print {
  .auth-brand-panel {
    display: none;
  }

  .auth-form-panel {
    flex: 1;
    padding: 0;
  }

  .auth-form-card {
    box-shadow: none;
    border: 1px solid #000;
  }

  .auth-flashes {
    display: none;
  }
}