/* css/3-components.css */

/* ========================================================================== */
/* CORE COMPONENTS - Shared UI Element Classes */
/* ========================================================================== */

/* Visibility Utility */
.u-hidden {
    display: none !important;
}

/* --- Icon Hover Behavior --- */
.icon-hover {
    transition: opacity 0.15s ease, background-color 0.15s ease;
    opacity: 0.7;
    cursor: pointer;
}

.icon-hover:hover {
    opacity: 1;
    background-color: rgba(0, 0, 0, 0.08);
    border-radius: 6px;
}

/* --- Base Button --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    gap: 6px;
    transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* --- Button Variants --- */
.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.16);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #5a6fd6 0%, #6e4294 100%);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.16);
}

.btn-secondary {
    background-color: #f9fafb;
    border-color: #d0d7de;
    color: #374151;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #f2f3f5;
    border-color: #c5ccd3;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
    transform: translateY(-1px);
}

.btn-secondary:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: none;
}

.btn-danger {
    background: #f44336;
    color: #fff;
    border-color: #f44336;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.16);
}

.btn-danger:hover:not(:disabled) {
    background: #e63c32;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
    transform: translateY(-1px);
}

.btn-danger:active:not(:disabled) {
    transform: translateY(0);
}

/* --- Generic Card --- */
.card {
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-fast);
}

.card:hover {
    border-color: var(--color-border-medium);
    box-shadow: var(--shadow-md);
}

.card.elevated {
    box-shadow: var(--shadow-lg);
}

/* --- Badge --- */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xs) var(--spacing-md);
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-bold);
    white-space: nowrap;
    background: var(--color-bg-secondary);
    color: var(--color-text-secondary);
}

.badge-primary {
    background: var(--color-primary);
    color: var(--color-text-on-brand);
}

.badge-danger {
    background: var(--color-danger);
    color: var(--color-text-on-brand);
}

.badge-success {
    background: var(--color-success);
    color: var(--color-text-on-brand);
}

.badge-warning {
    background: var(--color-warning);
    color: var(--color-text-on-brand);
}

/* --- Bulk Upload Modal Styles --- */

/* Modal container */
.bulk-upload-modal {
    max-width: 1200px;
    width: 95%;
    min-width: 0;
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Header row */
.bulk-upload-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.bulk-upload-header h2 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
    color: #333;
}

.bulk-upload-header .close-modal-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 24px;
    color: #999;
    padding: 0;
    line-height: 1;
    transition: color 0.15s ease, transform 0.1s ease;
}

.bulk-upload-header .close-modal-btn:hover {
    color: #666;
    transform: translateY(-1px);
}

/* Section spacing */
.bulk-upload-section {
    margin-bottom: 20px;
}

/* Info banner (light blue) */
.bulk-upload-info {
    padding: 14px 16px;
    background: #f0f7ff;
    border-radius: 8px;
    border: 1px solid #c8ddff;
    border-left: 4px solid #667eea;
    font-size: 0.9rem;
    color: #374151;
    line-height: 1.4;
    box-sizing: border-box;
    overflow: hidden;
}

.bulk-upload-info .bulk-upload-label {
    margin-bottom: 10px;
    font-size: 0.95rem;
    color: #333;
}

.bulk-upload-info .bulk-upload-row {
    width: 100%;
    box-sizing: border-box;
}

.bulk-upload-info .bulk-upload-select,
.bulk-upload-info .bulk-upload-input {
    min-width: 0;
    box-sizing: border-box;
}

.bulk-upload-intro {
    margin: 0;
    font-size: 0.95em;
    color: #333;
}

/* Labels */
.bulk-upload-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

/* Row layout (flex with gap) */
.bulk-upload-row {
    display: flex;
    gap: 10px;
}

/* Form inputs */
.bulk-upload-select,
.bulk-upload-input {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.95em;
}

/* Warning text */
.bulk-upload-warning {
    margin: 8px 0 0 0;
    font-size: 0.85em;
    color: #f39c12;
}

/* Templates section */
.bulk-upload-templates p {
    margin: 0 0 10px 0;
    font-weight: 600;
    color: #333;
}

.bulk-template-btn {
    flex: 1;
    justify-content: center;
}

