/* CareerNest Login Modal Styles - Minimal & Clean Design */

/* Login Widget (Button and Logged-in State) */
.cn-login-widget {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.cn-login-btn {
  background-color: #ff8200;
  border: 1px solid #ff8200;
  color: white;
  font-size: 18px;
  font-weight: 500;
  line-height: 148%;
  border-radius: 10px;
  padding: 10px 30px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: capitalize;
}

.cn-login-btn:hover {
  background-color: #e67300;
  border-color: #e67300;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 130, 0, 0.25);
}

/* Logged-in State */
.cn-login-widget.cn-logged-in {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0;
  background: transparent;
  border: none;
}

.cn-user-link {
  display: flex;
  align-items: center;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.cn-user-link:hover {
  opacity: 0.8;
}

.cn-user-name {
  font-weight: 600;
  font-size: 18px;
  color: var(--cn-primary-btn, #ff8200);
  text-transform: capitalize;
}

.cn-logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--cn-primary-btn, #ff8200);
  color: white;
  text-decoration: none;
  border-radius: 999px;
  transition: all 0.2s ease;
}

.cn-logout-btn:hover {
  background: var(--cn-danger, #dc3545);
  color: #fff;
  transform: scale(1.05);
}

.cn-logout-btn svg {
  width: 16px;
  height: 16px;
}

/* Modal Overlay */
.cn-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
  backdrop-filter: blur(4px);
}

/* Modal Content - Match login page card */
.cn-modal-content {
  background: white;
  border-radius: 12px;
  max-width: 450px;
  width: 100%;
  position: relative;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Modal Close Button */
.cn-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: transparent;
  border: none;
  font-size: 1.75rem;
  line-height: 1;
  color: #a0aec0;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.cn-modal-close:hover {
  background: #f7fafc;
  color: #2d3748;
}

/* Modal Header - Match login page */
.cn-modal-header {
  padding: 2.5rem 2.5rem 1rem 2.5rem;
  text-align: center;
}

.cn-modal-header h2 {
  margin: 0 0 0.5rem 0;
  color: #2d3748;
  font-size: 1.75rem;
  font-weight: 700;
}

/* Modal Body - Match login page */
.cn-modal-body {
  padding: 0 2.5rem 2.5rem 2.5rem;
}

/* Social Login Buttons */
.cn-social-login {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.cn-social-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: white;
  color: #4a5568;
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cn-social-btn:not([disabled]):hover {
  border-color: #cbd5e0;
  background: #f7fafc;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.cn-social-btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.cn-social-btn svg {
  flex-shrink: 0;
}

/* Form Divider */
.cn-form-divider {
  display: flex;
  align-items: center;
  margin: 1.5rem 0;
  color: #a0aec0;
  font-size: 0.875rem;
}

.cn-form-divider::before,
.cn-form-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #e2e8f0;
}

.cn-form-divider span {
  padding: 0 1rem;
}

/* Login Messages */
.cn-login-messages {
  margin-bottom: 1rem;
}

.cn-alert {
  padding: 0.875rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
}

.cn-alert-success {
  background: #f0fff4;
  border: 1px solid #68d391;
  color: #22543d;
}

.cn-alert-error {
  background: #fff5f5;
  border: 1px solid #fc8181;
  color: #c53030;
}

/* Form Fields - Scoped to Modal Only */
.cn-modal-content .cn-form-field {
  margin-bottom: 1.25rem;
}

.cn-modal-content .cn-form-field label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #2d3748;
  font-size: 0.875rem;
}

.cn-modal-content .cn-input-wrapper {
  position: relative;
}

.cn-modal-content .cn-input-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: #a0aec0;
  pointer-events: none;
}

.cn-modal-content .cn-input {
  width: 100%;
  padding: 0.875rem 1rem 0.875rem 3rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  background: #f7fafc;
  box-sizing: border-box;
  color: #2d3748;
}

.cn-modal-content .cn-input:focus {
  outline: none;
  border-color: #ff8200;
  background: white;
  box-shadow: 0 0 0 3px rgba(255, 130, 0, 0.08);
}

.cn-modal-content .cn-input::placeholder {
  color: #a0aec0;
}

