/**
 * Kommunale Exzellenz Suite - CSS Utility Classes
 * ==================================================
 * Central utility classes to eliminate code duplication across product CSS files
 * Created: September 24, 2025
 */

/*
   CSS VARIABLES - Layout and behavior-specific
 */
:root {
    /* Spacing: defined in basis.css (rem — scales with accessibility font-size preference) */

    /* Border Radius — see theme.css for data-ui-shape presets (sharp/soft/rounded) */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;
    --radius-pill: 9999px;  /* Exempt from shape presets — pills always stay pill-shaped */

    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;

    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 8px rgba(0, 61, 131, 0.2);
    --shadow-lg: 0 5px 15px rgba(0, 61, 131, 0.2);
}

/*
   BUTTON UTILITIES - Consistent button styling across all products
 */

/* Base button styles - Shared by all button types (no HTML changes needed) */
.btn-primary,
.btn-secondary,
.btn-cancel,
.btn-primary-active {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition-normal);
    text-decoration: none;
    text-align: center;
    outline: none;
    line-height: 1.5;
}

.btn-primary:disabled,
.btn-secondary:disabled,
.btn-cancel:disabled,
.btn-primary-active:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary:hover:not(:disabled),
.btn-secondary:hover:not(:disabled),
.btn-cancel:hover:not(:disabled),
.btn-primary-active:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Button-specific styles - Only unique properties */

/* Primary button - Main actions */
.btn-primary {
    background-color: var(--primary-color);
    color: var(--color-white);
    border-color: var(--primary-color);
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-color-dark);
    border-color: var(--primary-color-dark);
}

/* Secondary button - Alternative actions */
.btn-secondary {
    background-color: var(--color-gray-light);
    color: var(--color-text);
    border-color: var(--color-gray-dark);
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--color-gray);
    box-shadow: var(--shadow-md); /* Override default shadow */
}


/* Cancel button - Negative/abort actions */
.btn-cancel {
    background-color: var(--color-gray-light);
    color: var(--color-text);
    border: 1px solid var(--color-gray-dark); /* Override 2px transparent */
}

.btn-cancel:hover:not(:disabled) {
    background-color: var(--color-gray);
    box-shadow: var(--shadow-sm); /* Override default shadow */
}

/* Size variants */
.btn-sm {
    padding: 6px 12px;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 1.1rem;
}

/* Full width button */
.btn-block {
    width: 100%;
}

/* Primary button with active/expanded state - Orange when active */
.btn-primary-active {
    background-color: var(--primary-color);
    color: var(--color-white);
    border-color: var(--primary-color);
}

.btn-primary-active:hover:not(:disabled) {
    background-color: var(--primary-color-dark);
    border-color: var(--primary-color-dark);
}

/* Active state - Orange branding color */
.btn-primary-active.active {
    background-color: var(--color-action); /* #FF6B35 - Action orange */
    color: var(--color-white);
    border-color: var(--color-action-hover); /* Darker orange for border */
    box-shadow: 0 4px 12px color-mix(in srgb, var(--color-action) 30%, transparent);
}

.btn-primary-active.active:hover {
    background-color: var(--color-action-hover); /* Darker orange on hover */
    border-color: var(--color-action-hover); /* Even darker border */
    transform: translateY(-2px);
    box-shadow: 0 6px 16px color-mix(in srgb, var(--color-action) 40%, transparent);
}

/*
   FORM UTILITIES - Consistent form styling
 */

.form-group {
    margin-bottom: var(--spacing-md);
}

.form-label {
    display: block;
    margin-bottom: var(--spacing-xs);
    font-weight: 600;
    color: var(--color-text);
    font-size: 0.9rem;
}

.form-input {
    width: 100%;
    padding: 8px 12px;
    font-size: 0.95rem;
    border: 1px solid #ced4da;
    border-radius: var(--radius-sm);
    background-color: var(--color-white);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 61, 131, 0.1);
}

.form-input:disabled {
    background-color: var(--color-gray-light);
    cursor: not-allowed;
}