/* Dropzone */
.bulk-upload-dropzone {
    border: 2px dashed #d0d7de;
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    background-color: #f9fafb;
    cursor: pointer;
    margin-bottom: 16px;
    transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.bulk-upload-dropzone:hover {
    background-color: #f3f4f6;
    border-color: #667eea;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
    transform: translateY(-1px);
}

.bulk-upload-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.bulk-upload-title {
    margin: 0 0 4px 0;
    font-weight: 600;
    color: #333;
}

.bulk-upload-subtitle {
    margin: 0;
    font-size: 0.9rem;
    color: #6b7280;
}

.bulk-upload-subtitle a {
    color: #667eea;
}

.bulk-upload-subtitle a:hover {
    text-decoration: underline;
}

/* File info (green success box) */
.bulk-upload-file-info {
    margin-top: 10px;
    padding: 10px;
    background: #e8f5e9;
    border-radius: 6px;
}

.bulk-upload-file-info p {
    margin: 0;
    font-size: 0.9em;
    color: #2e7d32;
}

/* Status messages area */
.bulk-upload-status {
    margin-bottom: 20px;
}

/* Preview section */
.bulk-upload-preview {
    margin-bottom: 15px;
}

.bulk-upload-summary {
    margin-bottom: 15px;
    padding: 12px;
    background: #f5f5f5;
    border-radius: 6px;
}

.bulk-upload-summary p {
    margin: 0;
    font-size: 0.9em;
    color: #333;
}

/* Preview table wrapper */
.bulk-upload-table-wrapper {
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: auto;
    max-height: 300px;
    margin-bottom: 15px;
    width: 100%;
}

.bulk-upload-table {
    width: 100%;
    min-width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
    table-layout: fixed;
}

.bulk-upload-table thead {
    background: #f5f5f5;
    position: sticky;
    top: 0;
}

.bulk-upload-table th {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #ddd;
    font-weight: 600;
    color: #333;
}

.bulk-upload-table td {
    padding: 10px;
    border-bottom: 1px solid #eee;
}

/* ========================================================================== */
/* CORE COMPONENT USAGE GUIDE
 * 
 * These core classes provide the foundation for all UI components:
 * 
 * .u-hidden
 *   - Utility class for hiding elements with !important
 * 
 * .btn (base) + variant classes
 *   - Use .btn as the foundation for all buttons
 *   - Add .btn-primary, .btn-secondary, or .btn-danger for styling
 *   - All sizing and padding comes from .btn; variants only change colors/shadows
 *   - Example: <button class="btn btn-primary">Click me</button>
 * 
 * .card (generic container)
 *   - Use for any card-like container (sections, boxes, etc.)
 *   - Add .elevated modifier for increased shadow
 *   - Includes base padding, border, and hover effects
 * 
 * .badge (small labels) + variant classes
 *   - Use .badge for small inline labels and status indicators
 *   - Add .badge-primary, .badge-danger, .badge-success, or .badge-warning
 *   - Use for tags, status labels, plan indicators, etc.
 * 
 * REFACTORING PATTERN:
 *   1. Extract shared visual properties to the base class
 *   2. Keep layout-specific rules in component-specific classes
 *   3. Example: .group-item can inherit card styling while keeping layout rules
 *   4. Use modifier classes (.btn-primary) instead of creating new button types
 * 
 * ========================================================================== */
/* ========================================================================== */

/* --- Base Icon Circles --- */
.account-icon-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--color-bg-tertiary);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23888'%3E%3Cpath d='M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z'/%3E%3C/svg%3E");
    background-size: 80%;
    background-position: center;
    background-repeat: no-repeat;
    border: 1px solid var(--color-border-lighter);
    background-size: cover;
}

/* --- Additional Button Styles --- */
/* .btn-add extends .btn - use with class="btn btn-add" */
.btn-add {
    background: white;
    border: 2px solid var(--color-text-secondary);
    color: var(--color-text-secondary);
    padding: var(--spacing-lg) 24px;
}

.btn-add:hover:not(:disabled) {
    background: var(--color-text-secondary);
    color: white;
    transform: translateY(-1px);
}

/* .btn-small is a specialized button for compact UI (friend list, controls, etc.) */
/* Extends .btn - use with class="btn btn-small" or standalone for legacy support */
.btn-small {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary);
    color: white;
    padding: var(--spacing-sm) var(--spacing-lg);
    border-radius: var(--radius-sm);
    border: none;
    font-size: var(--font-size-sm);
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.1s ease;
}

.btn-small:hover {
    background: var(--color-primary-dark);
    transform: translateY(-1px);
}

.btn-small.edit {
    background: var(--color-success);
}
.btn-small.edit:hover {
    background: var(--color-success);
}
.btn-small.delete {
    background: var(--color-danger);
}
.btn-small.delete:hover {
    background: var(--color-danger);
}
.btn-small.accept {
    background: var(--color-success);
}
.btn-small.accept:hover {
    background: var(--color-success);
}
.btn-small.decline {
    background: var(--color-disabled);
}
.btn-small.decline:hover {
    background: var(--color-disabled);
}
.btn-small.remove {
    background: var(--color-danger);
}
.btn-small.remove:hover {
    background: var(--color-danger);
}
.btn-small.view {
    background: var(--color-info);
}
.btn-small.view:hover {
    background: var(--color-info);
}

.btn-clear-focus {
    background: #ffe8b3;
    border: 1px solid #ffd699;
    color: var(--color-text-primary);
    padding: 4px 12px;
    font-size: 12px;
    font-weight: var(--font-weight-normal);
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.btn-clear-focus:hover {
    background: #ffd699;
}

#focusModeDisplay {
    display: flex;
    align-items: center;
    gap: 10px;
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    background: rgba(255, 255, 255, 0.95);
    padding: 6px 14px;
    border-radius: var(--radius-md);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#focusText {
    font-weight: 700;
    font-size: 13px;
    color: #555;
    white-space: nowrap;
}

.focus-mode-header {
    background: var(--color-bg-tertiary) !important;
    border-bottom: 1px solid var(--color-border-light) !important;
    padding: 12px 20px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 15px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
}

.btn-clear-focus-small {
    background: #ff6b6b;
    color: white;
    border: none;
    padding: var(--spacing-xs) var(--spacing-md);
    border-radius: var(--radius-xs);
    cursor: pointer;
    font-size: 14px;
    font-weight: var(--font-weight-bold);
}

