/* Filter and View Button States */
.filter-btn {
    background-color: #f3f4f6;
    color: #6b7280;
}
.filter-btn.active {
    background-color: #3b82f6;
    color: white;
}
.view-btn {
    background-color: #f3f4f6;
    color: #6b7280;
}
.view-btn.active {
    background-color: #374151;
    color: white;
}

/* Label Filter States */
.label-filter {
    transition: all 0.2s ease;
    border-width: 1px;
    position: relative;
}

.label-filter.active {
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
    transform: scale(1.05);
    font-weight: 600;
}

.label-filter.cursor-not-allowed:hover {
    transform: none !important;
}

.label-filter:not(.cursor-not-allowed):hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Category Filter States */
.category-filter.active {
    background-color: rgba(59, 130, 246, 0.1);
    border-left: 3px solid #3b82f6;
    font-weight: 600;
}

/* Text Utilities */
.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    /* Standard property for broader compatibility */
    line-clamp: 3;
    overflow: hidden;
}

/* Modal Content Typography */
#modalContent h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    color: #111827;
}
#modalContent h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: #1f2937;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 0.5rem;
}
#modalContent h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 1.25rem;
    margin-bottom: 1rem;
    color: #374151;
}
#modalContent h4 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    color: #4b5563;
}
#modalContent p {
    margin-bottom: 1rem;
    line-height: 1.6;
    color: #4b5563;
}
#modalContent ul, #modalContent ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}
#modalContent li {
    margin-bottom: 0.5rem;
}
#modalContent code {
    background-color: #f3f4f6;
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-family: monospace;
    font-size: 0.9em;
}
#modalContent pre {
    margin-bottom: 1rem;
    background-color: #1f2937;
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
}

/* Type Badge (Rules/Workflows) */
.type-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem; /* ~6px */
    height: 22px; /* consistent, slightly smaller */
    padding: 0 8px; /* horizontal only */
    border-radius: 9999px;
    font-size: 0.6875rem; /* ~11px */
    line-height: 1; /* avoid vertical expansion */
    font-weight: 600;
    letter-spacing: 0.02em;
    border: 1px solid var(--type-border);
    background: var(--type-bg);
    color: var(--type-text);
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    white-space: nowrap;
}
.type-badge i {
    font-size: 0.75rem; /* ~12px, visually balanced with text */
}
.type-badge--rules {
    --type-bg: #eff6ff;     /* blue-50 */
    --type-border: #bfdbfe; /* blue-200 */
    --type-text: #1d4ed8;   /* blue-700 */
}
.type-badge--workflows {
    --type-bg: #f3e8ff;     /* purple-50 */
    --type-border: #d8b4fe; /* purple-300 */
    --type-text: #6d28d9;   /* purple-700 */
}

/* Modal layout adjustments */
#modalScrollArea {
    /* Let the content area flex and handle its own scrolling within the modal */
    max-height: none;
    flex: 1 1 auto;
    min-height: 0; /* critical so child can shrink within flex parent */
}

/* Modal content spacing + typography tweaks */
#modalContent > h1:first-child {
    /* Hide top-level markdown title since modal already shows it */
    display: none;
}
#modalContent > :first-child {
    /* Avoid extra gap at top of modal content */
    margin-top: 0 !important;
}
#modalContent h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    color: #111827;
}
#modalContent h2 {
    font-size: 1.375rem;
    font-weight: 600;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    color: #1f2937;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 0.375rem;
}
#modalContent h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-top: 0.75rem;
    margin-bottom: 0.5rem;
    color: #374151;
}
#modalContent h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-top: 0.5rem;
    margin-bottom: 0.375rem;
    color: #4b5563;
}
#modalContent p {
    margin-bottom: 0.75rem;
    line-height: 1.7;
    color: #374151;
}
#modalContent ul, #modalContent ol {
    margin-bottom: 0.75rem;
    padding-left: 1.25rem;
}
#modalContent li {
    margin-bottom: 0.25rem;
}
#modalContent code {
    background-color: #f3f4f6;
    padding: 0.15rem 0.35rem;
    border-radius: 0.25rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.9em;
}

/* Code blocks inside modal content: larger, more readable, vertical scroll, wrap long lines */
#modalContent pre {
    margin: 0.75rem 0 1rem 0;
    background-color: #f3f4f6; /* match raw viewer */
    color: #111827;
    padding: 1rem 1.25rem;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
    max-height: 28rem; /* taller blocks */
    overflow: auto; /* vertical and horizontal if needed */
}
#modalContent pre code {
    display: block;
    white-space: pre-wrap; /* wrap long lines to avoid sideways scroll */
    word-break: break-word;
    font-size: 0.875rem;
    line-height: 1.6;
}

/* Raw section: allow taller preview similar to code blocks */
#modalRawPre {
    max-height: 28rem;
}

/* Modal card: constrain overall modal height to viewport minus overlay padding
   The overlay uses p-4 (1rem top + bottom), so subtract 2rem. */
#customizationModal .modal-card {
    max-height: calc(100vh - 2rem);
    display: flex;
    flex-direction: column;
}
