/* Modern Details/Summary Styling */

details {
  background: #f6fff6;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 0;
  margin-bottom: 12px;
  transition: all 0.2s ease;
}

/* Striped/Alternating backgrounds */
details:nth-child(odd) {
  background: #ffffff;
}

details:nth-child(even) {
  background: #f9fafb;
}

details:nth-child(even) summary:hover {
  background: #f3f4f6;
}

details:nth-child(even)[open] > summary {
  background: #f3f4f6;
}

details:hover {
  border-color: #d1d5db;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

details[open] {
  border-color: #3b82f6;
  box-shadow: 0 4px 6px rgba(59, 130, 246, 0.1);
}

summary {
  padding: 16px 20px;
  cursor: pointer;
  user-select: none;
  font-weight: 600;
  color: #1f2937;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: all 0.2s ease;
  list-style: none;
}

/* Remove default marker */
summary::-webkit-details-marker {
  display: none;
}

summary::after {
  content: '+';
  display: inline-block;
  width: 16px;
  height: 16px;
  transition: transform 0.3s ease;
  color: #6b7280;
  font-size: 20px;
  font-weight: 400;
  flex-shrink: 0;
  line-height: 1;
}

details[open] > summary::after {
  content: '−';
  color: #3b82f6;
}

summary:hover {
  background: #f9fafb;
  color: #3b82f6;
}

details[open] > summary {
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
  color: #3b82f6;
}

/* Content area */
details > *:not(summary) {
  padding: 20px;
  padding-left: 40px;
  color: #4b5563;
  line-height: 1.6;
  animation: slideDown 0.3s ease;
}

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

/* Nested details */
details details {
  margin: 12px 0 0 0;
  border-color: #e5e7eb;
}

details details summary {
  padding: 12px 16px;
  font-size: 0.95em;
}

/* Focus states for accessibility */
summary:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

summary:focus:not(:focus-visible) {
  outline: none;
}

summary:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* Optional: Colored variants */
details.success {
  border-color: #10b981;
}

details.success[open] {
  box-shadow: 0 4px 6px rgba(16, 185, 129, 0.1);
}

details.success[open] > summary {
  border-bottom-color: #d1fae5;
}

details.warning {
  border-color: #f59e0b;
}

details.warning[open] {
  box-shadow: 0 4px 6px rgba(245, 158, 11, 0.1);
}

details.info {
  border-color: #3b82f6;
}

details.info[open] {
  box-shadow: 0 4px 6px rgba(59, 130, 246, 0.1);
}