.form-textarea {
    width: 100%;
    padding: 8px 12px;
    font-size: 0.95rem;
    border: 1px solid #ced4da;
    border-radius: var(--radius-sm);
    resize: vertical;
    min-height: 100px;
}

.form-select {
    width: 100%;
    padding: 8px 12px;
    font-size: 0.95rem;
    border: 1px solid #ced4da;
    border-radius: var(--radius-sm);
    background-color: var(--color-white);
    cursor: pointer;
}

/* Required-field marker rendered by <x-form-field>. Decorative only — the
   actual requiredness is announced to assistive tech via aria-required on the
   control, so the "*" carries aria-hidden. Kept muted (color-free convention). */
.form-required {
    color: var(--color-text-muted);
    font-weight: 400;
}

/* Canonical field hint / help text under a control (rendered by
   <x-form-field help="...">). Feature-scoped overrides such as
   .suggestion-create-form .field-hint remain more specific and still win. */
.field-hint {
    margin-top: var(--spacing-xs);
    font-size: 0.8rem;
    color: var(--color-text-muted);
    line-height: 1.4;
}

/* Form container for expandable forms */
.form-container {
    background-color: var(--primary-color);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-md);
}

.form-container .form-input,
.form-container .form-textarea,
.form-container .form-select {
    background-color: var(--color-white);
}

/* Form actions - button container */
.form-actions {
    display: flex;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-md);
}

/* Form actions - buttons should take equal width */
.form-actions .btn-primary,
.form-actions .btn-secondary,
.form-actions .btn-cancel {
    flex: 1;
}

/*
   HIERARCHY UTILITIES - Consistent hierarchy visualization
 */

.hierarchy-item {
    padding: var(--spacing-sm) var(--spacing-md);
    margin-bottom: 2px;
    background-color: var(--color-white);
    border-left: 6px solid transparent;
    transition: all var(--transition-fast);
}

/* Level-based border colors */
.hierarchy-level-0 {
    border-left-color: var(--primary-color);
    border-left-width: 6px;
}

.hierarchy-level-1 {
    border-left-color: var(--primary-color);
    opacity: 0.8;
    margin-left: var(--spacing-lg);
}

.hierarchy-level-2 {
    border-left-color: var(--primary-color);
    opacity: 0.6;
    margin-left: calc(var(--spacing-lg) * 2);
}

.hierarchy-level-3 {
    border-left-color: var(--primary-color);
    opacity: 0.4;
    margin-left: calc(var(--spacing-lg) * 3);
}

/* Department hierarchy (green) */
.hierarchy-departments .hierarchy-level-0 {
    border-left-color: var(--color-departments);
}

.hierarchy-departments .hierarchy-level-1 {
    border-left-color: var(--color-departments);
}

.hierarchy-departments .hierarchy-level-2 {
    border-left-color: var(--color-departments);
}

/* Task hierarchy (blue) */
.hierarchy-tasks .hierarchy-level-0 {
    border-left-color: var(--color-tasks);
}

.hierarchy-tasks .hierarchy-level-1 {
    border-left-color: var(--color-tasks);
}

.hierarchy-tasks .hierarchy-level-2 {
    border-left-color: var(--color-tasks);
}

/* Directive hierarchy (orange) */
.hierarchy-directives .hierarchy-level-0 {
    border-left-color: var(--color-directives);
}

.hierarchy-directives .hierarchy-level-1 {
    border-left-color: var(--color-directives);
}

.hierarchy-directives .hierarchy-level-2 {
    border-left-color: var(--color-directives);
}

/*
   CARD UTILITIES - Consistent card styling
 */