.zoom-btn {
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: var(--spacing-lg) var(--spacing-md);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1.4em;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-base);
    font-weight: var(--font-weight-bold);
    box-shadow: var(--shadow-xs);
}

.zoom-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-primary-lg);
}

/* --- Forms & Inputs --- */
.form-group {
    margin-bottom: var(--spacing-xl);
}

.form-group label {
    display: block;
    margin-bottom: var(--spacing-sm);
    color: var(--color-text-secondary);
    font-weight: var(--font-weight-bold);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: var(--spacing-md);
    border: 2px solid var(--color-border-light);
    border-radius: var(--radius-md);
    font-size: 1em;
}

/* Time picker dropdowns */
.form-group > div[style*="display: flex"] > select {
    border: 2px solid var(--color-border-light) !important;
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    font-size: 1em;
    background-color: white;
    box-sizing: border-box;
}

/* Date/Time picker inputs */
.form-group > div[style*="display: flex"] > input[type="text"] {
    border: 2px solid var(--color-border-light) !important;
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    font-size: 1em;
    background-color: white;
    box-sizing: border-box;
}

.form-group textarea {
    width: 100%;
    padding: var(--spacing-md);
    border: 2px solid var(--color-border-light);
    border-radius: var(--radius-md);
    font-size: 1em;
    font-family: var(--font-family-base);
    resize: vertical; 
}

/* --- Radio Buttons --- */
.radio-group {
    display: flex;
    gap: 20px;
}
.radio-option {
    display: flex;
    align-items: center;
    gap: 8px;
}
.radio-option input[type="radio"] {
    width: auto;
}
.radio-option label {
    margin-bottom: 0;
    font-weight: normal;
    color: var(--color-text-primary);
}

/* --- Tag Input --- */
.tag-input-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
    padding: 8px 12px; 
    border: 2px solid #ddd;
    border-radius: 10px;
    cursor: text; 
}

.tag-input-container:focus-within {
    border-color: var(--color-primary); 
}

.tag-input-container .tag {
    display: inline-flex;
    align-items: center;
    background-color: var(--color-primary);
    color: white;
    padding: 5px 10px;
    border-radius: var(--radius-xs);
    font-size: 0.9em;
    font-weight: 500;
}

.tag-input-container .tag .tag-remove-btn {
    background: none;
    border: none;
    color: white;
    font-weight: bold;
    margin-left: 8px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    font-size: 1.1em;
}

#timeline-tag-input,
#event-tag-input,
#linked-events-tag-input,
#tmCreateTagInput {
    flex-grow: 1;
    border: none;
    outline: none;
    padding: 5px 0; 
    font-size: 1em;
    min-width: 150px;
    background: transparent;
}

/* --- Color Picker --- */
.color-picker-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 10px;
}

.color-swatch {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    cursor: pointer;
    border: 3px solid var(--color-bg-tertiary);
    transition: all var(--transition-fast);
}

.color-swatch:hover {
    transform: scale(1.1);
}

.color-swatch.selected {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px var(--color-primary);
}

/* --- Kebab Menus / Profile Headers --- */
.profile-header,
#accountModal .profile-header,
#eventDetailsModal .profile-header,
#eventModal .profile-header,
#timelineModal .profile-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    justify-content: space-between;
}

#profile-modal-name,
#accountModal .profile-header h2,
#eventDetailsModal .profile-header h2,
#eventModal .profile-header h2,
#timelineModal .profile-header h2 {
    margin-bottom: 0;
    font-size: 1.8em;
    word-wrap: break-word;
    flex-grow: 1;
}

#accountModal .profile-header h2,
#eventDetailsModal .profile-header h2,
#eventModal .profile-header h2 {
    margin-left: 0;
}

/* MODIFIED: Added new Timeline Kebab IDs */
.profile-options-container,
#timeline-options-container,
#canvas-timeline-options {
    position: relative;
    flex-shrink: 0;
}

.profile-options-btn {
    background: none;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color var(--transition-fast);
}

.profile-options-btn:hover {
    background-color: var(--color-bg-tertiary);
}

.profile-options-btn svg {
    width: 20px;
    height: 20px;
    fill: var(--color-text-secondary);
}

/* MODIFIED: Added new Timeline Kebab IDs */
.profile-options-menu,
#account-options-menu,
#event-details-options-menu,
#event-modal-options-menu,
#timeline-options-menu,
#timeline-options-menu-canvas {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--color-bg-primary);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    z-index: 1011;
    min-width: 180px;
    width: auto;
    overflow: hidden;
    padding: 5px 0;
    margin-top: 8px;
    backdrop-filter: none;
}

/* MODIFIED: Added new Timeline Kebab IDs */
.profile-options-menu.show,
#account-options-menu.show,
#event-details-options-menu.show,
#event-modal-options-menu.show,
#timeline-options-menu.show,
#timeline-options-menu-canvas.show {
    display: block;
}

/* MODIFIED: Added new Timeline Kebab IDs */
.profile-options-menu button,
#account-options-menu button,
#event-details-options-menu button,
#event-modal-options-menu button,
#timeline-options-menu button,
#timeline-options-menu-canvas button {
    display: block;
    width: 100%;
    background: none;
    border: none;
    padding: 10px 15px;
    text-align: left;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 500;
    white-space: nowrap;
}

