/* Import fonts */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

:root {
  --primary-color: #eb3505;
  --primary-dark: #d43004;
  --secondary-color: #1e293b;
  --text-color: #475569;
  --border-color: #e2e8f0;
}

/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Inter", sans-serif;
  background-color: #f8fafc;
  min-height: 100vh;
}

/* Login wrapper */
.login-wrapper {
  display: grid;
  grid-template-columns: 400px 1fr;
  min-height: 100vh;
}

/* Sidebar styles */
.login-sidebar {
  background: var(--secondary-color);
  padding: 2rem;
  color: white;
  position: relative;
  overflow: hidden;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 3rem;
}

.brand-logo {
  width: 60px;
  height: 60px;
}

.brand-text h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
}

.brand-text p {
  font-size: 0.875rem;
  margin: 0;
  opacity: 0.9;
}

/* Login content */
.login-content {
  padding: 2rem 4rem;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

.login-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3rem;
}

.back-link {
  color: #64748b;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.back-link:hover {
  color: #0f172a;
}

.auth-links span {
  color: #64748b;
  margin-right: 0.5rem;
}

.register-link {
  color: #eb3505;
  text-decoration: none;
  font-weight: 500;
}

/* Login form */
.login-form-wrapper {
  background: white;
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  max-width: 400px;
  margin: 0 auto;
}

.form-header {
  text-align: center;
  margin-bottom: 2rem;
}

.form-header h2 {
  font-size: 1.75rem;
  color: #0f172a;
  margin-bottom: 0.5rem;
}

.form-header p {
  color: #64748b;
}

.login-form .form-floating {
  margin-bottom: 1rem;
}

/* Enhanced Form Styles */
.form-floating {
  position: relative;
  margin-bottom: 1.5rem;
}

.form-floating > .form-control {
  height: 3.5rem;
  padding: 1rem 0.75rem;
  border: 1.5px solid var(--border-color);
  border-radius: 10px;
  transition: all 0.3s ease;
}

.form-floating > .form-control:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(235, 53, 5, 0.1);
}

.form-floating > label {
  padding: 1rem 0.75rem;
  color: var(--text-color);
}

.password-toggle-btn {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-color);
  padding: 0.25rem;
  cursor: pointer;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.password-toggle-btn:hover {
  color: var(--primary-color);
}

.password-toggle-btn i {
  font-size: 1.25rem;
}

/* Enhanced Form Options */
.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-check-input {
  width: 1.25rem;
  height: 1.25rem;
  border: 1.5px solid var(--border-color);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.form-check-input:checked {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

.form-check-label {
  color: var(--text-color);
  font-size: 0.938rem;
  cursor: pointer;
  user-select: none;
}

.forgot-password {
  color: var(--primary-color);
  text-decoration: none;
  font-size: 0.938rem;
  font-weight: 500;
  transition: all 0.3s ease;
}

.forgot-password:hover {
  color: var (--primary-dark);
  text-decoration: underline;
}

.login-form .form-floating {
  margin-bottom: 1rem;
}

.form-floating > .form-control {
  height: 3.5rem;
  padding: 1rem 0.75rem;
}

.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.forgot-password {
  color: #eb3505;
  text-decoration: none;
  font-size: 0.875rem;
}

.qr-login-option {
  position: relative;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
}

.qr-login-option span {
  background: white;
  color: var(--text-color);
  padding: 0 1rem;
  position: absolute;
  top: -0.75rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.938rem;
}

/* Feature items styling */
.feature-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  transition: all 0.3s ease;
}

.feature-item:hover {
  transform: translateX(5px);
  background: rgba(255, 255, 255, 0.1);
}

.feature-item i {
  font-size: 1.5rem;
  color: var(--primary-color);
  flex-shrink: 0;
}

/* Button styles */
.btn {
  padding: 0.875rem 1.5rem;
  font-weight: 500;
  border-radius: 10px;
  transition: all 0.3s ease;
}

.btn-primary {
  background: var(--primary-color);
  border: none;
  box-shadow: 0 4px 12px rgba(235, 53, 5, 0.2);
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(235, 53, 5, 0.3);
}

.btn-outline-secondary {
  border: 1.5px solid var(--border-color);
  color: var(--text-color);
  background: white;
}

.btn-outline-secondary:hover {
  background: #f8fafc;
  border-color: var(--text-color);
  transform: translateY(-2px);
}

/* Mobile styles */
@media (max-width: 1024px) {
  .login-wrapper {
    grid-template-columns: 320px 1fr;
  }

  .login-content {
    padding: 2rem;
  }
}

@media (max-width: 991px) {
  .login-sidebar {
    display: none;
  }

  .login-content {
    margin-left: 0;
    padding-top: 80px;
  }

  .mobile-header {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    z-index: 100;
  }

  .mobile-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
  }

  .mobile-brand img {
    width: 40px;
    height: 40px;
  }

  .mobile-brand h1 {
    font-size: 1.25rem;
    margin: 0;
  }

  .mobile-brand p {
    font-size: 0.75rem;
    margin: 0;
    color: #64748b;
  }
}