.card {
    background-color: var(--color-white);
    border: 1px solid rgba(0, 0, 0, 0.125);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.card-header {
    padding: var(--spacing-md);
    margin: calc(var(--spacing-md) * -1);
    margin-bottom: var(--spacing-md);
    background-color: var(--color-gray-light);
    border-bottom: 1px solid rgba(0, 0, 0, 0.125);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    font-weight: 600;
}

.card-body {
    padding: 0;
}

.card-footer {
    padding: var(--spacing-md);
    margin: calc(var(--spacing-md) * -1);
    margin-top: var(--spacing-md);
    background-color: var(--color-gray-light);
    border-top: 1px solid rgba(0, 0, 0, 0.125);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

/*
   BADGE UTILITIES - Consistent badge styling
 */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.badge-primary {
    background-color: var(--primary-color);
    color: var(--color-white);
}

.badge-success {
    background-color: var(--color-success);
    color: var(--color-white);
}

.badge-danger {
    background-color: var(--color-danger);
    color: var(--color-white);
}

.badge-warning {
    background-color: var(--color-warning);
    color: var(--color-text);
}

.badge-info {
    background-color: var(--primary-color);
    color: var(--color-white);
}

.badge-muted {
    background-color: var(--border-gray);
    color: var(--color-text-muted);
}

.badge-sm {
    padding: 1px 6px;
    font-size: 0.7rem;
}

.badge-department {
    background-color: var(--color-departments);
    color: var(--color-white);
}

.badge-task {
    background-color: var(--color-tasks);
    color: var(--color-white);
}

.badge-position {
    background-color: var(--color-positions);
    color: var(--text-dark);
}

.badge-employee {
    background-color: var(--color-employees);
    color: var(--color-white);
}

.badge-directive {
    background-color: var(--color-directives);
    color: var(--color-white);
}

/*
   TINTED / STRONG ENTITY BADGES (Treatments #2 and #3)
   Dark text + entity-colored background via --entity-color.
   Never use entity colors as text color.
   Set --entity-color on the element (inline style or modifier class).
 */

.badge-tinted {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: var(--radius-xl);
    font-size: 0.75rem;
    font-weight: 600;
    background: color-mix(in srgb, var(--entity-color) 15%, transparent);
    color: #1F2937;
    text-decoration: none;
}

a.badge-tinted:hover {
    background: color-mix(in srgb, var(--entity-color) 35%, transparent);
}

.badge-strong {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: var(--radius-xl);
    font-size: 0.75rem;
    font-weight: 600;
    background: color-mix(in srgb, var(--entity-color) 50%, transparent);
    color: #1F2937;
    text-decoration: none;
}

a.badge-strong:hover {
    background: color-mix(in srgb, var(--entity-color) 85%, transparent);
}

.hover-badge-tinted {
    transition: background-color 0.2s ease;
    cursor: pointer;
}

.hover-badge-tinted:hover {
    background: color-mix(in srgb, var(--entity-color) 35%, transparent);
}

.hover-badge-strong {
    transition: background-color 0.2s ease, color 0.2s ease;
    cursor: pointer;
}

.hover-badge-strong:hover {
    background: color-mix(in srgb, var(--entity-color) 85%, transparent);
}

/*
   ENTITY UNDERLINE (Treatment #5) — Dark text + entity-colored underline
   Uses --entity-color variable. 50% tint at rest.
   .entity-underline: static underline (titles, headings)
   .hover-link: interactive underline with hover to 100% (links)
 */

.entity-underline,
.hover-link {
    color: #1F2937;
    text-decoration: underline;
    text-decoration-thickness: 3px;
    text-decoration-color: color-mix(in srgb, var(--entity-color) var(--border-accent-tint), transparent);
    text-underline-offset: 3px;
}

.hover-link {
    transition: text-decoration-color 0.2s ease;
}

.hover-link:hover {
    text-decoration-color: var(--entity-color);
}

/*
   STATUS PILLS — Color-free status indication via typography
   Status pills use neutral grey backgrounds with weight, opacity, and
   strikethrough to communicate state. No colored badges.
 */

.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: var(--radius-pill);
    background: #F3F4F6;
    color: #6B7280;
    border: 1px solid #E5E7EB;
    white-space: nowrap;
    letter-spacing: 0.02em;
}

.status-pill--pending {
    font-weight: 500;
}

.status-pill--active {
    font-weight: 700;
    color: #374151;
    background: #E5E7EB;
    border-color: #374151;
}

.status-pill--done {
    font-weight: 400;
    color: #9CA3AF;
}

.status-pill--cancelled {
    font-weight: 400;
    color: #9CA3AF;
    text-decoration: line-through;
}

/* Type pill — same form as status-pill but for category/type labels */
.type-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: var(--radius-pill);
    background: #F3F4F6;
    color: #6B7280;
    border: 1px solid #E5E7EB;
    white-space: nowrap;
    letter-spacing: 0.02em;
}

