/* Motivation Environment Styling - Matching Example Environment */

.motivation-environment {
  margin: 1.5rem 0;
  border: 1px solid #dee2e6;
  background-color: #f8f9fa;
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.3s ease;
}

.motivation-header {
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
  background-color: #fff;
  transition: background-color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.motivation-header:hover {
  background-color: #dee2e6;
}

.motivation-header:active {
  background-color: #ced4da;
}

.motivation-title {
  font-weight: 600;
  font-size: 1rem;
  color: #495057;
  display: flex;
  align-items: center;
  gap: 8px;
}

.motivation-icon {
  stroke: #495057;
  flex-shrink: 0;
}

.motivation-preview {
  padding: 16px;
  color: #6c757d;
  font-size: 0.95rem;
  line-height: 1.6;
  border-top: 1px solid #dee2e6;
  display: block; /* Visible by default */
  max-height: 150px; /* Limit preview height */
  overflow: hidden; /* Crop overflow */
  position: relative;
  font-style: italic;
}

.motivation-preview p:last-child {
  margin-bottom: 0;
}

/* Add a fade-out effect at the bottom of the preview when cropped */
.motivation-preview::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40px;
  background: linear-gradient(to bottom, transparent, #f8f9fa);
  pointer-events: none;
}

.motivation-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
}

.motivation-content.collapsed {
  max-height: 0;
  padding: 0;
}

.motivation-content.expanded {
  max-height: none;
  padding: 16px;
  border-top: 1px solid #dee2e6;
  background-color: #ffffff;
}

.motivation-body {
  color: #495057;
  font-size: 0.95rem;
  line-height: 1.6;
}

.motivation-body p:first-child {
  margin-top: 0;
}

.motivation-body p:last-child {
  margin-bottom: 0;
}

/* Dark mode support */
:root[data-theme="dark"] .motivation-environment {
  background-color: var(--color-bg-tertiary);
  border-color: var(--color-border-strong);
}

:root[data-theme="dark"] .motivation-header {
  background-color: var(--color-bg-hover);
}

:root[data-theme="dark"] .motivation-header:hover {
  background-color: var(--color-border-strong);
}

:root[data-theme="dark"] .motivation-header:active {
  background-color: var(--color-border-strong);
}

:root[data-theme="dark"] .motivation-title {
  color: var(--color-text-primary);
}

:root[data-theme="dark"] .motivation-icon {
  stroke: var(--color-text-primary);
}

:root[data-theme="dark"] .motivation-preview {
  color: var(--color-text-medium);
  border-top-color: var(--color-border-strong);
}

:root[data-theme="dark"] .motivation-preview::after {
  background: linear-gradient(to bottom, transparent, var(--color-bg-tertiary));
}

:root[data-theme="dark"] .motivation-content.expanded {
  background-color: var(--color-bg-secondary);
  border-top-color: var(--color-border-strong);
}

:root[data-theme="dark"] .motivation-body {
  color: var(--color-text-primary);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .motivation-environment {
    margin: 1rem 0;
  }
  
  .motivation-header {
    padding: 10px 12px;
  }
  
  .motivation-title {
    font-size: 0.95rem;
  }
  
  .motivation-preview,
  .motivation-body {
    padding: 12px;
    font-size: 0.9rem;
  }
  
  .motivation-content.expanded {
    padding: 12px;
  }
}

/* Smooth animation for content */
@keyframes motivationExpand {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.motivation-content.expanded .motivation-body {
  animation: motivationExpand 0.3s ease;
}

/* Print styles */
@media print {
  .motivation-environment {
    page-break-inside: avoid;
    border-left: 3px solid #495057;
  }
  
  .motivation-header {
    background-color: transparent;
    cursor: default;
  }
  
  .motivation-preview {
    display: none !important;
  }
  
  .motivation-content {
    display: block !important;
    max-height: none !important;
    padding: 12px !important;
  }
  
  .motivation-content.collapsed {
    display: block !important;
    max-height: none !important;
  }
}