@media (max-width: 768px) {
  .login-wrapper {
    grid-template-columns: 1fr;
  }
}

/* Loading overlay */
.loading-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  z-index: 9999;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

.loading-overlay.active {
  display: flex;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #eb3505;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Remove success validation styles */
.form-control.is-valid,
.was-validated .form-control:valid {
  border-color: var(--border-color);
  background-image: none;
  padding-right: 0.75rem;
}

.form-control:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(235, 53, 5, 0.1);
}

/* Simplify error state */
.form-control.is-invalid,
.was-validated .form-control:invalid {
  border-color: #ef4444;
  background-image: none;
  padding-right: 0.75rem;
}

.form-control.is-invalid:focus {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* Custom toast styles */
.toast-success {
  background-color: #10b981 !important;
}

.toast-error {
  background-color: #ef4444 !important;
}

/* Updated Scanner Styles */
.scan-instructions {
  position: absolute;
  bottom: 2rem;
  left: 0;
  right: 0;
  text-align: center;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 16px;
  margin: 0 1rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(8px);
}

.instruction-icon {
  width: 48px;
  height: 48px;
  background: var(--primary-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.75rem;
  box-shadow: 0 4px 12px rgba(235, 53, 5, 0.2);
}

.instruction-icon i {
  font-size: 1.5rem;
  color: white;
}

.scan-instructions p {
  margin: 0;
  font-size: 1rem;
  color: var(--text-color);
  font-weight: 500;
}

/* Remove scan controls styles as they're no longer needed */
.scan-controls {
  display: none;
}

/* Enhanced Scanner Controls */
.scan-instructions {
  position: absolute;
  bottom: 2rem;
  left: 0;
  right: 0;
  text-align: center;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 16px;
  margin: 0 1rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(8px);
}

.instruction-icon {
  width: 48px;
  height: 48px;
  background: var(--primary-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  box-shadow: 0 4px 12px rgba(235, 53, 5, 0.2);
}

.instruction-icon i {
  font-size: 1.5rem;
  color: white;
}

.scan-instructions p {
  margin: 0 0 1.25rem;
  font-size: 1rem;
  color: var(--text-color);
  font-weight: 500;
}

.scan-controls {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.btn-scan-control {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border: none;
  border-radius: 8px;
  font-size: 0.938rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

#startScan {
  background: var(--primary-color);
  color: white;
  box-shadow: 0 2px 8px rgba(235, 53, 5, 0.2);
}

#startScan:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(235, 53, 5, 0.3);
}

#stopScan {
  background: #f1f5f9;
  color: var(--text-color);
}

#stopScan:hover {
  background: #e2e8f0;
  transform: translateY(-2px);
}

.btn-scan-control i {
  font-size: 1.25rem;
}

/* Enhanced Scan Frame */
.scan-frame {
  width: 280px;
  height: 280px;
  position: relative;
  animation: pulse 2s infinite;
}

.scan-line {
  position: absolute;
  width: 100%;
  height: 2px;
  background: var(--primary-color);
  box-shadow: 0 0 8px var(--primary-color);
  top: 0;
  animation: scan 2s linear infinite;
}

@keyframes scan {
  0% {
    top: 0;
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
  100% {
    top: 100%;
    opacity: 1;
  }
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.02);
  }
  100% {
    transform: scale(1);
  }
}

