/**
 * Admonitions (Callouts)
 * Styled callout boxes for highlighting important information
 */

/* Base Admonition Styles */
.admonition {
  position: relative;
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  border-left: 4px solid var(--color-border);
  border-radius: 0 var(--border-radius-large) var(--border-radius-large) 0;
  background-color: var(--color-bg-secondary);
  box-shadow: var(--elevation-card);
  transition: all var(--transition-base);
}

.admonition:hover {
  box-shadow: var(--elevation-card-hover);
  transform: translateY(-1px);
}

/* Admonition Title */
.admonition-title {
  margin: 0 0 0.75rem 0;
  font-size: var(--text-body);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  letter-spacing: var(--letter-spacing-normal);
}

.admonition-title::before {
  content: '';
  display: inline-block;
  width: 20px;
  height: 20px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  flex-shrink: 0;
}

/* Admonition Content */
.admonition > p {
  margin: 0.75rem 0;
}

.admonition > p:first-of-type {
  margin-top: 0;
}

.admonition > p:last-child {
  margin-bottom: 0;
}

/* Remove top margin from first element after title */
.admonition-title + * {
  margin-top: 0;
}

/* Spacing for other direct children */
.admonition > *:not(.admonition-title):not(p) {
  margin-top: 0.75rem;
  margin-bottom: 0.75rem;
}

.admonition > *:not(.admonition-title):first-of-type {
  margin-top: 0;
}

.admonition > *:last-child {
  margin-bottom: 0;
}

/* List styling in admonitions */
.admonition ul,
.admonition ol {
  padding-left: var(--space-8);
  margin: 0.75rem 0;
}

.admonition ul:first-child,
.admonition ol:first-child {
  margin-top: 0;
}

.admonition ul {
  list-style-type: disc;
}

.admonition ol {
  list-style-type: decimal;
}

.admonition li {
  margin: var(--space-1) 0;
}

/* Code blocks in admonitions */
.admonition pre {
  margin: 0.75rem 0;
}

.admonition pre:first-child {
  margin-top: 0;
}

.admonition pre:last-child {
  margin-bottom: 0;
}

.admonition code {
  background-color: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .admonition code {
  background-color: rgba(255, 255, 255, 0.1);
}

/* ============================================
   ADMONITION TYPES
   ============================================ */

/* Note / Info */
.admonition.note,
.admonition.info {
  border-left-color: var(--color-info-border);
  background-color: var(--color-info-bg);
}

.admonition.note .admonition-title,
.admonition.info .admonition-title {
  color: var(--color-info-text);
}

.admonition.note .admonition-title::before,
.admonition.info .admonition-title::before {
  content: 'ℹ️';
  font-size: var(--text-lg);
}

[data-theme="dark"] .admonition.note,
[data-theme="dark"] .admonition.info {
  background-color: var(--color-info-bg);
  border-left-color: var(--color-info-border);
}

[data-theme="dark"] .admonition.note .admonition-title,
[data-theme="dark"] .admonition.info .admonition-title {
  color: var(--color-info-text);
}

/* Tip / Success */
.admonition.tip,
.admonition.success {
  border-left-color: var(--color-success-border);
  background-color: var(--color-success-bg);
}

.admonition.tip .admonition-title,
.admonition.success .admonition-title {
  color: var(--color-success-text);
}

.admonition.tip .admonition-title::before {
  content: '💡';
  font-size: var(--text-lg);
}

.admonition.success .admonition-title::before {
  content: '✅';
  font-size: var(--text-lg);
}

[data-theme="dark"] .admonition.tip,
[data-theme="dark"] .admonition.success {
  background-color: var(--color-success-bg);
  border-left-color: var(--color-success-border);
}

[data-theme="dark"] .admonition.tip .admonition-title,
[data-theme="dark"] .admonition.success .admonition-title {
  color: var(--color-success-text);
}

/* Warning / Caution */
.admonition.warning,
.admonition.caution {
  border-left-color: var(--color-warning-border);
  background-color: var(--color-warning-bg);
}

.admonition.warning .admonition-title,
.admonition.caution .admonition-title {
  color: var(--color-warning-text);
}

.admonition.warning .admonition-title::before,
.admonition.caution .admonition-title::before {
  content: '⚠️';
  font-size: var(--text-lg);
}

[data-theme="dark"] .admonition.warning,
[data-theme="dark"] .admonition.caution {
  background-color: var(--color-warning-bg);
  border-left-color: var(--color-warning-border);
}

[data-theme="dark"] .admonition.warning .admonition-title,
[data-theme="dark"] .admonition.caution .admonition-title {
  color: var(--color-warning-text);
}

/* Danger / Error */
.admonition.danger,
.admonition.error {
  border-left-color: var(--color-error-border);
  background-color: var(--color-error-bg);
}

.admonition.danger .admonition-title,
.admonition.error .admonition-title {
  color: var(--color-error-text);
}

.admonition.danger .admonition-title::before,
.admonition.error .admonition-title::before {
  content: '🛑';
  font-size: var(--text-lg);
}

[data-theme="dark"] .admonition.danger,
[data-theme="dark"] .admonition.error {
  background-color: var(--color-error-bg);
  border-left-color: var(--color-error-border);
}

[data-theme="dark"] .admonition.danger .admonition-title,
[data-theme="dark"] .admonition.error .admonition-title {
  color: var(--color-error-text);
}

/* Example */
.admonition.example {
  border-left-color: #8b5cf6; /* violet-500 */
  background-color: #f5f3ff; /* violet-50 */
}

.admonition.example .admonition-title {
  color: #7c3aed; /* violet-600 */
}

.admonition.example .admonition-title::before {
  content: '📝';
  font-size: var(--text-lg);
}

[data-theme="dark"] .admonition.example {
  border-left-color: #a78bfa; /* violet-400 */
  background-color: rgba(139, 92, 246, 0.1);
}

[data-theme="dark"] .admonition.example .admonition-title {
  color: #c4b5fd; /* violet-300 */
}

/* ============================================
   COLLAPSIBLE ADMONITIONS
   ============================================ */

.admonition.collapsible {
  cursor: pointer;
}

.admonition.collapsible .admonition-title::after {
  content: '▼';
  margin-left: auto;
  font-size: var(--text-sm);
  transition: transform var(--transition-fast) var(--ease-out);
}

.admonition.collapsible.collapsed .admonition-title::after {
  transform: rotate(-90deg);
}

.admonition.collapsible.collapsed > *:not(.admonition-title) {
  display: none;
}

/* ============================================
   NESTED ADMONITIONS
   ============================================ */

.admonition .admonition {
  margin-top: var(--space-4);
  margin-bottom: var(--space-4);
}

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

@media (max-width: 640px) {
  .admonition {
    padding: var(--space-3) var(--space-4);
    margin: var(--space-4) 0;
  }

  .admonition-title {
    font-size: var(--text-sm);
  }
}
