/* ===================================================================
   AUTHENTICATION UI
   =================================================================== */

/* -------------------------------------------------------------------
   Legacy Login Container (if still used)
   ------------------------------------------------------------------- */
.login-container {
  max-width: 400px;
  margin: 100px auto;
  padding: 30px;
  border: 1px solid #ddd;
  border-radius: 10px;
  background-color: #f9f9f9;
}

.login-title {
  text-align: center;
  margin-bottom: 30px;
  color: #333;
}

.btn-auth {
  width: 100%;
  margin-bottom: 10px;
}

.auth-links {
  text-align: center;
  margin-top: 15px;
}

.auth-links a {
  color: #337ab7;
  text-decoration: none;
  margin: 0 10px;
}

.auth-links a:hover {
  text-decoration: underline;
}

/* -------------------------------------------------------------------
   CAPRED Login Wrapper - Main Container
   ------------------------------------------------------------------- */
.capred-login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 60px);
  padding: 40px 20px;
  background: var(--light-gray);
  font-family: "DM Sans", sans-serif;
}

/* -------------------------------------------------------------------
   Card Container
   ------------------------------------------------------------------- */
.capred-login-card {
  display: flex;
  gap: 0;
  max-width: 860px;
  width: 100%;
  border-radius: 16px;
  overflow: hidden;
  box-shadow:
    0 4px 24px var(--shadow-color),
    0 1px 4px rgba(0, 0, 0, 0.04);
  animation: capredCardIn 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes capredCardIn {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* -------------------------------------------------------------------
   Tutorial Panel (Left Side)
   ------------------------------------------------------------------- */
.capred-tutorial-panel {
  background: linear-gradient(
    135deg,
    #0d2f49 0%,
    var(--primary-dark) 50%,
    #1a4a6e 100%
  );
  width: 340px;
  min-width: 340px;
  padding: 44px 32px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.capred-tutorial-panel::before {
  content: "";
  position: absolute;
  top: -60px;
  right: -60px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: rgba(46, 162, 220, 0.12);
  pointer-events: none;
}

.capred-tutorial-panel::after {
  content: "";
  position: absolute;
  bottom: -40px;
  left: -40px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(46, 162, 220, 0.08);
  pointer-events: none;
}

.capred-tutorial-panel > * {
  position: relative;
  z-index: 1;
}

.capred-tutorial-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition:
    transform 0.3s ease,
    background 0.3s ease;
}

.capred-tutorial-icon:hover {
  transform: scale(1.05);
  background: rgba(255, 255, 255, 0.15);
}

.capred-tutorial-icon svg {
  width: 36px;
  height: 36px;
  color: #fff;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.2));
}

.capred-tutorial-title {
  font-family: "Outfit", sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
  margin-bottom: 12px;
}

.capred-tutorial-desc {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.65);
  line-height: 1.6;
  margin-bottom: 28px;
}

.capred-tutorial-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  color: var(--primary-dark);
  font-family: "DM Sans", sans-serif;
  font-size: 14px;
  font-weight: 600;
  padding: 12px 24px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.25s ease;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.capred-tutorial-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  background: var(--light-gray);
  color: var(--primary-dark);
  text-decoration: none;
}

.capred-tutorial-btn svg {
  width: 18px;
  height: 18px;
  color: var(--primary-light);
  transition: transform 0.25s ease;
}

.capred-tutorial-btn:hover svg {
  transform: scale(1.15);
}

.capred-tutorial-duration {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
  display: flex;
  align-items: center;
  gap: 5px;
}

.capred-tutorial-duration svg {
  width: 14px;
  height: 14px;
}

/* -------------------------------------------------------------------
   Login Panel (Right Side)
   ------------------------------------------------------------------- */
