/**
 * 5-modals.css - Modal System
 * Unified modal styles for auth, share, AI chat, and other modals
 * Based on design patterns from Laravel modals.css
 *
 * Z-INDEX HIERARCHY (defined in design-tokens.css):
 * --z-dropdown: 1000     - Filter dropdowns on listing pages
 * --z-sticky: 1020       - Sticky headers/navigation
 * --z-fixed: 1030        - Fixed position elements (FAB button)
 * --z-modal-backdrop: 1040 - Modal overlay backgrounds
 * --z-modal: 1050        - Modal containers
 * --z-popover: 1060      - Popovers and tooltips
 * --z-tooltip: 1070      - Tooltips (highest layer)
 *
 * This ensures dropdowns appear below modals when both are open,
 * preventing z-index conflicts and maintaining proper visual hierarchy.
 */

/* ========================================
   BASE MODAL SYSTEM
   ======================================== */

/* Default Modal State - Hidden by default */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--z-modal); /* Design token for consistent modal layering */
}

.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Modal Overlay - Shared across all modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: var(--z-modal-backdrop);
  display: none;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

@keyframes fadeIn {
  to { opacity: 1; }
}

/* Modal Container - Base structure */
.modal-container {
  max-width: var(--modal-max-width);
  max-height: var(--modal-max-height);
  width: 90%;
  background: var(--color-background);
  border-radius: var(--modal-border-radius);
  box-shadow: var(--shadow-modal);
  overflow: hidden;
  transform: translateY(100px);
  animation: slideUp var(--transition-base) forwards;
  display: flex;
  flex-direction: column;
}

@keyframes slideUp {
  to {
    transform: translateY(0);
  }
}

/* Modal Header */
.modal-header {
  background: var(--gradient-brand-primary);
  padding: var(--modal-padding-header);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  border-radius: var(--modal-header-border-radius);
  position: relative;
}

.modal-header-icon {
  width: var(--modal-avatar-size);
  height: var(--modal-avatar-size);
  background: rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.modal-header-icon .material-icons {
  font-size: 24px;
  color: white;
}

.modal-header-content {
  flex: 1;
}

.modal-title {
  margin: 0;
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: white;
  line-height: var(--line-height-tight);
}

.modal-subtitle {
  margin: var(--space-1) 0 0 0;
  font-size: var(--font-size-sm);
  color: rgba(255, 255, 255, 0.9);
  line-height: var(--line-height-normal);
}

.modal-close-btn {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: none;
  border-radius: var(--radius-md);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  padding: 0;
  flex-shrink: 0;
}

.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: rotate(90deg) scale(1.05);
}

.modal-close-btn:active {
  transform: rotate(90deg) scale(0.95);
}

.modal-close-btn:focus-visible {
  outline: 2px solid white;
  outline-offset: 2px;
}

.modal-close-btn .material-icons {
  font-size: 20px;
  color: white;
}

/* Modal Content */
.modal-content {
  padding: var(--modal-padding-content);
  overflow-y: auto;
  flex: 1;
  max-height: calc(80vh - 160px);
}

/* Custom scrollbar for modal content */
.modal-content::-webkit-scrollbar {
  width: 8px;
}

.modal-content::-webkit-scrollbar-track {
  background: var(--color-background-subtle);
  border-radius: var(--radius-full);
}

.modal-content::-webkit-scrollbar-thumb {
  background: var(--color-border-dark);
  border-radius: var(--radius-full);
}

.modal-content::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-secondary);
}

/* Modal Footer */
.modal-footer {
  padding: var(--modal-padding-footer);
  border-top: 1px solid var(--color-border);
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
  align-items: center;
  background: var(--color-background);
}

.modal-footer-actions {
  display: flex;
  gap: var(--space-3);
  flex: 1;
  justify-content: flex-end;
}

/* Full-width footer buttons */
.modal-footer.full-width .modal-footer-actions {
  flex-direction: column;
}

.modal-footer.full-width .modal-footer-actions button {
  width: 100%;
}

/* Modal States */
.modal-overlay.hidden {
  display: none;
}

.modal-container.loading {
  pointer-events: none;
  opacity: 0.6;
}

.modal-container.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border: 4px solid var(--color-border);
  border-top-color: var(--color-brand-primary);
  border-radius: var(--radius-full);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ========================================
   AUTH MODAL
   ======================================== */

/* Auth Modal Overlay */
.auth-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal); /* Design token for consistent modal layering */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

.auth-modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* Auth Modal Container */
.auth-modal-container {
  width: 100%;
  max-width: 525px;
  max-height: 90vh;
  border-radius: var(--modal-border-radius);
  background: white;
  box-shadow: var(--shadow-modal);
  display: flex;
  flex-direction: column;
  transform: translateY(100px) scale(0.9);
  opacity: 0;
  transition: all var(--transition-base);
}

.auth-modal-overlay.open .auth-modal-container {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* Auth Modal Header */
.auth-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  background: var(--gradient-brand-primary);
  color: white;
  border-radius: var(--modal-header-border-radius);
}

.auth-modal-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-modal-avatar {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
}

.auth-modal-avatar .material-icons {
  font-size: 22px;
  color: white;
}

.auth-modal-title-wrapper {
  flex: 1;
}

.auth-modal-title {
  font-size: 18px;
  font-weight: 600;
  color: white;
  margin: 0;
}

.auth-modal-subtitle {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.9);
  margin-top: 2px;
}

.auth-modal-close {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: none;
  cursor: pointer;
  padding: 0;
  border-radius: var(--radius-md);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  color: white;
  flex-shrink: 0;
}

.auth-modal-close:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: rotate(90deg) scale(1.05);
}

.auth-modal-close:active {
  transform: rotate(90deg) scale(0.95);
}

.auth-modal-close:focus-visible {
  outline: 2px solid white;
  outline-offset: 2px;
}

.auth-modal-close .material-icons {
  font-size: 20px;
}

/* Auth Modal Content */
.auth-modal-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  background: #f8f9fa;
  scroll-behavior: smooth;
}

/* Custom Scrollbar */
.auth-modal-content::-webkit-scrollbar {
  width: 6px;
}

.auth-modal-content::-webkit-scrollbar-track {
  background: transparent;
}