/* MODIFIED: Added new Timeline Kebab IDs */
.profile-options-menu button:hover,
#account-options-menu button:hover,
#event-details-options-menu button:hover,
#event-modal-options-menu button:hover,
#timeline-options-menu button:hover,
#timeline-options-menu-canvas button:hover {
    background-color: var(--color-bg-secondary);
}

.profile-options-menu .profile-delete-option,
#account-options-menu .profile-delete-option,
#event-modal-options-menu .profile-delete-option {
    color: var(--color-danger);
}

#event-details-options-menu button,
#timeline-options-menu button,
#timeline-options-menu-canvas button {
    color: #333;
}

/* --- Notification Badge --- */
.notification-badge {
    position: absolute;
    top: 0px;
    right: 2px;
    width: 10px;
    height: 10px;
    background-color: #e74c3c;
    border-radius: 50%;
    border: 2px solid white;
    display: none;
    z-index: 10;
}

.notification-badge.is-visible {
    display: block;
}

/* Inline notification badge for section headers */
#pending-requests-badge {
    position: relative;
    top: auto;
    right: auto;
    display: none;
    margin-left: 8px;
    vertical-align: middle;
}

#pending-requests-badge.is-visible {
    display: inline-block;
}

/* --- Misc Components --- */
.details-divider {
    border: none;
    border-top: 1px solid var(--color-border-light);
    margin-bottom: 20px;
}

/* --- Event Attachments --- */
.attachments-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--color-border-light);
}

.attachments-section h4 {
    font-size: 0.95em;
    color: var(--color-text-primary);
    margin: 0 0 15px 0;
    font-weight: 600;
}

.attachment-upload {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

#eventAttachmentInput {
    display: none;
}

.attachment-upload-btn {
    background: transparent;
    color: var(--color-text-primary);
    border: none;
    padding: 4px 0;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 400;
    transition: opacity 0.2s;
}

.attachment-upload-btn:hover {
    opacity: 0.7;
}

.attachment-upload-btn:disabled {
    color: var(--color-border-light);
    cursor: not-allowed;
}

.attachments-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.attachment-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background: var(--color-bg-secondary);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--color-primary);
}

.attachment-icon {
    font-size: 1.5em;
    flex-shrink: 0;
}

.attachment-thumbnail {
    width: 50px;
    height: 50px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
}

.attachment-info {
    flex: 1;
    min-width: 0;
}

.attachment-name {
    display: block;
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
    word-break: break-word;
    overflow-wrap: break-word;
    font-size: 0.95em;
}

.attachment-name:hover {
    text-decoration: underline;
}

.attachment-meta {
    font-size: 0.85em;
    color: var(--color-text-muted);
    margin-top: 4px;
}

.attachment-delete-btn {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--color-danger);
    font-size: 1.3em;
    cursor: pointer;
    padding: 4px;
    transition: transform 0.2s, color 0.2s;
}

.attachment-delete-btn:hover {
    transform: scale(1.2);
    color: #b71c1c;
}

/* --- External Links Section --- */
.external-links-section {
    padding-top: 20px;
    border-top: 1px solid var(--color-border-light);
}

.external-links-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
}

.external-links-input-row input {
    width: auto;
}

.external-links-add-row {
    margin-bottom: 15px;
}

.external-link-url-input {
    flex: 2;
    padding: 8px 12px;
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-sm);
    font-size: 0.9em;
}

.external-link-label-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-sm);
    font-size: 0.9em;
}

.btn-add-external-link {
    background: transparent;
    color: var(--color-text-primary);
    border: none;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 500;
    transition: opacity 0.2s;
    white-space: nowrap;
}

.btn-add-external-link:hover {
    opacity: 0.7;
}

.external-links-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.external-link-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--color-bg-secondary);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--color-primary);
}

.external-link-icon {
    flex-shrink: 0;
    color: var(--color-primary);
    font-size: 1em;
}

.external-link-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.external-link-label {
    font-weight: 500;
    color: var(--color-text-primary);
    font-size: 0.9em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.external-link-url {
    font-size: 0.8em;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.external-link-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.external-link-open-btn,
.external-link-delete-btn {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    font-size: 1em;
    transition: transform 0.2s, opacity 0.2s;
}

.external-link-open-btn {
    color: var(--color-primary);
}

.external-link-open-btn:hover {
    transform: scale(1.1);
}

.external-link-delete-btn {
    color: var(--color-danger);
}

.external-link-delete-btn:hover {
    transform: scale(1.1);
}

/* External Links Dropdown Menu (for canvas) */
.external-links-dropdown-menu {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-width: 180px;
    max-width: 280px;
    overflow: hidden;
}

.external-links-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: white;
    cursor: pointer;
    text-align: left;
    font-size: 0.9em;
    transition: background-color 0.15s;
}

.external-links-menu-item:hover {
    background: var(--color-bg-secondary);
}

.external-links-menu-item .menu-item-icon {
    font-size: 1em;
    flex-shrink: 0;
}

.external-links-menu-item .menu-item-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--color-text-primary);
}

/* --- Groups List --- */
.group-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.group-list-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.group-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-sm);
    background: var(--color-bg-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.group-item:hover {
    background: var(--color-bg-tertiary);
    border-color: var(--color-primary);
    box-shadow: var(--shadow-primary-sm);
}

.group-item-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2em;
    font-weight: 600;
    flex-shrink: 0;
}

.group-item-info {
    flex: 1;
    min-width: 0;
}

.group-item-name {
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0 0 4px 0;
    word-break: break-word;
}

