/* =========================================
 * GATE SYSTEM - FRONTEND STYLING
 * Modern, clean login gate for students
 * ========================================= */

/* Modal backdrop - softer, more welcoming */
#qmn-gate-modal.qmn-modal {
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
}

/* Modal dialog container */
#qmn-gate-modal .qmn-modal__dialog {
  max-width: 480px;
  width: 92%;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  animation: gateSlideIn 0.3s ease-out;
}

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

/* Header styling */
#qmn-gate-modal .qmn-modal__header {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  padding: 24px;
  border-bottom: none;
}

#qmn-gate-modal .qmn-modal__header h3 {
  color: #ffffff;
  font-size: 22px;
  font-weight: 700;
  margin: 0;
  text-align: center;
  letter-spacing: -0.02em;
}

/* Body content */
#qmn-gate-modal .qmn-modal__body {
  padding: 28px 24px;
  background: #f8f9fa;
}

/* Note message */
#qmn-gate-modal .qmn-modal__body > p:first-child {
  background: #dbeafe;
  border-left: 4px solid #3b82f6;
  border-radius: 8px;
  padding: 12px 16px;
  margin: 0 0 20px 0;
  color: #1e40af;
  font-size: 14px;
  line-height: 1.6;
}

/* Form rows */
.qmn-form-row {
  margin-bottom: 20px;
}

.qmn-form-row label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  color: #1f2937;
  margin-bottom: 8px;
}

.qmn-form-row label span[style*="color:#dc2626"] {
  color: #ef4444 !important;
  margin-left: 2px;
}

/* Input fields */
.qmn-form-row input[type="text"],
.qmn-form-row input[type="password"],
.qmn-form-row select {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  color: #1f2937;
  background: #ffffff;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.qmn-form-row input:focus,
.qmn-form-row select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.qmn-form-row input::placeholder {
  color: #9ca3af;
}

/* Select dropdown */
.qmn-form-row select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='%236b7280' d='M4.427 6.427l3.396 3.396a.25.25 0 00.354 0l3.396-3.396A.25.25 0 0011.396 6H4.604a.25.25 0 00-.177.427z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}

/* Error message */
#qmn_gate_error {
  background: #fee2e2;
  border-left: 4px solid #ef4444;
  border-radius: 8px;
  padding: 12px 16px;
  margin-top: 16px;
  color: #991b1b;
  font-size: 14px;
  font-weight: 500;
  display: none;
}

#qmn_gate_error[style*="display: block"] {
  display: block !important;
  animation: errorShake 0.4s ease;
}

@keyframes errorShake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-8px);
  }
  75% {
    transform: translateX(8px);
  }
}

/* Footer with button */
#qmn-gate-modal .qmn-modal__footer {
  padding: 20px 24px;
  background: #ffffff;
  border-top: 1px solid #e5e7eb;
  display: flex;
  justify-content: center;
}

#qmn-gate-modal .qmn-modal__footer .btn.primary {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  padding: 14px 32px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4);
  min-width: 180px;
}

#qmn-gate-modal .qmn-modal__footer .btn.primary:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
  transform: translateY(-2px);
}

#qmn-gate-modal .qmn-modal__footer .btn.primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

/* Loading state */
#qmn-gate-modal .qmn-modal__footer .btn.primary.loading {
  pointer-events: none;
  opacity: 0.7;
  position: relative;
}

#qmn-gate-modal .qmn-modal__footer .btn.primary.loading::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: btnSpin 0.6s linear infinite;
}

@keyframes btnSpin {
  to {
    transform: translateY(-50%) rotate(360deg);
  }
}

/* Mobile responsive */
@media (max-width: 520px) {
  #qmn-gate-modal .qmn-modal__dialog {
    width: 95%;
    max-width: none;
  }

  #qmn-gate-modal .qmn-modal__header {
    padding: 20px 16px;
  }

  #qmn-gate-modal .qmn-modal__header h3 {
    font-size: 20px;
  }

  #qmn-gate-modal .qmn-modal__body {
    padding: 20px 16px;
  }

  .qmn-form-row input,
  .qmn-form-row select {
    font-size: 16px; /* Prevent zoom on iOS */
  }

  #qmn-gate-modal .qmn-modal__footer .btn.primary {
    width: 100%;
    min-width: 0;
  }
}

/* Accessibility improvements */
#qmn-gate-modal .qmn-form-row input:focus,
#qmn-gate-modal .qmn-form-row select:focus {
  outline: 2px solid transparent;
  outline-offset: 2px;
}

/* Required field asterisk styling */
.qmn-form-row label span[style*="color:#dc2626"]::before {
  content: "⚠ ";
  font-size: 12px;
}

/* Success state (optional - for future enhancement) */
#qmn-gate-modal.success .qmn-modal__header {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
  #qmn-gate-modal .qmn-modal__dialog {
    background: #1f2937;
  }

  #qmn-gate-modal .qmn-modal__body {
    background: #111827;
  }

  #qmn-gate-modal .qmn-modal__body > p:first-child {
    background: #1e3a8a;
    color: #93c5fd;
  }

  .qmn-form-row label {
    color: #f3f4f6;
  }

  .qmn-form-row input,
  .qmn-form-row select {
    background: #374151;
    border-color: #4b5563;
    color: #f3f4f6;
  }

  .qmn-form-row input::placeholder {
    color: #6b7280;
  }

  #qmn-gate-modal .qmn-modal__footer {
    background: #1f2937;
    border-top-color: #374151;
  }
}