.auth-modal-content::-webkit-scrollbar-thumb {
  background: #ddd;
  border-radius: var(--radius-sm);
}

.auth-modal-content::-webkit-scrollbar-thumb:hover {
  background: #ccc;
}

/* Auth Form Styling */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Password Input with Toggle */
.password-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-input-wrapper input {
  width: 100%;
  padding-right: 48px;
}

.toggle-password {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  transition: color 0.2s ease;
}

.toggle-password:hover {
  color: var(--color-brand-primary);
}

.toggle-password .material-icons {
  font-size: 20px;
}

/* Password Requirements */
.password-requirements {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
  padding: 12px;
  background: white;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-light);
}

.requirement {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--color-text-secondary);
  transition: color 0.2s ease;
}

.requirement .material-icons {
  font-size: 16px;
  color: var(--color-text-muted);
  transition: color 0.2s ease;
}

.requirement.met {
  color: var(--color-success);
}

.requirement.met .material-icons {
  color: var(--color-success);
}

/* Checkbox Group */
.form-group-checkbox {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--color-text-primary);
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--color-brand-primary);
}

.checkbox-label a {
  color: var(--color-link-primary) !important;  /* Red links site-wide */
  text-decoration: none;
  font-weight: 500;
}

.checkbox-label a:hover {
  color: var(--color-link-primary-hover) !important;  /* Darker red on hover */
  text-decoration: underline;
}

.forgot-password-link {
  font-size: 14px;
  color: var(--color-link-primary) !important;  /* Red links site-wide */
  text-decoration: none;
  font-weight: 500;
  white-space: nowrap;
}

.forgot-password-link:hover {
  color: var(--color-link-primary-hover) !important;  /* Darker red on hover */
  text-decoration: underline;
}