/* Remember Me Checkbox - Scoped to Modal */
.cn-modal-content .cn-remember-me {
  margin-bottom: 1.5rem;
}

.cn-modal-content .cn-checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
}

.cn-modal-content .cn-checkbox-label input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.cn-modal-content .cn-checkbox-custom {
  width: 18px;
  height: 18px;
  border: 2px solid #cbd5e0;
  border-radius: 4px;
  position: relative;
  transition: all 0.2s ease;
}

.cn-modal-content input[type="checkbox"]:checked ~ .cn-checkbox-custom {
  border-color: #ff8200;
  background: #ff8200;
}

.cn-modal-content input[type="checkbox"]:checked ~ .cn-checkbox-custom::after {
  content: "✓";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 12px;
  font-weight: bold;
  line-height: 1;
}

.cn-modal-content .cn-checkbox-text {
  color: #4a5568;
  font-size: 0.875rem;
}

/* Password Toggle - Scoped to Modal */
.cn-modal-content .cn-password-wrapper {
  position: relative;
}

.cn-modal-content .cn-password-toggle {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #a0aec0;
  cursor: pointer;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
}

.cn-modal-content .cn-password-toggle:hover {
  color: #ff8200;
}

/* Form Options - Scoped to Modal */
.cn-modal-content .cn-form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.cn-modal-content .cn-forgot-link {
  color: #ff8200;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.2s ease;
}

.cn-modal-content .cn-forgot-link:hover {
  color: #e67300;
  text-decoration: underline;
}

/* Submit Button - Scoped to Modal */
.cn-modal-content .cn-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.cn-modal-content .cn-btn-primary {
  background: #ff8200;
  color: white;
}

.cn-modal-content .cn-btn-primary:hover:not(:disabled) {
  background: #e67300;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 130, 0, 0.25);
}

.cn-modal-content .cn-btn-full {
  width: 100%;
}

.cn-modal-content .cn-btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Register Links - Scoped to Modal */
.cn-modal-content .cn-register-links {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid #e2e8f0;
  text-align: center;
}

.cn-modal-content .cn-register-text {
  color: #718096;
  font-size: 0.95rem;
  margin: 0 0 1rem 0;
}

.cn-modal-content .cn-register-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.cn-modal-content .cn-register-buttons .cn-btn {
  width: 100%;
  justify-content: center;
}

.cn-modal-content .cn-btn-outline {
  background: transparent;
  border: 2px solid #e2e8f0;
  color: #4a5568;
}

.cn-modal-content .cn-btn-outline:hover {
  background: #f7fafc;
  border-color: #ff8200;
  color: #ff8200;
}

/* Responsive Design */
@media (max-width: 576px) {
  .cn-modal-content {
    max-width: 100%;
    border-radius: 0;
  }

  .cn-modal-overlay {
    padding: 0;
    align-items: flex-start;
  }

  .cn-modal-header {
    padding: 2rem 1.5rem 1rem 1.5rem;
  }

  .cn-modal-header h2 {
    font-size: 1.5rem;
  }

  .cn-modal-body {
    padding: 0 1.5rem 2rem 1.5rem;
  }

  .cn-modal-footer {
    padding: 1.5rem;
  }

  .cn-modal-close {
    top: 1rem;
    right: 1rem;
  }

  .cn-login-widget.cn-logged-in {
    padding: 0.5rem 0.75rem;
  }

  .cn-user-name {
    font-size: 0.85rem;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* Accessibility - Scoped to Modal */
.cn-modal-close:focus-visible,
.cn-login-btn:focus-visible,
.cn-modal-content .cn-input:focus-visible,
.cn-modal-content .cn-btn-primary:focus-visible,
.cn-modal-content .cn-register-link:focus-visible {
  outline: 2px solid #ff8200;
  outline-offset: 2px;
}

/* Loading State - Scoped to Modal */
.cn-modal-content .cn-btn-primary.loading {
  position: relative;
  pointer-events: none;
}

.cn-modal-content .cn-btn-primary.loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  right: 1rem;
  margin-top: -8px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  .cn-modal-content {
    animation: none;
  }

  * {
    transition: none !important;
  }
}