.group-item-role {
    font-size: 0.85em;
    color: var(--color-primary);
    font-weight: 500;
    display: inline-block;
    padding: 2px 8px;
    background: #f0f4ff;
    border-radius: 4px;
}


/* --- Group Plan Limits & Usage --- */

/* Usage Summary Header */
#groups-list-header {
    margin-bottom: 20px;
    padding: 12px;
    background: var(--color-bg-secondary);
    border-radius: 8px;
    border-left: 4px solid var(--color-primary);
}

#groups-list-header > div:first-child {
    font-size: 0.9em;
    color: var(--color-text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

/* Usage Summary & Progress Bar */
.usage-summary {
    margin: 12px 0;
}

.usage-bar {
    width: 100%;
    height: 24px;
    background: var(--color-bg-tertiary);
    border-radius: 12px;
    overflow: hidden;
    margin-top: 8px;
    border: 1px solid var(--color-border-light);
    position: relative;
}

.usage-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 12px;
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
    color: white;
    font-size: 0.75em;
    font-weight: 600;
}

.usage-bar.usage-warning .usage-fill {
    background: linear-gradient(90deg, var(--color-warning) 0%, #f57c00 100%);
}

.usage-bar.usage-critical .usage-fill {
    background: linear-gradient(90deg, var(--color-danger) 0%, #d32f2f 100%);
}

.usage-status {
    font-size: 0.8em;
    color: var(--color-text-secondary);
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.usage-status.warning {
    color: var(--color-warning);
    font-weight: 500;
}

.usage-status.critical {
    color: var(--color-danger);
    font-weight: 600;
}

#groupCreateWarning {
    margin-bottom: 16px;
}

/* Limit Warning Banners */
.limit-warning-banner {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    border-left: 4px solid;
}

.limit-warning-banner.info {
    background: #e3f2fd;
    border-left-color: var(--color-info);
    color: var(--color-info);
}

.limit-warning-banner.warning {
    background: #fff3e0;
    border-left-color: var(--color-warning);
    color: var(--color-warning);
}

.limit-warning-banner.critical {
    background: #ffebee;
    border-left-color: var(--color-danger);
    color: var(--color-danger);
}

.limit-warning-banner-icon {
    font-size: 1.2em;
    flex-shrink: 0;
    margin-top: 2px;
}

.limit-warning-banner-content {
    flex: 1;
    line-height: 1.4;
}

.limit-warning-banner-content p {
    margin: 0 0 8px 0;
    font-size: 0.9em;
}

.limit-warning-banner-action {
    margin-top: 8px;
}

.limit-warning-banner-action .btn-small {
    font-size: 0.75em;
    padding: 6px 12px;
}

/* Plan Badges */
.plan-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85em;
    font-weight: 600;
    letter-spacing: var(--letter-spacing-ui);
}

.plan-badge.basic {
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border-dark);
}

.plan-badge.plus {
    background: var(--gradient-primary);
    color: white;
}

.plan-badge.pro {
    background: var(--gradient-premium);
    color: white;
}

.plan-badge.clickable {
    cursor: pointer;
    transition: all 0.2s;
}

.plan-badge.clickable:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Plan Indicator in Headers */
.group-context-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.group-header-info {
    flex: 1;
}

.group-header-plan {
    margin-left: auto;
}

.group-header-plan .plan-badge {
    margin-left: 12px;
}

/* Storage Indicator */
.storage-indicator {
    margin: 16px 0;
}

.storage-label {
    font-size: 0.9em;
    color: var(--color-text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
    display: flex;
    justify-content: space-between;
}

.storage-label-text {
    flex: 1;
}

.storage-label-value {
    font-weight: 600;
    color: var(--color-text-primary);
}

.storage-bar {
    width: 100%;
    height: 20px;
    background: var(--color-bg-tertiary);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--color-border-light);
}

.storage-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 10px;
    transition: width 0.3s ease;
}

