/* Partial: _journey.css.j2 — Journey cards, search, grouping, compact variants */

/* Journey Cards */
.journey-toolbar {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: var(--journey-toolbar-bg);
    border-radius: 8px;
}

.journey-search {
    flex: 1;
    max-width: 400px;
}

.journey-search input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    font-size: 0.875rem;
}

.journey-search input:focus {
    outline: none;
    border-color: var(--journey-search-focus-border);
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.15);
}

.journey-count {
    font-size: 0.875rem;
    color: var(--secondary-text);
}

.journey-list {
    display: grid;
    gap: 16px;
    padding: 16px 0;
}

.journey-card {
    background: var(--journey-card-bg);
    border: 1px solid var(--journey-card-border);
    border-radius: 8px;
    padding: 20px;
    transition: box-shadow 0.2s, border-color 0.2s;
}

.journey-card:hover {
    border-color: var(--journey-card-hover-border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.journey-card.hidden {
    display: none;
}

.journey-card-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.journey-card .journey-id {
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 0.75rem;
    color: var(--journey-id-text);
    background: var(--journey-id-bg);
    padding: 4px 8px;
    border-radius: 4px;
    flex-shrink: 0;
}

.journey-card h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--journey-title);
    margin: 0;
    line-height: 1.4;
}

.journey-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
    padding: 12px;
    background: var(--journey-meta-bg);
    border-radius: 6px;
}

.journey-meta-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.journey-meta-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--journey-meta-label);
}

.journey-meta-value {
    font-size: 0.875rem;
    color: var(--journey-meta-value);
}

.journey-card .journey-description {
    font-size: 0.875rem;
    color: var(--journey-description);
    line-height: 1.6;
    white-space: pre-wrap;
}

.journey-refs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.journey-refs-label {
    font-size: 0.75rem;
    color: var(--journey-refs-label);
    font-weight: 600;
    margin-right: 2px;
    align-self: center;
}

.journey-ref-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--journey-ref-text);
    background: var(--journey-ref-bg);
    border: 1px solid var(--journey-ref-border);
    border-radius: 12px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.journey-ref-badge:hover {
    background: var(--journey-ref-hover-bg);
    color: var(--journey-ref-hover-text);
}

.no-journeys {
    text-align: center;
    padding: 48px;
    color: var(--secondary-text);
}

/* Journey Grouping */
.journey-group-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.journey-group-controls label {
    font-size: 0.8rem;
    color: var(--secondary-text);
    font-weight: 500;
}

.journey-group-controls select {
    padding: 6px 10px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    font-size: 0.8rem;
    background: var(--panel-bg);
    cursor: pointer;
}

.journey-group-controls select:focus {
    outline: none;
    border-color: var(--journey-search-focus-border);
}

.journey-group {
    margin-bottom: 24px;
}

.journey-group-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: linear-gradient(to right, var(--journey-group-header-from), var(--journey-group-header-to));
    border-radius: 8px;
    margin-bottom: 12px;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.journey-group-header:hover {
    background: linear-gradient(to right, var(--journey-group-header-hover-from), var(--journey-group-header-hover-to));
}

.journey-group-header .expand-icon {
    font-size: 0.75rem;
    color: var(--secondary-text);
    transition: transform 0.2s;
    width: 16px;
}

.journey-group.collapsed .expand-icon {
    transform: rotate(-90deg);
}

.journey-group-header h4 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--input-text);
    flex: 1;
}

.journey-group-count {
    font-size: 0.75rem;
    color: var(--secondary-text);
    background: var(--journey-group-count-bg);
    padding: 2px 8px;
    border-radius: 10px;
    border: 1px solid var(--journey-group-count-border);
}

.journey-group-cards {
    display: grid;
    gap: 12px;
    padding-left: 0;
}

.journey-group.collapsed .journey-group-cards {
    display: none;
}

/* Compact card variant for grouped view */
.journey-card.compact {
    padding: 14px 16px;
}

.journey-card.compact .journey-card-header {
    margin-bottom: 8px;
}

.journey-card.compact h3 {
    font-size: 1rem;
}

.journey-card.compact .journey-description {
    font-size: 0.8rem;
    max-height: 80px;
    overflow: hidden;
    position: relative;
}

.journey-card.compact .journey-description::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30px;
    background: linear-gradient(transparent, var(--journey-compact-fade));
}

.journey-card.compact.expanded .journey-description {
    max-height: none;
}

.journey-card.compact.expanded .journey-description::after {
    display: none;
}

/* ── Journey Edit Mode ──────────────────────────────────────────────── */

.journey-title-edit,
.journey-field-edit,
.journey-section-name-edit {
    font-family: inherit;
    font-size: inherit;
    border: none;
    border-bottom: 1px dashed var(--border-color);
    background: transparent;
    padding: 1px 4px;
    outline: none;
    width: 100%;
}
.journey-title-edit { font-size: 1rem; font-weight: 600; flex: 1; }
.journey-field-edit { width: 90%; }
.journey-section-name-edit { font-weight: 600; flex: 1; }

.journey-delete-btn {
    background: none;
    border: none;
    color: var(--danger-color, #e03131);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.journey-delete-btn:hover { opacity: 0.7; }

.journey-move-btn,
.journey-ref-add-btn,
.journey-section-add-btn,
.journey-add-btn {
    background: none;
    border: 1px dashed var(--primary-color, #5c7cfa);
    color: var(--primary-color, #5c7cfa);
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
}
.journey-move-btn:hover,
.journey-ref-add-btn:hover,
.journey-section-add-btn:hover,
.journey-add-btn:hover {
    background: var(--primary-color, #5c7cfa);
    color: #fff;
}

.journey-ref-delete {
    cursor: pointer;
    margin-left: 2px;
    font-size: 0.8em;
}
.journey-ref-delete:hover { opacity: 0.7; }

.journey-section-delete {
    background: none;
    border: none;
    color: var(--danger-color, #e03131);
    font-size: 1rem;
    cursor: pointer;
    padding: 0 4px;
}

.journey-preamble { border-top: 1px solid var(--border-color); padding-top: 8px; margin-bottom: 8px; }
.journey-preamble-edit,
.journey-section-content-edit {
    width: 100%;
    min-height: 40px;
    font-family: inherit;
    font-size: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 6px;
    resize: vertical;
    background: var(--bg-secondary, #f8f9fa);
}

.journey-section {
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 8px;
    margin-bottom: 8px;
}
.journey-section-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}
.journey-section-name-view {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--text-secondary, #495057);
}
.journey-section-content-view {
    color: var(--text-primary, #495057);
    font-size: 0.8rem;
    line-height: 1.5;
    white-space: pre-wrap;
}

/* Hide edit-only elements by default; show when body has .edit-mode */
.journey-title-edit,
.journey-field-edit,
.journey-preamble-edit,
.journey-section-name-edit,
.journey-section-content-edit { display: none; }

body.edit-mode .journey-title-edit,
body.edit-mode .journey-field-edit,
body.edit-mode .journey-section-name-edit { display: inline-block; }
body.edit-mode .journey-preamble-edit,
body.edit-mode .journey-section-content-edit { display: block; }

body.edit-mode .journey-title-view,
body.edit-mode .journey-field-view,
body.edit-mode .journey-preamble-view,
body.edit-mode .journey-section-name-view,
body.edit-mode .journey-section-content-view { display: none; }

/* Journey refs section — always visible (show Validates even when empty in edit mode) */
.journey-refs { margin-bottom: 8px; }
.journey-sections { margin-top: 8px; }