/* Social Login Section */
.social-login-section {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.social-login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  background: white;
  border: 2px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.social-login-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.social-login-btn:hover {
  border-color: var(--color-brand-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.social-login-btn:active {
  transform: translateY(0);
}

.social-login-btn .social-icon {
  font-size: 18px;
  font-weight: 700;
}

/* Google Button */
.google-btn .social-icon {
  background: linear-gradient(135deg, #4285F4 0%, #34A853 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.google-btn:hover::before {
  background: linear-gradient(135deg, rgba(66, 133, 244, 0.05) 0%, rgba(52, 168, 83, 0.05) 100%);
  opacity: 1;
}

/* Microsoft Button */
.microsoft-btn .social-icon {
  color: #00A4EF;
}

.microsoft-btn:hover::before {
  background: rgba(0, 164, 239, 0.05);
  opacity: 1;
}

/* LinkedIn Button */
.linkedin-btn .social-icon {
  color: #0077B5;
  font-family: Arial, sans-serif;
  font-weight: 700;
}

.linkedin-btn:hover::before {
  background: rgba(0, 119, 181, 0.05);
  opacity: 1;
}

/* Auth Divider */
.auth-divider {
  position: relative;
  text-align: center;
  margin: 24px 0;
  height: 1px;
  background: var(--color-border-light);
}

.auth-divider span {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #f8f9fa;
  padding: 0 16px;
  font-size: 13px;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

/* Password Strength Indicator */
.password-strength-bar {
  height: 4px;
  background: var(--color-border-light);
  border-radius: var(--radius-sm);
  margin-top: 8px;
  overflow: hidden;
}

.strength-bar-fill {
  height: 100%;
  width: 0%;
  transition: all 0.3s ease;
  border-radius: var(--radius-sm);
}

.strength-bar-fill.weak {
  width: 33%;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.strength-bar-fill.medium {
  width: 66%;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.strength-bar-fill.strong {
  width: 100%;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.password-strength-text {
  font-size: 12px;
  margin-top: 6px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.password-strength-text.weak {
  color: #ef4444;
}

.password-strength-text.medium {
  color: #f59e0b;
}

.password-strength-text.strong {
  color: #10b981;
}

.password-strength-text .material-icons {
  font-size: 16px;
}

/* Form Textarea - Contact Form */
.form-textarea {
  width: 100%;
  min-height: 120px;
  padding: 12px 16px 12px 48px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  resize: vertical;
  border-radius: var(--radius-md);
}

.form-textarea::placeholder {
  color: var(--color-text-tertiary);
}

.form-textarea:focus {
  outline: none;
}

/* Textarea icon alignment */
.input-group .input-icon + .form-textarea {
  padding-left: 48px;
}

.input-group .form-textarea {
  padding-top: 12px;
  align-items: flex-start;
}

/* Form Error */
.form-error {
  padding: 12px 16px;
  background: #fee;
  border: 1px solid var(--color-danger);
  border-radius: var(--radius-md);
  color: var(--color-danger);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-error::before {
  content: "error";
  font-family: "Material Icons";
  font-size: 20px;
}

/* Form Messages (Success/Error) */
.form-message {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
}

.form-message-success {
  background: #d1fae5;
  border: 1px solid var(--color-success);
  color: var(--color-success);
}

.form-message-success::before {
  content: "check_circle";
  font-family: "Material Symbols Outlined";
  font-size: 20px;
}

.form-message-error {
  background: #fee;
  border: 1px solid var(--color-danger);
  color: var(--color-danger);
}

.form-message-error::before {
  content: "error";
  font-family: "Material Symbols Outlined";
  font-size: 20px;
}

/* Auth Success State */
.auth-success-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 40px 20px;
}

.success-icon {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, var(--color-success) 0%, #059669 100%);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.success-icon .material-icons {
  font-size: 48px;
  color: white;
}

.auth-success-state h3 {
  font-size: 20px;
  font-weight: 600;
  color: var(--color-text-primary);
  margin: 0 0 8px 0;
}

.auth-success-state p {
  font-size: 14px;
  color: var(--color-text-secondary);
  margin: 0;
}

/* Auth Modal Footer */
.auth-modal-footer {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px 24px;
  border-top: 1px solid var(--color-border-light);
  background: white;
}

.auth-toggle-text {
  text-align: center;
  font-size: 14px;
  color: var(--color-text-secondary);
}

.auth-toggle-text a {
  color: var(--color-link-primary) !important;  /* Red links site-wide */
  text-decoration: none;
  font-weight: 500;
}

.auth-toggle-text a:hover {
  color: var(--color-link-primary-hover) !important;  /* Darker red on hover */
  text-decoration: underline;
}

.auth-footer-actions {
  display: flex;
  gap: 12px;
}

.auth-footer-actions .btn-primary,
.auth-footer-actions .btn-secondary {
  flex: 1;
}

/* Loading State */
.btn-primary.loading,
.btn-secondary.loading {
  position: relative;
  color: transparent;
  pointer-events: none;
}

.btn-primary.loading::after,
.btn-secondary.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border: 2px solid white;
  border-top-color: transparent;
  border-radius: var(--radius-full);
  animation: spin 0.6s linear infinite;
}

/* ========================================
   SHARE MODAL
   ======================================== */

/* Share Modal Overlay */
.share-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
  z-index: var(--z-modal); /* Design token for consistent modal layering */
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

.share-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Share Modal Container */
.share-modal {
  background: white;
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 480px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-modal);
  transform: scale(0.9) translateY(20px);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.share-modal-overlay.active .share-modal {
  transform: scale(1) translateY(0);
}

/* Share Modal Header */
.share-modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--color-border-subtle);
  background: var(--gradient-brand-primary);
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.share-modal-title {
  font-size: 20px;
  font-weight: 700;
  color: white !important;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.share-modal-title::before {
  content: 'share';
  font-family: 'Material Icons';
  font-size: 24px;
  display: inline-block;
  vertical-align: middle;
}

.share-modal-close {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: none;
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  transition: all var(--transition-fast);
  flex-shrink: 0;
  padding: 0;
}

.share-modal-close:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: rotate(90deg) scale(1.05);
}

.share-modal-close:active {
  transform: rotate(90deg) scale(0.95);
}

.share-modal-close:focus-visible {
  outline: 2px solid white;
  outline-offset: 2px;
}

.share-modal-close .material-icons {
  font-size: 20px;
}

/* Share Modal Content */
.share-modal-content {
  padding: 24px;
  flex: 1;
  overflow-y: auto;
}

/* Content Preview Card */
.share-content-preview {
  margin-bottom: 24px;
  padding: 16px;
  background: linear-gradient(135deg, var(--color-background-subtle) 0%, var(--color-background-lighter) 100%);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border-subtle);
}

.share-content-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text-primary-darkest);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.share-content-description {
  font-size: 14px;
  color: var(--color-text-secondary-light);
  line-height: 1.5;
}

/* Share Options Grid */
.share-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.share-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 2px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  background: white;
  color: var(--color-text-primary-darker);
  text-decoration: none;
  transition: all var(--transition-fast);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  position: relative;
  overflow: hidden;
}

.share-option::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, transparent 0%, rgba(0, 136, 122, 0.05) 100%);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.share-option:hover {
  background: var(--color-background-light);
  border-color: var(--color-brand-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 136, 122, 0.15);
}

.share-option:hover::before {
  opacity: 1;
}

.share-option-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 14px;
  font-weight: bold;
  flex-shrink: 0;
}

.share-option.linkedin .share-option-icon {
  background: linear-gradient(135deg, #0077b5 0%, #005885 100%);
}

.share-option.facebook .share-option-icon {
  background: linear-gradient(135deg, #1877f2 0%, #0c63d4 100%);
}

.share-option.bluesky .share-option-icon {
  background: linear-gradient(135deg, #00bcd4 0%, #0097a7 100%);
}

.share-option.instagram .share-option-icon {
  background: linear-gradient(135deg, #E1306C 0%, #C13584 50%, #833AB4 100%);
}

/* Link Section */
.share-link-section {
  padding-top: 24px;
  border-top: 1px solid var(--color-border-subtle);
}

.share-link-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-primary-darker);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.share-link-label .material-icons {
  font-size: 18px;
  color: var(--color-brand-primary);
}

.share-link-input-group {
  display: flex;
  gap: 12px;
  align-items: stretch;
}

.share-link-input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  font-size: 14px;
  background: var(--color-background-light);
  color: var(--color-text-primary-darker);
  font-family: 'Courier New', monospace;
  transition: all 0.2s ease;
}

.share-link-input:focus {
  outline: none;
  border-color: var(--color-brand-primary);
  background: white;
  box-shadow: 0 0 0 3px rgba(0, 136, 122, 0.1);
}

.share-link-copy {
  padding: 12px 20px;
  background: var(--gradient-brand-primary);
  color: white;
  border: none;
  border-radius: var(--radius-lg);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 100px;
  justify-content: center;
}

.share-link-copy:hover {
  background: var(--gradient-brand-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 136, 122, 0.25);
}

.share-link-copy:active {
  transform: translateY(0);
}

.share-link-copy.copied {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.share-link-copy .material-icons {
  font-size: 18px;
}

/* ========================================
   AI CHAT FLOATING ACTION BUTTON (FAB)
   ======================================== */

/* Material Design FAB - Fixed bottom right */
.ai-chat-float-button {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  background: var(--gradient-brand-primary);
  border: none;
  border-radius: var(--radius-xl);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0, 136, 122, 0.4);
  transition: all var(--transition-base);
  z-index: var(--z-fixed); /* Fixed position UI element */
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  will-change: transform, box-shadow;
}

.ai-chat-float-button:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 8px 30px rgba(0, 136, 122, 0.5);
}

.ai-chat-float-button:active {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 4px 20px rgba(0, 136, 122, 0.4);
}

.ai-chat-float-button:focus-visible {
  outline: 3px solid rgba(0, 136, 122, 0.5);
  outline-offset: 4px;
}

/* FAB icon animation */
.ai-chat-button-icon {
  font-size: 28px;
  color: white;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

.ai-chat-float-button:hover .ai-chat-button-icon {
  transform: scale(1.15) rotate(15deg);
}

/* FAB active state (when modal is open) */
.ai-chat-float-button.active {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.ai-chat-float-button.active .ai-chat-button-icon {
  transform: rotate(180deg);
}

.ai-chat-float-button.active:hover .ai-chat-button-icon {
  transform: rotate(180deg) scale(1.15);
}

/* ========================================
   AI CHAT MODAL - SLIDE FROM RIGHT
   ======================================== */

/* Modal Overlay - Slide from right behavior */
.ai-chat-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: var(--z-modal); /* Design token for consistent modal layering */
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              visibility 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
}

.ai-chat-modal-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Modal Container - Slides from right */
.ai-chat-modal {
  position: relative;
  width: 440px;
  height: 100vh;
  max-width: 100%;
  background: white;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 30px rgba(0, 0, 0, 0.3);
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 0;
}

.ai-chat-modal-overlay.active .ai-chat-modal {
  transform: translateX(0);
}

/* Modal Header */
.ai-chat-header {
  background: var(--gradient-brand-primary);
  padding: var(--space-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  gap: var(--space-3);
  position: relative;
}

.ai-chat-header-info {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex: 1;
}

.ai-chat-avatar {
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.ai-chat-avatar .material-symbols-outlined {
  font-size: 26px;
  color: white;
}

.ai-chat-title h3 {
  font-size: 18px;
  font-weight: 700;
  color: white;
  margin: 0;
  line-height: 1.2;
}

.ai-chat-status {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85);
  margin-top: 2px;
  line-height: 1.4;
}

.ai-chat-header-actions {
  display: flex;
  gap: var(--space-2);
}

.ai-chat-close-btn {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: none;
  border-radius: var(--radius-md);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.ai-chat-close-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: rotate(90deg) scale(1.05);
}

.ai-chat-close-btn:active {
  transform: rotate(90deg) scale(0.95);
}

.ai-chat-close-btn:focus-visible {
  outline: 2px solid white;
  outline-offset: 2px;
}

.ai-chat-close-btn .material-symbols-outlined {
  font-size: 20px;
  color: white;
}

/* Chat Messages Container */
.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  scroll-behavior: smooth;
  background: linear-gradient(180deg, #f8f9fa 0%, #ffffff 100%);
}

/* Custom scrollbar */
.ai-chat-messages::-webkit-scrollbar {
  width: 8px;
}

.ai-chat-messages::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: var(--radius-sm);
  margin: 8px 0;
}

.ai-chat-messages::-webkit-scrollbar-thumb {
  background: var(--color-brand-primary);
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  background-clip: padding-box;
}

.ai-chat-messages::-webkit-scrollbar-thumb:hover {
  background: var(--color-brand-primary-hover);
  background-clip: padding-box;
}

/* Chat Message */
.ai-message {
  display: flex;
  flex-direction: column;
  animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 90%;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ai-message.bot {
  align-self: flex-start;
}

.ai-message.user {
  align-self: flex-end;
}

/* Full width for recommendation cards */
.ai-message.bot:has(.recommendations-grid) {
  max-width: 100%;
  align-self: stretch;
}

/* Message Content */
.ai-message-content {
  background: white;
  border-radius: var(--radius-xl);
  padding: var(--space-4) var(--space-5);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  position: relative;
}

.ai-message.bot .ai-message-content {
  background: white;
  border: 1px solid rgba(0, 136, 122, 0.1);
}

.ai-message.user .ai-message-content {
  background: var(--gradient-brand-primary);
  color: white;
  box-shadow: 0 2px 8px rgba(0, 136, 122, 0.25);
}

/* Full width for recommendation content - Remove all constraints */
.ai-message.bot:has(.recommendations-grid) .ai-message-content {
  width: 100%;
  max-width: 100%;
  padding: var(--space-4);
  border-radius: var(--radius-lg);
}

.ai-message-content .text-content p {
  margin: 0 0 var(--space-3) 0;
  font-size: 15px;
  line-height: 1.6;
  color: inherit;
}

.ai-message-content .text-content p:last-child {
  margin-bottom: 0;
}

.ai-message-content .text-content strong {
  font-weight: 600;
  color: inherit;
}

.ai-message-content .text-content ul {
  margin: var(--space-2) 0;
  padding-left: var(--space-5);
  list-style: disc;
}

.ai-message-content .text-content li {
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: var(--space-2);
  color: inherit;
}

/* Message Time */
.ai-message-time {
  font-size: 11px;
  color: var(--color-text-tertiary);
  margin-top: var(--space-2);
  padding: 0 var(--space-2);
  display: block;
}

.ai-message.user .ai-message-time {
  text-align: right;
}

/* Welcome Action Buttons */
.welcome-action-buttons {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: var(--space-4) 0;
}

.welcome-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3) var(--space-4);
  background: linear-gradient(135deg, rgba(0, 136, 122, 0.05) 0%, rgba(0, 136, 122, 0.02) 100%);
  border: 2px solid rgba(0, 136, 122, 0.2);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-base);
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-primary);
  text-align: center;
  width: 100%;
}

.welcome-action-btn:hover {
  background: linear-gradient(135deg, rgba(0, 136, 122, 0.1) 0%, rgba(0, 136, 122, 0.05) 100%);
  border-color: var(--color-brand-primary);
  transform: translateX(4px);
  box-shadow: 0 2px 8px rgba(0, 136, 122, 0.15);
}

.welcome-action-btn:active {
  transform: translateX(2px);
}

/* Chat Input Area */
.ai-chat-input-area {
  padding: var(--space-5);
  background: white;
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
}

.ai-chat-input-container {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  background: white;
  border: 1px solid #d1d5db;
  border-radius: var(--radius-md);
  padding: var(--space-3);
  transition: all var(--transition-base);
}

.ai-chat-input-container:focus-within {
  border-color: var(--color-brand-primary);
  box-shadow: 0 0 0 4px rgba(0, 136, 122, 0.1);
  background: white;
}

.ai-chat-input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.5;
  color: var(--color-text-primary);
  padding: 0;
  outline: none;
}