.storage-bar.storage-warning .storage-fill {
    background: linear-gradient(90deg, var(--color-warning) 0%, #f57c00 100%);
}

.storage-bar.storage-critical .storage-fill {
    background: linear-gradient(90deg, var(--color-danger) 0%, #d32f2f 100%);
}

.storage-status {
    font-size: 0.75em;
    color: var(--color-text-muted);
    margin-top: 4px;
    text-align: right;
}

/* Feature Availability Badges */
.feature-availability {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 500;
}

.feature-availability.available {
    background: #e8f5e9;
    color: var(--color-success);
}

.feature-availability.available::before {
    content: "✓";
    font-weight: bold;
}

.feature-availability.unavailable {
    background: #ffebee;
    color: #c62828;
}

.feature-availability.unavailable::before {
    content: "✗";
    font-weight: bold;
}

.feature-unavailable-message {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    margin: 12px 0;
    background: #fff3e0;
    border-left: 3px solid var(--color-warning);
    border-radius: 4px;
    color: var(--color-warning);
    font-size: 0.9em;
}

.feature-unavailable-message .icon {
    font-size: 1.2em;
}

.feature-unavailable-message .message {
    flex: 1;
}

.feature-unavailable-message .upgrade-link {
    white-space: nowrap;
    margin-left: auto;
}

/* Member Limit Display */
.member-usage-display {
    font-size: 0.85em;
    color: var(--color-text-secondary);
    margin: 8px 0;
    padding: 8px;
    background: var(--color-bg-secondary);
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.member-usage-display.warning {
    background: #fff3e0;
    color: var(--color-warning);
}

.member-usage-display.critical {
    background: #ffebee;
    color: var(--color-danger);
}

.member-slots-remaining {
    font-weight: 600;
}

/* Responsive adjustments for mobile */
@media (max-width: 768px) {
    .limit-warning-banner {
        flex-direction: column;
    }
    
    .group-context-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .group-header-plan {
        margin-left: 0;
        margin-top: 8px;
    }
    
    #groups-list-header {
        margin-bottom: 12px;
        padding: 8px;
    }
    
    .plan-badge {
        font-size: 0.8em;
        padding: 4px 8px;
    }
}

/* --- Group Settings Tab --- */

.group-settings-container {
    padding: 20px;
    max-width: 800px;
    margin: 0 auto;
}

/* Settings section - similar to .card but with custom radius and no hover effects */
.settings-section {
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border-light);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.settings-section h3 {
    margin-top: 0;
    margin-bottom: 16px;
    font-size: 1.1em;
    color: var(--color-text-primary);
    border-bottom: 2px solid var(--color-bg-secondary);
    padding-bottom: 8px;
}

.storage-section-content,
.plan-section-content,
.info-section-content,
.upgrade-section-content {
    padding: 8px 0;
}

/* Plan Badge Large */
.plan-badge-large {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: 600;
    letter-spacing: var(--letter-spacing-ui);
    text-align: center;
    margin-bottom: 16px;
}

.plan-badge-large.basic {
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
    border: 2px solid var(--color-border-dark);
}

.plan-badge-large.plus {
    background: var(--gradient-primary);
    color: white;
}

.plan-badge-large.pro {
    background: var(--gradient-premium);
    color: white;
}

/* Plan Features List */
.plan-features {
    margin-top: 12px;
}

.plan-features h4 {
    margin: 12px 0 8px 0;
    color: var(--color-text-primary);
    font-size: 0.95em;
}

.plan-features ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.plan-features li {
    padding-left: 24px;
    position: relative;
    color: var(--color-text-secondary);
    font-size: 0.9em;
    line-height: 1.4;
}

.plan-features li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--color-success);
    font-weight: bold;
}

/* Group Details List */
.group-details-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.detail-item {
    display: flex;
    padding: 8px 0;
    border-bottom: 1px solid var(--color-bg-secondary);
}

.detail-item:last-child {
    border-bottom: none;
}

.detail-label {
    font-weight: 600;
    color: var(--color-text-secondary);
    min-width: 120px;
    font-size: 0.9em;
}

.detail-value {
    color: var(--color-text-primary);
    flex: 1;
    word-break: break-word;
}

/* Upgrade Section */
.upgrade-section {
    background: linear-gradient(135deg, var(--color-bg-secondary) 0%, var(--color-bg-tertiary) 100%);
    border: 2px solid #ffc107;
}

.upgrade-suggestion {
    padding: 8px 0;
}

.upgrade-suggestion p {
    margin: 0 0 12px 0;
    color: var(--color-text-primary);
    font-size: 0.95em;
}

.upgrade-suggestion ul {
    list-style: none;
    padding: 0;
    margin: 0 0 16px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.upgrade-suggestion li {
    padding-left: 24px;
    position: relative;
    color: #555;
    font-size: 0.9em;
    line-height: 1.4;
}
/* ═══════════════════════════════════════════════════════════════ */
/* GROUP MESSAGING MODAL - Matches Messages modal styling */
/* ═══════════════════════════════════════════════════════════════ */

/* Group Messaging reuses message-modal-content, message-container, message-sidebar, message-main */
/* These are defined in css/5-features.css */

/* Group-specific styling for threads list */
.group-messaging-header-bar {
    padding: 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
}

.group-messaging-header-bar h3 {
    flex: 1;
}

/* Threads list items inherit from friend-list and friend-item */
#group-thread-list {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px;
}

#group-thread-list .group-thread-item {
    background: #fff;
    border: none;
    border-bottom: 1px solid #f0f0f0;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    gap: 10px;
}

#group-thread-list .group-thread-item:last-child {
    border-bottom: none;
}

#group-thread-list .group-thread-item:hover {
    background: #f9f9f9;
}

#group-thread-list .group-thread-item.active {
    background: #edf2fa;
}

#group-thread-list .group-thread-content {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

#group-thread-list .group-thread-title {
    font-weight: 500;
    font-size: 0.95em;
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#group-thread-list .group-thread-date {
    font-size: 0.8em;
    color: var(--color-text-muted);
    font-weight: 500;
    padding: 0 5px;
    display: block;
}

/* Message header for group (thread selected) */
#group-message-header {
    background: var(--color-bg-secondary);
    border-bottom: 1px solid var(--color-border-light);
    padding: 15px 20px;
    border-radius: 0;
}

#group-message-header-name {
    font-size: 1.1em;
    color: var(--color-text-primary);
    font-weight: normal;
}

/* Group message list (reuses message-window styling) */
.group-message-window {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--color-bg-secondary);
    display: flex;
    flex-direction: column;
    border-radius: 0;
}

/* Individual group message styling */
#group-message-list .group-message-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 15px;
    flex-direction: row;
}

#group-message-list .group-message-item.own-message {
    justify-content: flex-end;
}