/* Mobile Optimizations */
@media (max-width: 768px) {
  .scan-instructions {
    bottom: 1.5rem;
    padding: 1.25rem;
    margin: 0 0.75rem;
  }

  .instruction-icon {
    width: 40px;
    height: 40px;
  }

  .instruction-icon i {
    font-size: 1.25rem;
  }

  .scan-instructions p {
    font-size: 0.938rem;
    margin-bottom: 1rem;
  }

  .btn-scan-control {
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
  }

  .scan-controls {
    gap: 0.75rem;
  }
}

.btn-close {
  color: #fff;
}

/* Updated QR Scanner Modal Styles */
.qr-scanner-modal .modal-content {
  background: #1e293b;
  border-radius: 20px;
  border: none;
  overflow: hidden;
}

.qr-scanner-modal .modal-header {
  border: none;
  padding: 1rem;
  background: transparent;
}

.scanner-header {
  width: 100%;
  text-align: center;
  color: white;
}

.modal-title {
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
}

.scanner-subtitle {
  font-size: 0.875rem;
  opacity: 0.8;
  margin: 0;
}

.scanner-container {
  position: relative;
  width: 100%;
  height: 350px;
  overflow: hidden;
}

#qr-reader {
  width: 100% !important;
  height: 100% !important;
  background: transparent !important;
  border: none !important;
}

#qr-reader video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
  .qr-scanner-modal .modal-dialog {
    margin: 1rem;
    max-width: 400px;
  }

  .qr-scanner-modal .modal-content {
    border-radius: 16px;
  }

  .scanner-container {
    height: 300px;
  }

  .modal-header {
    padding: 0.75rem;
  }

  .modal-title {
    font-size: 1.125rem;
  }

  .scanner-subtitle {
    font-size: 0.813rem;
  }
}

/* Remove all unnecessary styles */
.scan-frame,
.scan-line,
.scan-overlay,
.scan-instructions,
.corner-tl,
.corner-tr,
.corner-bl,
.corner-br {
  display: none !important;
}

/* QR Scanner Modal Close Button */
.qr-scanner-modal .btn-close {
  filter: invert(1) brightness(200%);
  opacity: 0.8;
  transition: opacity 0.3s ease;
}

.qr-scanner-modal .btn-close:hover {
  opacity: 1;
}

/* Enhanced Form Floating Styles */
.form-floating {
  position: relative;
  margin-bottom: 1.5rem;
}

.form-floating > .form-control {
  height: 3.5rem;
  line-height: 1.25;
  padding: 1rem 0.75rem;
  font-size: 0.875rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.form-floating > label {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding: 1rem 0.75rem;
  overflow: hidden;
  text-align: start;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
  border: 1px solid transparent;
  transform-origin: 0 0;
  transition: opacity 0.2s ease-in-out, transform 0.2s ease-in-out;
  color: var(--text-color);
  opacity: 0.65;
}

/* Center label when empty */
.form-floating > .form-control:placeholder-shown ~ label {
  opacity: 0.65;
  transform: scale(1) translateY(0) translateX(0);
}

/* Move label up when focused or filled */
.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label {
  opacity: 0.65;
  transform: scale(0.85) translateY(-0.5rem) translateX(0.15rem);
  background: white;
  height: auto;
  padding: 0.25rem;
  margin-left: 0.5rem;
  margin-top: 0.5rem;
}

/* Focus styles */
.form-floating > .form-control:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.25rem rgba(235, 53, 5, 0.25);
  outline: 0;
}

/* Terms Agreement Styles */
.terms-agreement {
  text-align: center;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text-color);
}

.terms-agreement a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.terms-agreement a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.register-prompt {
  font-size: 0.95rem;
}

.register-prompt span {
  color: #6c757d;
}

.register-prompt a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
  margin-left: 5px;
  transition: color 0.2s ease;
}

.register-prompt a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}