.ai-chat-input::placeholder {
  color: var(--color-text-tertiary);
}

.ai-chat-send-btn {
  width: 44px;
  height: 44px;
  background: var(--gradient-brand-primary);
  border: none;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-base);
  flex-shrink: 0;
}

.ai-chat-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.ai-chat-send-btn:not(:disabled):hover {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 4px 12px rgba(0, 136, 122, 0.3);
}

.ai-chat-send-btn:not(:disabled):active {
  transform: scale(0.95);
}

.ai-chat-send-btn:focus-visible {
  outline: 3px solid rgba(0, 136, 122, 0.5);
  outline-offset: 2px;
}

.ai-chat-send-btn .material-symbols-outlined {
  font-size: 22px;
  color: white;
}

/* Chat Input Help */
.ai-chat-input-help {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
  font-size: 12px;
  color: var(--color-text-tertiary);
}

.ai-chat-input-help .material-icons {
  font-size: 14px;
}

/* Enhanced Typing Indicator */
.typing-message {
  animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-typing-indicator-enhanced {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-4);
  background: white;
  border-radius: var(--radius-xl);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(0, 136, 122, 0.1);
}

.ai-typing-avatar {
  width: 40px;
  height: 40px;
  background: var(--gradient-brand-primary);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ai-typing-avatar .material-symbols-outlined {
  font-size: 22px;
  color: white;
}

.ai-typing-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.ai-typing-dots {
  display: flex;
  gap: 6px;
  align-items: center;
}

.ai-typing-dots span {
  width: 10px;
  height: 10px;
  background: var(--color-brand-primary);
  border-radius: var(--radius-full);
  animation: typingDot 1.4s infinite ease-in-out;
}

.ai-typing-dots span:nth-child(1) {
  animation-delay: 0s;
}

.ai-typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.ai-typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingDot {
  0%, 60%, 100% {
    transform: translateY(0) scale(1);
    opacity: 0.5;
  }
  30% {
    transform: translateY(-12px) scale(1.2);
    opacity: 1;
  }
}

.ai-typing-status {
  font-size: 12px;
  color: var(--color-text-secondary);
  font-style: italic;
}

/* Error Message */
.ai-chat-error {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  background: linear-gradient(135deg, #fee2e2 0%, #fecaca 50%, #fee2e2 100%);
  border: 2px solid #ef4444;
  border-radius: var(--radius-lg);
  color: #991b1b;
}

.ai-chat-error .material-symbols-outlined {
  font-size: 24px;
  color: #ef4444;
  flex-shrink: 0;
}

.ai-chat-error strong {
  display: block;
  font-weight: 600;
  margin-bottom: var(--space-1);
}

.ai-chat-error p {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
}

/* Recommendation Cards - Matches Dashboard Card Style */
.recommendations-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin-top: var(--space-3);
  width: 100%;
}

.recommendation-card {
  width: 100%;
  max-width: 325px;
  height: 225px;
  border-radius: var(--radius-lg); /* Match dashboard cards */
  padding: 20px; /* Match dashboard cards */
  color: white;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-start; /* Match dashboard cards */
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease; /* Match dashboard cards */
  box-shadow: var(--shadow-card);
  overflow: hidden;
  background: var(--color-brand-primary); /* Fallback background */
  text-decoration: none;
  will-change: transform, box-shadow;
  transform: translateZ(0);
  backface-visibility: hidden;
}

.recommendation-card:hover {
  transform: translateY(-2px); /* Match dashboard cards */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); /* Match dashboard cards */
}