#group-message-list .group-message-header {
    font-size: 0.85em;
    color: var(--color-text-secondary);
    margin-bottom: 4px;
    font-weight: 500;
}

#group-message-list .group-message-item.own-message .group-message-header {
    display: none;
}

#group-message-list .group-message-text {
    padding: 12px 18px;
    border-radius: 20px;
    background: #e0e0e0;
    color: #333;
    max-width: 70%;
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.5;
    border-top-left-radius: 5px;
    display: flex;
    flex-direction: column;
}

#group-message-list .group-message-item.own-message .group-message-text {
    background: var(--color-primary);
    color: white;
    border-top-right-radius: 5px;
    border-top-left-radius: 20px;
}

/* Group message input area */
#group-message-input-area {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 10px 15px;
    border-top: 1px solid #eee;
    background: #fff;
    margin-bottom: 0;
}

#group-message-input {
    flex-grow: 1;
    border: 2px solid #ddd;
    border-radius: 20px;
    padding: 10px 15px;
    font-size: 1em;
    line-height: 1.4;
    outline: none;
    transition: border-color 0.2s;
    resize: none;
    max-height: 130px;
    overflow-y: auto;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

#group-message-input:focus {
    border-color: var(--color-primary);
}

#group-message-send-btn {
    flex-shrink: 0;
    background: var(--color-primary);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
    color: white;
    padding: 0;
    margin-bottom: 5px;
}

#group-message-send-btn:hover {
    background: #5567d8;
}

#group-message-send-btn svg {
    width: 20px;
    height: 20px;
    margin-left: 2px;
}
.upgrade-suggestion li::before {
    content: "→";
    position: absolute;
    left: 6px;
    color: #ffc107;
    font-weight: bold;
}

/* Responsive Settings */
@media (max-width: 768px) {
    .group-settings-container {
        padding: 12px;
    }
    
    .settings-section {
        padding: 16px;
        margin-bottom: 16px;
    }
    
    .plan-badge-large {
        padding: 10px 20px;
        font-size: 1em;
    }
    
    .detail-item {
        flex-direction: column;
        gap: 4px;
    }
    
    .detail-label {
        min-width: auto;
    }
}

/* --- Group Lifecycle Actions --- */

.group-context-menu {
    position: relative;
}

.group-context-menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 180px;
    z-index: 1000;
    overflow: hidden;
}

.group-context-menu-dropdown button {
    display: block;
    width: 100%;
    padding: 10px 16px;
    text-align: left;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.9em;
    color: #666;
    transition: background 0.2s;
}

.group-context-menu-dropdown button:hover {
    background: #f5f5f5;
}

.group-context-menu-dropdown button:active {
    background: #efefef;
}

.group-context-menu-dropdown button.danger {
    color: var(--color-danger);
}

.group-context-menu-dropdown button.danger:hover {
    background: #ffebee;
}

/* Lifecycle actions section in Settings */
.lifecycle-actions-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 2px solid #f0f0f0;
}

.danger-zone {
    border: 2px solid var(--color-danger) !important;
    background: #ffebee !important;
}

.danger-zone h3 {
    color: #c62828 !important;
    margin-top: 0;
}

.lifecycle-action-button {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    width: 100%;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 500;
    transition: all 0.2s;
    gap: 8px;
}

.lifecycle-action-button:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.lifecycle-action-button:active:not(:disabled) {
    transform: translateY(0);
}

.lifecycle-action-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.lifecycle-action-button.transfer {
    background: #ffc107;
    color: #333;
}

.lifecycle-action-button.transfer:hover:not(:disabled) {
    background: #ffb300;
}

.lifecycle-action-button.delete {
    background: var(--color-danger);
    color: white;
}

.lifecycle-action-button.delete:hover:not(:disabled) {
    background: #d32f2f;
}

.lifecycle-action-button.leave {
    background: var(--color-danger);
    color: white;
}

.lifecycle-action-button.leave:hover:not(:disabled) {
    background: #d32f2f;
}

/* Transfer ownership modal */
#transferOwnershipModal {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

#transferOwnershipModal .modal-content {
    background: white;
    border-radius: 12px;
    padding: 24px;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

#transferOwnershipModal h2 {
    margin-top: 0;
    color: #333;
}