.capred-login-panel {
  background: #ffffff;
  flex: 1;
  padding: 48px 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.capred-login-header {
  margin-bottom: 32px;
}

.capred-login-header h1 {
  font-family: "Outfit", sans-serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 6px;
}

.capred-login-header p {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0;
}

/* Form Fields - Override Shiny Defaults */
.capred-login-panel .form-group {
  margin-bottom: 20px;
  width: 100%;
}

.capred-login-panel .form-group > label,
.capred-login-panel .control-label {
  display: block;
  font-family: "DM Sans", sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 7px;
}

.capred-login-panel .form-group > input,
.capred-login-panel .form-control {
  width: 100%;
  padding: 12px 14px;
  font-family: "DM Sans", sans-serif;
  font-size: 14px;
  border: 1.5px solid var(--border-light);
  border-radius: 10px;
  background: var(--light-gray);
  color: var(--text-dark);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
  outline: none;
  height: auto;
  box-shadow: none;
}

.capred-login-panel .form-control::placeholder {
  color: var(--text-muted);
}

.capred-login-panel .form-control:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(46, 162, 220, 0.12);
  background: #fff;
}

/* Login Button */
.capred-login-panel .capred-login-btn {
  padding: 13px;
  font-family: "DM Sans", sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: var(--primary-light);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.25s ease;
  margin-top: 4px;
}

.capred-login-panel .capred-login-btn:hover,
.capred-login-panel .capred-login-btn:focus {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(22, 72, 106, 0.3);
}

/* Auth Links */
.capred-auth-links {
  text-align: center;
  margin-top: 18px;
}

.capred-auth-links a,
.capred-auth-links .action-button {
  font-family: "DM Sans", sans-serif;
  font-size: 13px;
  color: var(--primary-light);
  text-decoration: none;
  font-weight: 500;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: color 0.2s;
}

.capred-auth-links a:hover,
.capred-auth-links .action-button:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

/* -------------------------------------------------------------------
   Responsive
   ------------------------------------------------------------------- */
@media (max-width: 768px) {
  .capred-login-card {
    flex-direction: column;
    max-width: 440px;
  }

  .capred-tutorial-panel {
    width: 100%;
    min-width: unset;
    padding: 32px 24px;
  }

  .capred-login-panel {
    padding: 36px 28px;
  }
}

/* ===================================================================
   CUSTOM MODALS - Reset Password Modal Only
   =================================================================== */

/* Highly specific selectors to avoid interfering with other modals */

/* -------------------------------------------------------------------
   Reset Password Modal - Container
   ------------------------------------------------------------------- */
.capred-reset-modal {
  padding: 0;
  font-family: "DM Sans", sans-serif;
}