.type-pill--highlight {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/*
   STATUS TIMELINE — Vertical spine with dot indicators
   Dot shape encodes state: filled=done, ring=current, hollow=future, ×=cancelled.
   Typography mirrors the pill pattern (weight + opacity + strikethrough).
 */

.status-timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding-left: 20px;
    position: relative;
}

.status-timeline::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: #E5E7EB;
}

.status-timeline-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 10px 0;
    position: relative;
}

.status-timeline-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-left: -20px;
    margin-top: 2px;
    position: relative;
    z-index: 1;
}

.status-timeline-dot--done {
    background: #9CA3AF;
}

/* Ring-shape dots: white fill is semantic (empty/current/cancelled indicator), not a themed surface. Stays white in all themes so it contrasts against both light and dark page backgrounds. */
.status-timeline-dot--current {
    background: white;
    border: 3px solid #374151;
}

.status-timeline-dot--future {
    background: white;
    border: 2px solid #D1D5DB;
}

.status-timeline-dot--cancelled {
    background: white;
    border: 2px solid #D1D5DB;
    position: relative;
}

.status-timeline-dot--cancelled::after {
    content: '\00d7';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 10px;
    font-weight: 700;
    color: #9CA3AF;
    line-height: 1;
}

.status-timeline-content {
    flex: 1;
    min-width: 0;
}

.status-timeline-title {
    font-size: 0.875rem;
    color: #1F2937;
    font-weight: 500;
}

.status-timeline-item--done .status-timeline-title {
    color: #9CA3AF;
    font-weight: 400;
}

.status-timeline-item--current .status-timeline-title {
    color: #1F2937;
    font-weight: 600;
}

.status-timeline-item--future .status-timeline-title {
    color: #6B7280;
    font-weight: 400;
}

.status-timeline-item--cancelled .status-timeline-title {
    color: #9CA3AF;
    font-weight: 400;
    text-decoration: line-through;
}

.status-timeline-meta {
    font-size: 0.75rem;
    color: #9CA3AF;
    margin-top: 2px;
}

.status-timeline-title a {
    text-decoration-thickness: 2px;
    text-underline-offset: 2px;
}

.status-timeline-item--done .status-timeline-title a {
    color: #9CA3AF;
    text-decoration-color: color-mix(in srgb, var(--entity-color) 25%, transparent);
}

.status-timeline-item--cancelled .status-timeline-title a {
    color: #9CA3AF;
    text-decoration: line-through;
    text-decoration-color: #9CA3AF;
}

/*
   STATUS CARD — Color-free card with status pill
   For cards that don't represent a specific entity. Status through
   opacity, typography weight, and pill label. No left border.
 */

.status-card {
    border: 1px solid #E5E7EB;
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    background: var(--background-white);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.status-card-title {
    font-size: 0.875rem;
    color: #1F2937;
    font-weight: 500;
}

.status-card--active {
    border-color: #D1D5DB;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.status-card--active .status-card-title {
    font-weight: 600;
}

.status-card--done {
    opacity: 0.6;
}

.status-card--cancelled {
    opacity: 0.5;
}

.status-card--cancelled .status-card-title {
    text-decoration: line-through;
}

/*
   SPACING UTILITIES - Consistent spacing
 */

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--spacing-xs); }
.mt-2 { margin-top: var(--spacing-sm); }
.mt-3 { margin-top: var(--spacing-md); }
.mt-4 { margin-top: var(--spacing-lg); }
.mt-5 { margin-top: var(--spacing-xl); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--spacing-xs); }
.mb-2 { margin-bottom: var(--spacing-sm); }
.mb-3 { margin-bottom: var(--spacing-md); }
.mb-4 { margin-bottom: var(--spacing-lg); }
.mb-5 { margin-bottom: var(--spacing-xl); }