.transfer-member-option {
    display: flex;
    align-items: center;
    padding: 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.transfer-member-option:hover {
    background: #f5f5f5;
}

.transfer-member-option input[type="radio"] {
    margin-right: 12px;
    cursor: pointer;
}

.transfer-member-info {
    flex: 1;
}

.transfer-member-name {
    font-weight: 500;
    color: #333;
    margin-bottom: 4px;
}

.transfer-member-email {
    font-size: 0.85em;
    color: #999;
}

.transfer-member-role {
    display: inline-block;
    font-size: 0.75em;
    color: #999;
    margin-left: 4px;
}

/* Transfer warning box */
.transfer-warning {
    background: #fff3e0;
    padding: 12px;
    border-radius: 6px;
    border-left: 4px solid #ff9800;
    margin: 16px 0;
    font-size: 0.9em;
    color: #e65100;
}

.transfer-warning strong {
    color: #e65100;
    display: block;
    margin-bottom: 8px;
}

.transfer-warning ul {
    list-style: none;
    padding-left: 12px;
    margin: 0;
}

.transfer-warning li {
    padding: 2px 0;
}

.transfer-warning li::before {
    content: "• ";
    margin-right: 6px;
}

/* ========================================================================== */
/* --- Inline Message Editing --- */
/* ========================================================================== */

/**
 * Textarea for inline message editing
 * Used for both direct messages and group messages
 * Full width, comfortable padding, primary color border
 */
.inline-message-edit {
    width: 100%;
    padding: var(--spacing-md);
    border: 2px solid var(--color-primary);
    border-radius: var(--radius-md);
    font-family: var(--font-family-base);
    font-size: var(--font-size-base);
    resize: vertical;
    min-height: 60px;
    box-sizing: border-box;
}

.inline-message-edit:focus {
    outline: none;
    border-color: var(--color-primary-dark);
    box-shadow: var(--shadow-primary-sm);
}

/**
 * Container for edit action buttons
 * Holds save, delete, and cancel buttons side-by-side
 */
.edit-buttons-container {
    display: flex;
    gap: var(--spacing-md);
    margin-top: var(--spacing-md);
}

/**
 * Save button for message editing
 * Primary action - inherits from .btn-primary styles
 * Slightly smaller than full buttons for inline context
 */
.edit-save-btn {
    padding: var(--spacing-sm) var(--spacing-lg);
    background: var(--color-primary);
    color: var(--color-text-on-brand);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.9em;
    font-weight: var(--font-weight-bold);
    font-family: var(--font-family-base);
    transition: all var(--transition-fast);
}

.edit-save-btn:hover {
    background: var(--color-primary-dark);
    box-shadow: var(--shadow-primary-md);
    transform: translateY(-1px);
}

.edit-save-btn:active {
    transform: translateY(0);
    box-shadow: var(--shadow-primary-sm);
}

/**
 * Delete button for message editing
 * Danger action - inherits from .btn-danger styles
 */
.edit-delete-btn {
    padding: var(--spacing-sm) var(--spacing-lg);
    background: var(--color-danger);
    color: var(--color-text-on-brand);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.9em;
    font-weight: var(--font-weight-bold);
    font-family: var(--font-family-base);
    transition: all var(--transition-fast);
}

.edit-delete-btn:hover {
    background: #da190b;
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.edit-delete-btn:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

/**
 * Cancel button for message editing
 * Secondary action - inherits from .btn-secondary styles
 */
.edit-cancel-btn {
    padding: var(--spacing-sm) var(--spacing-lg);
    background: var(--color-bg-primary);
    border: 2px solid var(--color-border-light);
    color: var(--color-text-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.9em;
    font-weight: var(--font-weight-bold);
    font-family: var(--font-family-base);
    transition: all var(--transition-fast);
}

.edit-cancel-btn:hover {
    background: var(--color-bg-secondary);
    border-color: var(--color-border-medium);
    color: var(--color-text-primary);
    box-shadow: var(--shadow-xs);
}

.edit-cancel-btn:active {
    box-shadow: none;
}

/* ========================================================================== */
/* --- Utility Classes --- */
/* ========================================================================== */

/**
 * Hidden utility class
 * Use this class to hide elements instead of inline style.display = 'none'
 * This provides a single source of truth for visibility management
 */
.u-hidden {
    display: none !important;
}

/* ========================================================================== */
/* --- Cluster Event Selection Popup --- */
/* ========================================================================== */

/**
 * Popup container for selecting events within a cluster
 * Positioned absolutely relative to the canvas wrapper
 */
.cluster-popup {
    position: fixed;
    z-index: 1100;
    background: var(--color-bg-primary, #fff);
    border: 1px solid var(--color-border-light, #e0e0e0);
    border-radius: var(--radius-lg, 12px);
    box-shadow: var(--shadow-lg, 0 8px 24px rgba(0, 0, 0, 0.15));
    min-width: 220px;
    max-width: 280px;
    /* Keep visible for arrow pseudo-element */
    overflow: visible;
}

/* Inner wrapper clips scrollbar to border-radius */
.cluster-popup-content {
    border-radius: var(--radius-lg, 12px);
    overflow: hidden;
}

.cluster-popup-list {
    /* Max height for 4 items fully visible */
    max-height: 248px;
    overflow-y: auto;
    padding: 10px 0;
}

.cluster-popup-item {
    padding: 10px 14px;
    cursor: pointer;
    transition: background-color 0.15s ease;
    border-bottom: 1px solid var(--color-border-light, #f0f0f0);
}

.cluster-popup-item:last-child {
    border-bottom: none;
}

.cluster-popup-item:hover {
    background-color: var(--color-bg-hover, #f5f5f5);
}

.cluster-popup-item-name {
    font-size: 0.95em;
    font-weight: 500;
    color: var(--color-text-primary, #333);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cluster-popup-item-date {
    font-size: 0.8em;
    color: var(--color-text-tertiary, #888);
}

/* Arrow/caret pointing to the cluster */
.cluster-popup::before {
    content: '';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-style: solid;
    z-index: 2;
}

.cluster-popup.popup-left::before {
    right: -10px;
    border-width: 12px 0 12px 12px;
    border-color: transparent transparent transparent #fff;
}

.cluster-popup.popup-right::before {
    left: -10px;
    border-width: 12px 12px 12px 0;
    border-color: transparent #fff transparent transparent;
}

/* Remove the border effect - just use white arrow */
.cluster-popup::after {
    display: none;
}