/* Target only modals containing the reset password class */
.modal-dialog:has(.capred-reset-modal) .modal-content {
  border-radius: 16px;
  border: none;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* Remove default Shiny modal-body padding for reset password modal only */
.modal-dialog:has(.capred-reset-modal) .modal-body {
  padding: 0 !important;
}

/* -------------------------------------------------------------------
   Header Section - Reset Password Only
   ------------------------------------------------------------------- */
.capred-reset-modal .capred-reset-header {
  background: linear-gradient(
    135deg,
    var(--primary-dark) 0%,
    var(--primary-light) 100%
  );
  padding: 40px 32px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.capred-reset-modal .capred-reset-header::before {
  content: "";
  position: absolute;
  top: -50px;
  right: -50px;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  pointer-events: none;
}

.capred-reset-modal .capred-reset-header::after {
  content: "";
  position: absolute;
  bottom: -30px;
  left: -30px;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  pointer-events: none;
}

.capred-reset-modal .capred-reset-icon {
  width: 70px;
  height: 70px;
  margin: 0 auto 20px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px);
  position: relative;
  z-index: 1;
  animation: capredIconPulse 2s ease-in-out infinite;
}

@keyframes capredIconPulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

.capred-reset-modal .capred-reset-title {
  color: white;
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 12px 0;
  position: relative;
  z-index: 1;
  font-family: "Outfit", sans-serif;
}

.capred-reset-modal .capred-reset-subtitle {
  color: rgba(255, 255, 255, 0.9);
  font-size: 14px;
  line-height: 1.6;
  margin: 0;
  max-width: 400px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

/* -------------------------------------------------------------------
   Body Section - Reset Password Only
   ------------------------------------------------------------------- */
.capred-reset-modal .capred-reset-body {
  padding: 32px 32px 24px;
  background: white;
}

.capred-reset-modal .capred-reset-input-group {
  margin-bottom: 0;
}

.capred-reset-modal .capred-reset-label {
  display: flex;
  align-items: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 10px;
}

.capred-reset-modal .capred-reset-label i {
  color: var(--primary-light);
}

.capred-reset-modal .capred-reset-input-group input.form-control {
  width: 100%;
  padding: 14px 16px;
  font-size: 15px;
  border: 2px solid var(--border-light);
  border-radius: 10px;
  background: var(--light-gray);
  transition: all 0.3s ease;
  outline: none;
}

.capred-reset-modal .capred-reset-input-group input.form-control:focus {
  border-color: var(--primary-light);
  background: white;
  box-shadow: 0 0 0 4px rgba(46, 162, 220, 0.1);
}

.capred-reset-modal .capred-reset-input-group input.form-control::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

/* -------------------------------------------------------------------
   Footer Section - Reset Password Only
   ------------------------------------------------------------------- */
.capred-reset-modal .capred-reset-footer {
  padding: 20px 32px 32px;
  background: white;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.capred-reset-modal .capred-reset-submit-btn {
  background: linear-gradient(135deg, var(--primary-light), #1c8bbf);
  color: white;
  border: none;
  padding: 12px 28px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(46, 162, 220, 0.3);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.capred-reset-modal .capred-reset-submit-btn:hover {
  background: linear-gradient(135deg, #1c8bbf, var(--primary-dark));
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(46, 162, 220, 0.4);
}

.capred-reset-modal .capred-reset-submit-btn:active {
  transform: translateY(0);
}

.capred-reset-modal .capred-reset-cancel-btn {
  background: white;
  color: var(--text-muted);
  border: 2px solid var(--border-light);
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 500;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.capred-reset-modal .capred-reset-cancel-btn:hover {
  background: var(--light-gray);
  border-color: var(--text-muted);
  color: var(--text-dark);
}

/* -------------------------------------------------------------------
   Success/Error Messages - Reset Password Modal Only
   ------------------------------------------------------------------- */
.capred-reset-modal .capred-reset-message {
  padding: 14px 18px;
  border-radius: 8px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  animation: capredSlideDown 0.4s ease;
}

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

.capred-reset-modal .capred-reset-message.success {
  background: #d4edda;
  border: 1px solid #c3e6cb;
  color: #155724;
}

.capred-reset-modal .capred-reset-message.error {
  background: #f8d7da;
  border: 1px solid #f5c6cb;
  color: #721c24;
}

.capred-reset-modal .capred-reset-message i {
  font-size: 18px;
}

/* -------------------------------------------------------------------
   Loading State - Reset Password Modal Only
   ------------------------------------------------------------------- */
.capred-reset-modal .capred-reset-submit-btn.loading {
  pointer-events: none;
  opacity: 0.7;
}

.capred-reset-modal .capred-reset-submit-btn.loading::after {
  content: "";
  width: 16px;
  height: 16px;
  margin-left: 10px;
  border: 2px solid white;
  border-top-color: transparent;
  border-radius: 50%;
  animation: capredSpin 0.6s linear infinite;
}

@keyframes capredSpin {
  to {
    transform: rotate(360deg);
  }
}

/* -------------------------------------------------------------------
   Responsive - Reset Password Modal Only
   ------------------------------------------------------------------- */
@media (max-width: 576px) {
  .capred-reset-modal .capred-reset-header {
    padding: 32px 24px;
  }

  .capred-reset-modal .capred-reset-body {
    padding: 24px 20px;
  }

  .capred-reset-modal .capred-reset-footer {
    padding: 16px 20px 24px;
    flex-direction: column;
  }

  .capred-reset-modal .capred-reset-submit-btn,
  .capred-reset-modal .capred-reset-cancel-btn {
    width: 100%;
    justify-content: center;
  }

  .capred-reset-modal .capred-reset-title {
    font-size: 20px;
  }

  .capred-reset-modal .capred-reset-subtitle {
    font-size: 13px;
  }
}