.pt-0 { padding-top: 0; }
.pt-1 { padding-top: var(--spacing-xs); }
.pt-2 { padding-top: var(--spacing-sm); }
.pt-3 { padding-top: var(--spacing-md); }
.pt-4 { padding-top: var(--spacing-lg); }
.pt-5 { padding-top: var(--spacing-xl); }

.pb-0 { padding-bottom: 0; }
.pb-1 { padding-bottom: var(--spacing-xs); }
.pb-2 { padding-bottom: var(--spacing-sm); }
.pb-3 { padding-bottom: var(--spacing-md); }
.pb-4 { padding-bottom: var(--spacing-lg); }
.pb-5 { padding-bottom: var(--spacing-xl); }

/*
   TEXT UTILITIES - Typography helpers
 */

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-primary { color: var(--primary-color); }
.text-success { color: var(--color-success); }
.text-danger { color: var(--color-danger); }
.text-muted { color: var(--color-gray-dark); }

.font-bold { font-weight: 600; }
.font-normal { font-weight: normal; }

/*
   DISPLAY UTILITIES - Layout helpers
 */

.d-none { display: none; }
.d-block { display: block; }
.d-inline { display: inline; }
.d-inline-block { display: inline-block; }
.d-flex { display: flex; }
.d-inline-flex { display: inline-flex; }