.recommendation-card:active {
  transform: translateY(-1px); /* Match dashboard cards */
  transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
  border: none;
}

/* White background for icebreakers - Match dashboard cards */
.recommendation-card.white {
  background: white !important;
  color: #333;
  border: 1px solid #e5e7eb;
  box-shadow: var(--shadow-card);
}

.recommendation-card.white .rec-title {
  color: #333;
}

.recommendation-card.white .rec-tag {
  background: #e5e7eb; /* Match dashboard cards */
  color: #4b5563; /* Match dashboard cards */
}

.recommendation-card.white .rec-duration {
  background: #e5e7eb; /* Match dashboard cards */
  color: #4b5563; /* Match dashboard cards */
}

/* Card Header - Match dashboard cards */
.rec-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px; /* var(--space-4) */
}

.rec-header-left {
  display: flex;
  align-items: center;
  gap: 8px; /* var(--space-2) */
  flex-wrap: wrap;
}

/* Card Tag - Match dashboard cards */
.rec-tag {
  background: rgba(255, 255, 255, 0.2); /* Match dashboard cards exactly */
  color: white;
  padding: 4px 8px;
  border-radius: var(--radius-xl);
  font-size: 10px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  height: 24px;
  line-height: 1;
  border: none;
  transition: all 0.2s ease;
}

/* Card Title - Match dashboard cards */
.rec-title {
  font-size: 24px;
  font-weight: 500; /* Match dashboard cards */
  color: white;
  margin: 0;
  margin-top: auto; /* Push to bottom like dashboard cards */
  line-height: 1.2;
  letter-spacing: -0.3px;
  text-shadow: none;
  text-align: left;
  width: 100%;
}