.flex-row { flex-direction: row; }
.flex-column { flex-direction: column; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.gap-1 { gap: var(--spacing-xs); }
.gap-2 { gap: var(--spacing-sm); }
.gap-3 { gap: var(--spacing-md); }

/*
   ENTWICKLUNG GRAY/BLUE BUTTON VARIANTS - Municipal conservative design
 */

/* Municipal gray variants completely removed - all buttons now use standard styling */



/*
   SPECIALIZED BUTTON UTILITIES - Context-specific button styles
 */


/* Copy buttons in terminal output */
.copy-btn {
    background: #374151;
    color: #e5e7eb;
    border: 1px solid #4b5563;
    border-radius: var(--radius-sm);
    padding: 2px 6px;
    font-size: 0.6875rem;
    cursor: pointer;
    margin-left: 8px;
    transition: all 0.2s ease;
    font-family: inherit;
}

.copy-btn:hover {
    background: #4b5563;
    color: white;
}


/* Unified Action Button - Municipal grade styling (replaces conflicting item-action-btn + btn-*-gray combinations) */
.action-btn,
.form-action-btn {
    background: #f8f9fa;
    border: 1px solid #003D83;
    color: black;
    padding: 8px;
    width: 32px;
    height: 32px;
    font-size: 0.875rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-weight: 500;
}

.action-btn:hover:not(:disabled),
.form-action-btn:hover:not(:disabled) {
    background: #e9ecef;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 61, 131, 0.2);
}

.action-btn:active:not(:disabled),
.form-action-btn:active:not(:disabled) {
    background: #dee2e6;
    transform: translateY(0px);
    box-shadow: 0 1px 3px rgba(0, 61, 131, 0.3);
    transition: all 0.05s ease; /* Faster transition for immediate feedback */
}

.action-btn:disabled,
.form-action-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Hierarchical Item Action Buttons - Reversed Style (November 2025) */
.hierarchical-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    min-height: 32px;
    padding: 6px;
    color: var(--primary-color);
    background: var(--background-white);
    border: 1.5px solid var(--primary-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    text-decoration: none;
    font-weight: 500;
}

.hierarchical-action-btn:hover:not(:disabled) {
    background: var(--color-action);
    color: white;
    border-color: var(--color-action);
    transform: scale(1.05);
}

.hierarchical-action-btn:active:not(:disabled) {
    background: var(--color-action);
    color: white;
    border-color: var(--color-action);
    transform: scale(0.98);
    transition: all 0.05s ease; /* Faster transition for immediate feedback */
}

/* Active state - button stays orange when form/action is open */
.hierarchical-action-btn.active {
    background: var(--color-action);
    color: white;
    border-color: var(--color-action);
}

.hierarchical-action-btn:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.hierarchical-action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.hierarchical-action-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* System Task Indicator Button - Clickable info button for protected tasks */
.hierarchical-action-btn.action-system_task_indicator {
    background-color: var(--background-white);
    border-color: var(--primary-color);
    color: var(--primary-color);
    cursor: pointer;
}

.hierarchical-action-btn.action-system_task_indicator svg {
    stroke: var(--primary-color);
}

.hierarchical-action-btn.action-system_task_indicator:hover {
    background-color: var(--color-action);
    border-color: var(--color-action);
    color: var(--color-white);
    transform: scale(1.05);
}

.hierarchical-action-btn.action-system_task_indicator:hover svg {
    stroke: var(--color-white);
}

.hierarchical-action-btn.action-system_task_indicator:active {
    transform: scale(0.95); /* Click feedback */
}

/* Position picker mode styling */
.hierarchical-action-btn.always-visible {
    /* Always visible buttons maintain full styling */
}

/* Check/status buttons */
.btn-check {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-xs) var(--spacing-sm);
    background: var(--color-success, #10b981);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-check:hover:not(:disabled) {
    background: var(--success-hover, #059669);
    transform: translateY(-1px);
}

.btn-check:disabled {
    background: var(--border-gray);
    cursor: not-allowed;
    transform: none;
}

.btn-check .button-icon {
    font-size: var(--font-size-sm);
}

.btn-check.btn-missing {
    background: #f59e0b;
}

.btn-check.btn-missing:hover:not(:disabled) {
    background: #d97706;
}

.btn-check.btn-ok {
    background: #6b7280;
}

.btn-check.btn-ok:hover:not(:disabled) {
    background: #4b5563;
}

/* Clear search button */
.clear-search-btn {
    padding: var(--spacing-xs);
    border: 1px solid var(--border-gray);
    border-radius: var(--radius-sm);
    background: #fee2e2;
    color: #dc2626;
    cursor: pointer;
    font-size: var(--font-size-sm);
    min-width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease-out;
    opacity: 1;
    transform: scale(1);
}

.clear-search-btn:hover {
    background: #fecaca;
    transform: scale(1.05);
}

.clear-search-btn[style*="display: none"] {
    opacity: 0;
    transform: scale(0.8);
}

/* Filter management buttons */
.clear-all-filters-btn {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: var(--font-size-xs);
    background-color: var(--background-white);
    color: var(--text-gray);
    border: 1px solid var(--border-gray);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.clear-all-filters-btn:hover {
    background: var(--background-light);
    transform: translateY(-1px);
}

.clear-filters-btn {
    align-self: flex-start;
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: var(--font-size-sm);
    background-color: var(--background-light);
    color: var(--text-gray);
    border: 1px solid var(--border-gray);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.clear-filters-btn:hover {
    background: var(--background-white);
    transform: translateY(-1px);
}

/* Assignment and filter buttons */
.assign-filter-btn {
    padding: var(--spacing-xs) var(--spacing-sm);
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: var(--font-size-sm);
    transition: background-color 0.2s ease;
}

.assign-filter-btn:hover {
    background-color: var(--primary-color-dark);
}

.filter-assign-btn {
    margin-top: var(--spacing-xs);
    width: 100%;
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.filter-assign-btn:hover {
    background-color: var(--primary-color-dark);
}

@media (max-width: 600px) {
    .filter-assign-btn {
        padding: var(--spacing-sm);
        font-size: var(--font-size-md);
    }
}

/*
   RESPONSIVE UTILITIES - Mobile-first helpers
 */

@media (max-width: 600px) {
    .mobile-hide { display: none; }
    .mobile-block { display: block; }
    .mobile-full { width: 100%; }
}

@media (min-width: 601px) {
    .desktop-hide { display: none; }
    .desktop-block { display: block; }
}

/*
   LOADING OVERLAY - Full-screen overlay with spinner and message
 */

.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: var(--spacing-md);
}

.loading-overlay.active {
    display: flex;
    animation: loading-overlay-fadein 0.2s ease-out;
}

.loading-overlay-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.loading-overlay-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: loading-overlay-spin 0.8s linear infinite;
    z-index: 1;
}

.loading-overlay-message {
    color: #fff;
    font-size: var(--font-size-lg);
    font-weight: 500;
    z-index: 1;
    text-align: center;
    padding: 0 var(--spacing-md);
}

@keyframes loading-overlay-spin {
    to { transform: rotate(360deg); }
}

@keyframes loading-overlay-fadein {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .loading-overlay-spinner {
        animation: none;
        border-top-color: rgba(255, 255, 255, 0.3);
        border-right-color: #fff;
        border-bottom-color: #fff;
    }

    .loading-overlay.active {
        animation: none;
    }
}

/* ==========================================================================
   MAINTENANCE BANNERS
   Cross-product banners for warning and active maintenance states.
   ========================================================================== */

.maintenance-banner {
    padding: 10px 20px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    z-index: 100;
    position: relative;
    border-radius: var(--radius-xl);
    margin-bottom: 20px;
}

.maintenance-banner-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #1a1a1a;
}

.maintenance-banner-active {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
}

.maintenance-banner a {
    color: inherit;
    text-decoration: underline;
    font-weight: 600;
}

.maintenance-banner-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.maintenance-banner-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.maintenance-banner-countdown {
    font-weight: 600;
}

/*
   ENTITY ITEM — Colored left-border cards for linked entities
   Used on process show pages to display employees, positions, tasks, etc.
   Type maps to entity color via `.entity-item--{type}`.
 */

.entity-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    border: 1px solid #E5E7EB;
    border-left: var(--border-accent-width) solid color-mix(in srgb, var(--entity-color, #9CA3AF) var(--border-accent-tint), transparent);
    background: var(--background-white);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.2s ease, transform 0.1s ease;
}

.entity-item:hover {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transform: translateX(2px);
    border-left-color: var(--entity-color, #9CA3AF);
    background: color-mix(in srgb, var(--entity-color, #9CA3AF) 8%, white);
}

.entity-item-content {
    flex: 1;
    min-width: 0;
}

.entity-item-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6B7280;
    margin-bottom: 2px;
}

.entity-item-name {
    font-weight: 500;
    font-size: 0.9rem;
}

.entity-item-actions {
    flex-shrink: 0;
}

/* Entity items inside detail-cards get spacing */
.detail-card .entity-item {
    margin-bottom: 8px;
}

.detail-card .entity-item:last-child {
    margin-bottom: 0;
}

/* Entity items followed by detail-rows need extra spacing */
.detail-card .entity-item + .detail-row {
    margin-top: 8px;
}

/* Entity type colors — set --entity-color, border computed via color-mix in base rule */
.entity-item--employee { --entity-color: var(--color-employees, #9C27B0); }
.entity-item--position { --entity-color: var(--color-positions, #FFEB3B); }
.entity-item--task { --entity-color: var(--color-tasks, #4CAF50); }
.entity-item--department { --entity-color: var(--color-departments, #FF9800); }
.entity-item--directive { --entity-color: var(--color-directives, #F44336); }
.entity-item--process { --entity-color: var(--color-processes, #2196F3); }
.entity-item--service { --entity-color: var(--color-process-steps, #1565C0); }
.entity-item--system { --entity-color: var(--color-system, #424242); }
.entity-item--neutral { --entity-color: #9CA3AF; }

/* ============================================
   Type Selector Cards (canonical pattern)
   Used by: HR movements (Neue Bewegung), Ressourcen rooms (Neu), and any
   future "create-of-multiple-types" flows. Mobile = single column,
   ≥600px = 3 columns.
   ============================================ */

.type-selector {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 24px;
}

.type-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 16px;
    background: var(--background-white);
    color: var(--text-dark);
    border: 2px solid var(--color-gray);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    font-family: inherit;
    font-size: inherit;
}

.type-card:hover {
    background: var(--primary-color-tint);
    color: var(--text-dark);
}

.type-card.active,
.type-card.active:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.type-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--color-gray-light);
    color: inherit;
    transition: background 0.2s ease, color 0.2s ease;
}

.type-card.active .type-card-icon {
    background: rgba(255, 255, 255, 0.2);
    color: inherit;
}

.type-card-label {
    font-weight: 600;
    font-size: 0.9375rem;
    color: inherit;
}

@media (min-width: 600px) {
    .type-selector {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* System step label in timeline */
.status-timeline-system {
    font-style: italic;
    color: #9CA3AF;
    font-size: 0.8rem;
    font-weight: 400;
}

/* =============================================================================
   Relationship List / Relationship Item
   Flat-row browsing pattern with entity-color left accent.
   Promoted from organisation.css in Session 11 — used across products
   (organisation focus views, blog channels + admin, future consumers).
   ============================================================================= */

.relationship-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.relationship-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    background: var(--background-white);
    border-radius: var(--radius-sm);
    border: 1px solid #E5E7EB;
    border-left: var(--border-accent-width) solid color-mix(in srgb, var(--entity-color) var(--border-accent-tint), transparent);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    box-sizing: border-box;
    min-width: 0;
    overflow: visible;
    transition: box-shadow 0.2s ease, border-left-color 0.2s ease, background-color 0.2s ease;
}

.relationship-item:hover {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-left-color: var(--entity-color);
    background-color: color-mix(in srgb, var(--entity-color) 6%, white);
}

.relationship-item-highlight {
    border: 2px solid var(--primary-color);
    background: #F0F9FF;
}

/* Backwards-compatibility class — base now provides this layout */
.relationship-item-with-actions {
    /* no-op */
}

.relationship-item-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.relationship-item-photo {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-color-light));
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.relationship-item-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.relationship-item-photo-initials {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-white);
    font-weight: 600;
    font-size: 0.875rem;
}

/* Hierarchical-item profile avatar (employees + employee/position assignments).
   40px inline-block variant of .relationship-item-photo; brand gradient via tokens
   so it follows per-tenant theming. border-radius: 50% is a circle primitive (exempt,
   like --radius-pill), not a themed card corner. */
.hierarchical-item-avatar {
    display: inline-block;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    vertical-align: middle;
    margin-right: 10px;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-color-light));
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.hierarchical-item-avatar__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hierarchical-item-avatar__initials {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-white);
    font-weight: 600;
    font-size: 16px;
}

.relationship-item-icon {
    font-size: 1.125rem;
    flex-shrink: 0;
}

.relationship-item-content {
    flex: 1;
    min-width: 0;
    margin-right: var(--spacing-xs);
}

.relationship-item-title {
    font-weight: 500;
    color: var(--color-text);
    font-size: 0.875rem;
    line-height: 1.4;
    word-break: break-word;
}

.relationship-item-title:not(:last-child) {
    margin-bottom: 2px;
}

.relationship-item-title-with-badges {
    display: flex;
    align-items: center;
    gap: 4px;
}

.relationship-item-title-with-badges .badge-primary-assignment,
.relationship-item-title-with-badges .badge-secondary-assignment,
.relationship-item-title-with-badges .badge-substitute-assignment {
    margin-right: 0;
}

.relationship-item-title.position-with-badge {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.relationship-item-meta {
    font-size: 0.75rem;
    color: #6B7280;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.relationship-item-code {
    font-family: 'Courier New', monospace;
    background: #F3F4F6;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-weight: 600;
}

@media (max-width: 600px) {
    .relationship-list {
        gap: 8px;
    }

    .relationship-item {
        gap: 8px;
        padding: 8px 12px;
    }

    .relationship-item-title {
        font-size: 0.8125rem;
    }

    .relationship-item-meta {
        font-size: 0.6875rem;
    }

    .relationship-item-photo {
        width: 32px;
        height: 32px;
    }

    .relationship-item-photo-initials {
        font-size: 0.6875rem;
    }
}