/* Card Footer - Match dashboard cards */
.rec-footer {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

/* Card Duration - Match dashboard cards */
.rec-duration {
  background: rgba(255, 255, 255, 0.2); /* Match dashboard cards exactly */
  color: white;
  padding: 4px 8px;
  border-radius: var(--radius-xl);
  font-size: 10px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  height: 24px;
  line-height: 1;
}

.rec-duration .material-symbols-outlined {
  font-size: 14px;
}

/* Skeleton Loading */
.ai-card-skeleton {
  padding: var(--space-4);
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

.skeleton-header {
  width: 60%;
  height: 12px;
  background: linear-gradient(90deg, #e2e8f0 25%, #cbd5e0 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-3);
}

.skeleton-title {
  width: 80%;
  height: 16px;
  background: linear-gradient(90deg, #e2e8f0 25%, #cbd5e0 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-3);
}

.skeleton-text {
  width: 100%;
  height: 12px;
  background: linear-gradient(90deg, #e2e8f0 25%, #cbd5e0 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-2);
}

.skeleton-text.short {
  width: 70%;
}

.skeleton-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.skeleton-button {
  flex: 1;
  height: 36px;
  background: linear-gradient(90deg, #e2e8f0 25%, #cbd5e0 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* ========================================
   AI CHAT PROJECT DETAILS FORM
   ======================================== */

.ai-project-details-form {
  padding: var(--space-6);
  background: white;
  overflow-y: auto;
  height: calc(100vh - 80px - 80px); /* Full height minus header and input area */
}

.ai-project-form-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

.ai-form-back-btn {
  background: transparent;
  border: none;
  padding: var(--space-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: background-color 0.2s ease;
  color: var(--color-text-secondary);
}

.ai-form-back-btn:hover {
  background: var(--color-gray-100);
  color: var(--color-brand-primary);
}

.ai-form-back-btn:active {
  background: var(--color-gray-200);
}

.ai-form-back-btn .material-symbols-outlined {
  font-size: 24px;
}

.ai-project-form-header h4 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--color-text-primary);
}

.project-details-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.project-details-form .form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.project-details-form .form-label {
  font-weight: 500;
  font-size: 14px;
  color: var(--color-text-primary);
}

.project-details-form .form-select,
.project-details-form .form-textarea {
  padding: 12px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: inherit;
  color: var(--color-text-primary);
  background: white;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.project-details-form .form-select:focus,
.project-details-form .form-textarea:focus {
  outline: none;
  border-color: var(--color-brand-primary);
  box-shadow: 0 0 0 3px rgba(0, 136, 122, 0.1);
}

.project-details-form .form-select:hover,
.project-details-form .form-textarea:hover {
  border-color: var(--color-brand-primary-hover);
}

.project-details-form .form-textarea {
  resize: vertical;
  min-height: 80px;
}

.project-details-form .form-hint {
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-top: -4px;
}

.project-details-form .button-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.project-details-form .option-btn {
  flex: 0 0 auto;
  padding: 10px 16px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  background: white;
  color: var(--color-text-primary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.project-details-form .option-btn:hover {
  border-color: var(--color-brand-primary);
  color: var(--color-brand-primary);
  background: var(--color-brand-primary-light);
}

.project-details-form .option-btn:active {
  transform: scale(0.98);
}

.project-details-form .option-btn.selected {
  border-color: var(--color-brand-primary);
  background: var(--color-brand-primary);
  color: white;
  box-shadow: var(--shadow-sm);
}

.project-details-form .option-btn.selected:hover {
  background: var(--color-brand-primary-hover);
  border-color: var(--color-brand-primary-hover);
}

.project-details-form .form-actions {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
}

.project-details-form .btn-primary,
.project-details-form .btn-secondary {
  flex: 1;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.project-details-form .btn-primary {
  background: var(--color-brand-primary);
  color: white;
  box-shadow: var(--shadow-sm);
}

.project-details-form .btn-primary:hover {
  background: var(--color-brand-primary-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.project-details-form .btn-primary:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.project-details-form .btn-secondary {
  background: white;
  color: var(--color-text-primary);
  border: 1px solid var(--color-border);
}

.project-details-form .btn-secondary:hover {
  background: var(--color-gray-50);
  border-color: var(--color-brand-primary);
  color: var(--color-brand-primary);
}

.project-details-form .btn-secondary:active {
  background: var(--color-gray-100);
}

/* Mobile Responsive */
@media (max-width: 640px) {
  .ai-project-details-form {
    padding: var(--space-4);
  }

  .ai-project-form-header h4 {
    font-size: 18px;
  }

  .project-details-form .button-group {
    gap: var(--space-2);
  }

  .project-details-form .option-btn {
    padding: 8px 12px;
    font-size: 13px;
  }

  .project-details-form .form-actions {
    flex-direction: column;
  }

  .project-details-form .btn-primary,
  .project-details-form .btn-secondary {
    width: 100%;
  }
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

/* Centered modal content */
.modal-content.centered {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* Compact modal */
.modal-container.compact {
  max-width: 400px;
}

/* Wide modal */
.modal-container.wide {
  max-width: 800px;
}

/* Full-height modal */
.modal-container.full-height {
  max-height: 90vh;
}

/* No padding modal content */
.modal-content.no-padding {
  padding: 0;
}

/* Success state */
.modal-header.success {
  background: linear-gradient(135deg, var(--color-success) 0%, var(--color-success-hover) 100%);
}

/* Warning state */
.modal-header.warning {
  background: linear-gradient(135deg, var(--color-warning) 0%, #e68900 100%);
}

/* Error state */
.modal-header.error {
  background: linear-gradient(135deg, var(--color-danger) 0%, var(--color-danger-hover) 100%);
}

/* Info state */
.modal-header.info {
  background: linear-gradient(135deg, var(--color-info) 0%, #2563eb 100%);
}

/* Screen reader only content */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

/* Tablet */
@media (max-width: 768px) {
  .modal-container {
    width: 95%;
    max-width: 600px;
  }

  .modal-title {
    font-size: var(--font-size-lg);
  }

  .modal-footer {
    flex-direction: column;
    gap: var(--space-2);
  }

  .modal-footer-actions {
    width: 100%;
    flex-direction: column;
  }

  .modal-footer button {
    width: 100%;
  }

  .auth-modal-container {
    max-width: 100%;
    margin: 20px;
  }

  .auth-modal-header {
    padding: 16px 20px;
  }

  .auth-modal-content {
    padding: 20px 16px;
  }

  .share-modal {
    width: 95%;
    max-height: 90vh;
    margin: 16px;
  }

  .share-modal-header {
    padding: 16px 20px;
  }

  .share-modal-title {
    font-size: 18px;
  }

  .share-modal-content {
    padding: 20px;
  }

  .share-options {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .share-option {
    justify-content: flex-start;
    padding: 16px;
  }

  .share-link-input-group {
    flex-direction: column;
  }

  .share-link-copy {
    width: 100%;
    padding: 14px;
  }

  /* AI Chat Modal - 90% width on tablet */
  .ai-chat-modal {
    width: 90%;
    max-width: 500px;
  }

  .ai-chat-float-button {
    bottom: 20px;
    right: 20px;
  }

  .welcome-action-buttons {
    gap: var(--space-2);
  }

  .welcome-action-btn {
    font-size: 13px;
  }
}

/* Mobile */
@media (max-width: 480px) {
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .modal-container {
    width: 100%;
    max-width: 100%;
    max-height: 100vh;
    height: auto;
    border-radius: 0;
    animation: slideUpMobile var(--transition-base) forwards;
  }

  @keyframes slideUpMobile {
    from {
      transform: translateY(100%);
    }
    to {
      transform: translateY(0);
    }
  }

  .modal-header {
    border-radius: 0;
  }

  .modal-content {
    max-height: calc(100dvh - 220px);  /* Use dynamic viewport height */
    max-height: calc(100vh - 220px);   /* Fallback for older browsers */
  }

  /* Adjust when keyboard is likely visible (input/textarea focused) */
  .modal-content:has(input:focus),
  .modal-content:has(textarea:focus) {
    max-height: calc(50vh - 100px);
  }

  .modal-title {
    font-size: var(--font-size-md);
  }

  .auth-modal-overlay {
    padding: 0;
  }

  .auth-modal-container {
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100vh;
    border-radius: 0;
    margin: 0;
  }

  .auth-modal-header {
    padding: 12px 16px;
    border-radius: 0;
  }

  .auth-modal-content {
    padding: 16px 12px;
  }

  .auth-modal-footer {
    flex-direction: column-reverse;
  }

  .auth-footer-actions {
    flex-direction: column;
  }

  .auth-footer-actions .btn-primary,
  .auth-footer-actions .btn-secondary {
    width: 100%;
  }

  .form-group-checkbox {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .social-login-section {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .social-login-btn {
    padding: 14px;
    justify-content: flex-start;
  }

  .share-modal {
    width: 100%;
    height: 100%;
    max-height: 100vh;
    border-radius: 0;
  }

  .share-modal-header {
    padding: 16px;
  }

  .share-modal-content {
    padding: 16px;
  }

  .share-content-preview {
    padding: 12px;
  }

  /* AI Chat Modal - Full screen on mobile */
  .ai-chat-modal {
    width: 100%;
    height: 100vh;
    border-radius: 0;
  }

  .ai-chat-header {
    padding: var(--space-4);
  }

  .ai-chat-title h3 {
    font-size: var(--font-size-md);
  }

  .ai-chat-status {
    font-size: var(--font-size-xs);
  }

  .ai-chat-avatar {
    width: 36px;
    height: 36px;
  }

  .ai-chat-avatar .material-icons {
    font-size: 20px;
  }

  .ai-chat-float-button {
    bottom: 16px;
    right: 16px;
    width: 52px;
    height: 52px;
  }

  .ai-chat-button-icon {
    font-size: 24px;
  }

  .welcome-action-buttons {
    gap: var(--space-2);
  }

  .welcome-action-btn {
    padding: var(--space-3);
    font-size: 13px;
  }

  .ai-chat-messages {
    padding: var(--space-4);
    gap: var(--space-4);
  }

  .ai-chat-input-area {
    padding: var(--space-4);
  }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

/* Focus trap */
.modal-overlay[aria-hidden="true"] {
  display: none;
}

.modal-container:focus {
  outline: none;
}

/* Keyboard navigation */
.modal-close-btn:focus-visible,
.modal-footer button:focus-visible,
.share-modal:focus-visible,
.share-modal-close:focus-visible,
.share-option:focus-visible,
.share-link-copy:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .modal-overlay {
    background: rgba(0, 0, 0, 0.8);
  }

  .modal-container,
  .auth-modal-container,
  .share-modal,
  .ai-chat-modal {
    border: 2px solid #000;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .modal-overlay,
  .modal-container,
  .auth-modal-container,
  .auth-modal-overlay,
  .share-modal-overlay,
  .share-modal,
  .ai-chat-float-button,
  .ai-chat-modal {
    animation: none;
    transition: none;
  }

  .modal-container,
  .auth-modal-container,
  .share-modal,
  .ai-chat-modal {
    transform: none;
  }
}

/* ========================================
   CONTACT MODAL - IMPROVED STYLING
   ======================================== */

/* Contact Modal - Wider Layout */
.modal-contact .modal-content-wide {
  max-width: 700px;
  width: 95%;
  background: white;
  border-radius: var(--radius-2xl);
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: modalSlideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(50px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Contact Modal Header - Enhanced */
.modal-contact .modal-header {
  background: linear-gradient(135deg, #00887A 0%, #006B5E 100%);
  padding: 32px;
  position: relative;
  overflow: hidden;
}

.modal-contact .modal-header::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
  animation: rotate 20s linear infinite;
}

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

.modal-contact .modal-title {
  font-size: 28px;
  font-weight: 700;
  color: white;
  margin: 0;
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-contact .modal-title::before {
  content: 'mail';
  font-family: 'Material Symbols Outlined';
  font-size: 32px;
  color: rgba(255, 255, 255, 0.9);
}

.modal-contact .modal-close {
  position: absolute;
  top: 24px;
  right: 24px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: none;
  border-radius: var(--radius-md);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  z-index: 2;
  flex-shrink: 0;
  padding: 0;
}

.modal-contact .modal-close:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: rotate(90deg) scale(1.05);
}

.modal-contact .modal-close:active {
  transform: rotate(90deg) scale(0.95);
}

.modal-contact .modal-close:focus-visible {
  outline: 2px solid white;
  outline-offset: 2px;
}

.modal-contact .modal-close .material-symbols-outlined {
  font-size: 20px;
  color: white;
}

/* Contact Modal Body - Improved Layout */
.modal-contact .modal-body {
  padding: 40px;
  background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
  max-height: 70vh;
  overflow-y: auto;
}

.modal-contact .modal-body::-webkit-scrollbar {
  width: 8px;
}

.modal-contact .modal-body::-webkit-scrollbar-track {
  background: #f0f0f0;
  border-radius: 10px;
}

.modal-contact .modal-body::-webkit-scrollbar-thumb {
  background: #00887A;
  border-radius: 10px;
}

.modal-contact .modal-body::-webkit-scrollbar-thumb:hover {
  background: #006B5E;
}

/* Contact Form Groups - Better Spacing */
.modal-contact .form-group {
  margin-bottom: 24px;
}

.modal-contact .form-label {
  font-size: 15px;
  font-weight: 600;
  color: #2d3748;
  margin-bottom: 8px;
  display: block;
}

.modal-contact .required {
  color: #ef4444;
  margin-left: 4px;
}

/* Input Groups - Modern Design */
.modal-contact .input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.modal-contact .input-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 22px;
  color: #00887A;
  z-index: 1;
  pointer-events: none;
}

.modal-contact .form-input {
  width: 100%;
  padding: 14px 16px 14px 52px;
  border: 2px solid #e2e8f0;
  border-radius: var(--radius-lg);
  font-size: 15px;
  color: #2d3748;
  background: white;
  transition: all 0.3s ease;
  font-family: inherit;
}

.modal-contact .form-input:focus {
  outline: none;
  border-color: #00887A;
  box-shadow: 0 0 0 4px rgba(0, 136, 122, 0.1);
  background: #ffffff;
}

.modal-contact .form-input::placeholder {
  color: #a0aec0;
}

/* Textarea Specific - Icon Positioning */
.modal-contact .form-textarea {
  padding: 14px 16px 14px 52px;
  min-height: 140px;
  resize: vertical;
  line-height: 1.6;
}

.modal-contact .input-group .input-icon + .form-textarea {
  padding-left: 52px;
}

/* Submit Button - Enhanced */
.modal-contact .btn-primary {
  width: 100%;
  padding: 16px 32px;
  background: linear-gradient(135deg, #00887A 0%, #006B5E 100%);
  border: none;
  border-radius: var(--radius-lg);
  font-size: 16px;
  font-weight: 600;
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 8px;
  box-shadow: 0 4px 12px rgba(0, 136, 122, 0.3);
  position: relative;
  overflow: hidden;
}

.modal-contact .btn-primary::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.modal-contact .btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 136, 122, 0.4);
}

.modal-contact .btn-primary:hover::before {
  left: 100%;
}

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

/* Form Messages - Improved */
.modal-contact .form-message {
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  font-size: 15px;
  font-weight: 500;
  animation: messageSlideIn 0.3s ease;
}

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

.modal-contact .form-message-success {
  background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
  border: 2px solid #10b981;
  color: #065f46;
}

.modal-contact .form-message-error {
  background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
  border: 2px solid #ef4444;
  color: #991b1b;
}

/* Responsive - Contact Modal */
@media (max-width: 768px) {
  .modal-contact .modal-content-wide {
    max-width: 100%;
    width: 100%;
    margin: 0;
    border-radius: 0;
    height: 100vh;
  }

  .modal-contact .modal-header {
    padding: 24px;
    border-radius: 0;
  }

  .modal-contact .modal-title {
    font-size: 24px;
  }

  .modal-contact .modal-body {
    padding: 24px;
    max-height: calc(100vh - 100px);
  }

  .modal-contact .form-group {
    margin-bottom: 20px;
  }
}

@media (max-width: 480px) {
  .modal-contact .modal-header {
    padding: 20px;
  }

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

  .modal-contact .modal-title::before {
    font-size: 24px;
  }

  .modal-contact .modal-body {
    padding: 20px;
  }

  .modal-contact .form-input,
  .modal-contact .form-textarea {
    font-size: 14px;
  }
}

/* ========================================
   PROMOTIONAL MODAL
   ======================================== */

.promotional-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: transparent;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
  pointer-events: none;
}

.promotional-modal-overlay .promotional-modal {
  pointer-events: auto;
}

.promotional-modal {
  background: white;
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.2);
  max-width: 900px;
  width: 100%;
  max-height: fit-content;
  overflow: hidden;
  position: relative;
  animation: modalSlideIn 0.3s ease-out;
  display: flex;
  flex-direction: column;
}

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

.promotional-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 10;
}

.promotional-modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}

.promotional-modal-close .material-symbols-outlined {
  font-size: 20px;
  color: white;
}

.promotional-modal-content {
  padding: 0;
  flex: 1;
  overflow: hidden;
}

.promotional-header {
  text-align: center;
  margin-bottom: 32px;
  padding: 32px 24px;
  background: linear-gradient(135deg, var(--color-brand-primary) 0%, var(--color-brand-primary-hover) 100%);
}

.promotional-header h2 {
  font-size: 32px;
  font-weight: 700;
  color: white;
  margin: 0;
  line-height: 1.2;
}

.promotional-subtitle {
  font-size: 18px;
  color: rgba(255, 255, 255, 0.9);
  margin: 8px 0 0 0;
  font-weight: 400;
}

.promotional-sections {
  margin-bottom: 32px;
  padding: 24px;
  display: flex;
  gap: 20px;
  align-items: stretch;
}

.promotional-section {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 16px;
  padding: 24px;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  transition: all 0.2s ease;
  align-items: center;
  text-align: center;
}

.promotional-section:hover {
  border-color: var(--color-brand-primary);
  box-shadow: 0 4px 16px rgba(0, 136, 122, 0.1);
}

.promotional-section .section-icon {
  font-size: 48px;
  color: var(--color-brand-primary);
  flex-shrink: 0;
}

.promotional-section h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--color-brand-primary);
  margin: 0;
  line-height: 1.3;
}

.promotional-section p {
  font-size: 14px;
  line-height: 1.5;
  color: #555;
  margin: 0;
  flex: 1;
}

.promotional-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  cursor: pointer;
  color: white !important;
  background: var(--color-brand-primary);
  box-shadow: 0 2px 8px rgba(0, 136, 122, 0.3);
}

.promotional-btn:hover {
  background: var(--color-brand-primary-hover);
  color: #e5e7eb !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 136, 122, 0.4);
}

.promotional-btn .material-symbols-outlined {
  font-size: 18px;
}

/* Tablet */
@media (max-width: 768px) {
  .promotional-modal-overlay {
    padding: 16px;
  }

  .promotional-modal {
    max-height: 95vh;
    max-width: 100%;
  }

  .promotional-header h2 {
    font-size: 26px;
  }

  .promotional-subtitle {
    font-size: 16px;
  }

  .promotional-sections {
    flex-direction: column;
    padding: 20px;
  }

  .promotional-section {
    padding: 20px;
  }

  .promotional-section h3 {
    font-size: 16px;
  }

  .promotional-section p {
    font-size: 13px;
  }

  .promotional-btn {
    padding: 10px 20px;
    font-size: 14px;
  }
}

/* Mobile */
@media (max-width: 480px) {
  .promotional-modal-overlay {
    padding: 12px;
  }

  .promotional-header {
    padding: 24px 16px;
    margin-bottom: 24px;
  }

  .promotional-header h2 {
    font-size: 24px;
  }

  .promotional-subtitle {
    font-size: 14px;
  }

  .promotional-sections {
    padding: 16px;
    gap: 16px;
  }

  .promotional-section {
    padding: 16px;
  }
}
