/* ============================================
   Drone Dashboard - UI Components
   ============================================ */

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 10px 20px;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    background: var(--bg-medium);
    color: var(--text-primary);
    font-size: var(--font-size-md);
    font-weight: 500;
    transition: all var(--transition-fast);
    white-space: nowrap;
    user-select: none;
    line-height: 1.4;
}
.btn:hover { background: var(--border-medium); border-color: var(--border-light); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn i { font-size: 0.9em; }

.btn-primary { background: var(--accent-primary); color: #fff; border-color: var(--accent-primary); font-weight: 600; }
.btn-primary:hover { background: var(--accent-primary-hover); border-color: var(--accent-primary-hover); box-shadow: var(--shadow-glow-purple); }

.btn-secondary { background: var(--accent-blue); color: #fff; border-color: var(--accent-blue); }
.btn-secondary:hover { background: var(--accent-blue-hover); border-color: var(--accent-blue-hover); box-shadow: var(--shadow-glow-blue); }

.btn-danger { background: var(--error); color: #fff; border-color: var(--error); }
.btn-danger:hover { background: #ff4444; box-shadow: var(--shadow-glow-error); }

.btn-success { background: var(--success); color: #000; border-color: var(--success); font-weight: 600; }
.btn-success:hover { background: #33eb8a; box-shadow: var(--shadow-glow-success); }

.btn-outline { background: transparent; }
.btn-outline:hover { background: rgba(255,255,255,0.05); }

.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: rgba(255,255,255,0.05); border-color: transparent; }

.btn-small { padding: 6px 12px; font-size: var(--font-size-sm); }
.btn-large { padding: 14px 28px; font-size: var(--font-size-base); }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: var(--radius-md); }
.btn-icon.btn-small { width: 28px; height: 28px; }

.btn-discord {
    background: var(--discord-blurple);
    color: #fff;
    border-color: var(--discord-blurple);
    font-size: var(--font-size-base);
    padding: 12px 24px;
}
.btn-discord:hover { background: #4752c4; }

.btn-group { display: flex; gap: 0; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--radius-md) 0 0 var(--radius-md); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--radius-md) var(--radius-md) 0; }
.btn-group .btn.active { background: var(--accent-primary); color: #fff; border-color: var(--accent-primary); z-index: 1; }

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-normal);
}
.card:hover { border-color: rgba(124, 77, 255, 0.3); box-shadow: 0 4px 20px rgba(124, 77, 255, 0.08); }
.card-header {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-dark);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
}
.card-header h3, .card-header h4 { margin: 0; }
.card-body { padding: var(--space-sm) var(--space-md); }
.card-footer { padding: var(--space-md) var(--space-lg); border-top: 1px solid var(--border-dark); }
.card-glass {
    background: rgba(22, 22, 37, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(124, 77, 255, 0.08);
}

/* Stat Cards */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    transition: all var(--transition-normal);
}
.stat-card:hover { border-color: rgba(124, 77, 255, 0.3); transform: translateY(-2px); box-shadow: 0 4px 20px rgba(124, 77, 255, 0.1); }
.stat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}
.stat-card-icon.gold { background: var(--accent-gold-dim); color: var(--accent-gold); }
.stat-card-icon.blue { background: var(--accent-blue-dim); color: var(--accent-blue); }
.stat-card-icon.green { background: var(--success-dim); color: var(--success); }
.stat-card-icon.red { background: var(--error-dim); color: var(--error); }
.stat-card-icon.orange { background: var(--warning-dim); color: var(--warning); }
.stat-card-info { flex: 1; min-width: 0; }
.stat-card-label { font-size: var(--font-size-sm); color: var(--text-muted); margin-bottom: 2px; }
.stat-card-value { font-size: var(--font-size-2xl); font-weight: 700; line-height: 1.2; }
.stat-card-trend { font-size: var(--font-size-sm); margin-top: 4px; display: flex; align-items: center; gap: 4px; }
.stat-card-trend.up { color: var(--success); }
.stat-card-trend.down { color: var(--error); }
.stat-card-trend.neutral { color: var(--text-muted); }

/* Tables */
.table-wrapper { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border-dark); }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--bg-dark);
    border-bottom: 1px solid var(--border-dark);
    white-space: nowrap;
    cursor: default;
    user-select: none;
}
.data-table th.sortable { cursor: pointer; }
.data-table th.sortable:hover { color: var(--text-primary); }
.data-table th .sort-icon { margin-left: 4px; font-size: 0.75em; opacity: 0.4; }
.data-table th.sorted .sort-icon { opacity: 1; color: var(--accent-primary); }
.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-dark);
    font-size: var(--font-size-md);
    color: var(--text-secondary);
    vertical-align: middle;
}
.data-table tbody tr { transition: background var(--transition-fast); }
.data-table tbody tr:hover { background: rgba(124, 77, 255, 0.05); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr.striped:nth-child(even) { background: rgba(255,255,255,0.02); }

/* Forms */
.form-group { margin-bottom: 10px; }
.form-label {
    display: block;
    font-size: var(--font-size-md);
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}
.form-label .required { color: var(--error); margin-left: 2px; }
.form-hint { font-size: var(--font-size-sm); color: var(--text-muted); margin-top: var(--space-xs); }
.form-row { display: flex; gap: var(--space-md); }
.form-row .form-group { flex: 1; }

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--font-size-md);
    transition: all var(--transition-fast);
    outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-dim);
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-dimmed); }
.form-input.error, .form-select.error, .form-textarea.error { border-color: var(--error); }
.form-input:disabled, .form-select:disabled { opacity: 0.5; cursor: not-allowed; }

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23808080' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
}

.form-textarea { resize: vertical; min-height: 100px; }

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
    user-select: none;
}
.toggle-switch input { display: none; }
.toggle-slider {
    width: 44px;
    height: 24px;
    background: var(--border-medium);
    border-radius: var(--radius-full);
    position: relative;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}
.toggle-slider::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background: var(--text-primary);
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: transform var(--transition-fast);
}
.toggle-switch input:checked + .toggle-slider { background: var(--accent-primary); }
.toggle-switch input:checked + .toggle-slider::after { transform: translateX(20px); }
.toggle-switch .toggle-label { font-size: var(--font-size-md); color: var(--text-secondary); }

/* Checkbox */
.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
    user-select: none;
}
.checkbox-wrapper input[type="checkbox"] { display: none; }
.checkbox-custom {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-medium);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}
.checkbox-wrapper input:checked + .checkbox-custom {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}
.checkbox-wrapper input:checked + .checkbox-custom::after {
    content: '\f00c';
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 11px;
    color: #fff;
}

/* Radio */
.radio-wrapper {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
    user-select: none;
}
.radio-wrapper input[type="radio"] { display: none; }
.radio-custom {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-medium);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}
.radio-wrapper input:checked + .radio-custom { border-color: var(--accent-primary); }
.radio-wrapper input:checked + .radio-custom::after {
    content: '';
    width: 10px;
    height: 10px;
    background: var(--accent-primary);
    border-radius: 50%;
}

/* Range Slider */
.range-slider { width: 100%; appearance: none; height: 6px; background: var(--border-medium); border-radius: var(--radius-full); outline: none; }
.range-slider::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--accent-primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 6px rgba(124,77,255,0.4);
}
.range-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--accent-primary);
    border: none;
    border-radius: 50%;
    cursor: pointer;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}
.badge-success { background: var(--success-dim); color: var(--success); }
.badge-danger { background: var(--error-dim); color: var(--error); }
.badge-warning { background: var(--warning-dim); color: var(--warning); }
.badge-info { background: var(--info-dim); color: var(--info); }
.badge-gold { background: var(--accent-primary-dim); color: var(--accent-primary); }
.badge-neutral { background: rgba(255,255,255,0.1); color: var(--text-muted); }

/* Tags */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: var(--bg-medium);
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}
.tag-remove {
    width: 16px;
    height: 16px;
    border: none;
    background: rgba(255,255,255,0.1);
    color: var(--text-muted);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    cursor: pointer;
    transition: all var(--transition-fast);
}
.tag-remove:hover { background: var(--error); color: #fff; }
.tag.tag-role { border-left: 3px solid var(--accent-blue); border-radius: var(--radius-sm); }
.tag.tag-channel { border-left: 3px solid var(--accent-primary); border-radius: var(--radius-sm); }

/* Dropdowns */
.dropdown { position: relative; display: inline-block; }
.dropdown-trigger { cursor: pointer; }
.dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 200px;
    background: var(--bg-dark);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: var(--z-dropdown);
    display: none;
    animation: fadeInDown 0.15s ease;
    overflow: hidden;
}
.dropdown-menu.right { left: auto; right: 0; }
.dropdown-menu.show { display: block; }
.dropdown-item {
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    color: var(--text-secondary);
    font-size: var(--font-size-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}
.dropdown-item:hover { background: var(--bg-medium); color: var(--text-primary); }
.dropdown-item.active { color: var(--accent-primary); }
.dropdown-item.danger { color: var(--error); }
.dropdown-divider { height: 1px; background: var(--border-dark); margin: 4px 0; }

/* Tabs */
.tab-bar {
    display: flex;
    border-bottom: 1px solid var(--border-dark);
    gap: 0;
    overflow-x: auto;
    scrollbar-width: none;
}
.tab-bar::-webkit-scrollbar { display: none; }
.tab {
    padding: 10px 16px;
    color: var(--text-muted);
    font-size: var(--font-size-md);
    font-weight: 500;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}
.tab:hover { color: var(--text-secondary); }
.tab.active { color: var(--accent-primary); border-bottom-color: var(--accent-primary); }
.tab-content { display: none; padding: var(--space-sm) 0; animation: fadeIn 0.2s ease; }
.tab-content.active { display: block; }

/* Modals - base */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: var(--z-modal-overlay);
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.15s ease;
}
.modal-overlay.show { display: flex; }
.modal {
    background: var(--bg-dark);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 560px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-xl);
    animation: scaleIn 0.12s ease;
}
.modal-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-dark);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-header h3 { font-size: var(--font-size-lg); }
.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}
.modal-close:hover { background: rgba(255,255,255,0.1); color: var(--text-primary); }
.modal-body { padding: var(--space-md); overflow-y: auto; flex: 1; }
.modal-footer {
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--border-dark);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: var(--space-lg);
    right: var(--space-lg);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    pointer-events: none;
}
.toast {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: 14px 20px;
    background: var(--bg-dark);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 300px;
    max-width: 450px;
    animation: toastIn 0.3s ease;
    pointer-events: all;
    border-left: 3px solid var(--border-light);
}
.toast.removing { animation: toastOut 0.3s ease forwards; }
.toast-icon { font-size: 1.1rem; flex-shrink: 0; }
.toast-message { flex: 1; font-size: var(--font-size-md); color: var(--text-secondary); }
.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    font-size: 0.8rem;
    transition: color var(--transition-fast);
}
.toast-close:hover { color: var(--text-primary); }
.toast-success { border-left-color: var(--success); }
.toast-success .toast-icon { color: var(--success); }
.toast-error { border-left-color: var(--error); }
.toast-error .toast-icon { color: var(--error); }
.toast-warning { border-left-color: var(--warning); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-info { border-left-color: var(--info); }
.toast-info .toast-icon { color: var(--info); }

/* Spinner */
.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border-dark);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
.spinner-small { width: 20px; height: 20px; border-width: 2px; }
.spinner-large { width: 48px; height: 48px; border-width: 4px; }
.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 10, 18, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: inherit;
    z-index: 10;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-medium);
    border-radius: var(--radius-full);
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-primary-hover));
    border-radius: var(--radius-full);
    transition: width var(--transition-normal);
}
.progress-fill.blue { background: linear-gradient(90deg, var(--accent-blue), var(--accent-blue-hover)); }
.progress-fill.green { background: linear-gradient(90deg, #00cc00, var(--success)); }
.progress-fill.red { background: linear-gradient(90deg, #cc0000, var(--error)); }

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    justify-content: center;
    padding: var(--space-md) 0;
}
.pagination-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: var(--font-size-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}
.pagination-btn:hover { border-color: var(--border-medium); color: var(--text-primary); }
.pagination-btn.active { background: var(--accent-primary); color: #fff; border-color: var(--accent-primary); font-weight: 600; }
.pagination-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.pagination-info { color: var(--text-muted); font-size: var(--font-size-sm); margin: 0 var(--space-sm); }

/* Search Input */
.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}
.search-input-wrapper .search-icon {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
    font-size: 0.9rem;
    pointer-events: none;
}
.search-input-wrapper .form-input { padding-left: 36px; }
.search-input-wrapper .search-clear {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    font-size: 0.8rem;
    display: none;
}
.search-input-wrapper .search-clear.show { display: block; }

/* Channel Selector */
.channel-selector {
    background: var(--bg-input);
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-md);
    max-height: 200px;
    overflow-y: auto;
}
.channel-option {
    padding: 8px 14px;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
    transition: background var(--transition-fast);
    font-size: var(--font-size-md);
    color: var(--text-secondary);
}
.channel-option:hover { background: var(--bg-medium); }
.channel-option.selected { background: var(--accent-primary-dim); color: var(--accent-primary); }
.channel-option i { color: var(--text-muted); width: 16px; text-align: center; }
.channel-option.selected i { color: var(--accent-primary); }
.channel-hash { font-weight: 700; opacity: 0.7; }

/* Role Selector */
.role-selector { display: flex; flex-wrap: wrap; gap: var(--space-sm); }
.role-option {
    padding: 6px 14px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-dark);
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
}
.role-option:hover { border-color: var(--border-medium); }
.role-option.selected { border-color: var(--accent-primary); background: var(--accent-primary-dim); color: var(--accent-primary); }
.role-color-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* Embed Builder Preview */
.embed-preview {
    background: #2f3136;
    border-radius: var(--radius-md);
    padding: var(--space-md);
    border-left: 4px solid var(--accent-primary);
    max-width: 520px;
}
.embed-preview-author {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
    font-size: var(--font-size-sm);
    font-weight: 600;
}
.embed-preview-author img { width: 24px; height: 24px; border-radius: 50%; }
.embed-preview-title { font-size: var(--font-size-base); font-weight: 700; color: #fff; margin-bottom: var(--space-sm); }
.embed-preview-description { font-size: var(--font-size-md); color: #dcddde; line-height: 1.5; }
.embed-preview-fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-sm); margin-top: var(--space-md); }
.embed-preview-field { }
.embed-preview-field.full { grid-column: 1 / -1; }
.embed-preview-field-name { font-size: var(--font-size-sm); font-weight: 600; color: #fff; margin-bottom: 2px; }
.embed-preview-field-value { font-size: var(--font-size-sm); color: #dcddde; }
.embed-preview-footer {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-top: var(--space-md);
    font-size: var(--font-size-xs);
    color: #72767d;
}
.embed-preview-footer img { width: 20px; height: 20px; border-radius: 50%; }
.embed-preview-image { margin-top: var(--space-md); border-radius: var(--radius-sm); max-width: 100%; }
.embed-preview-thumbnail { width: 80px; height: 80px; border-radius: var(--radius-sm); object-fit: cover; float: right; margin-left: var(--space-md); }

/* Timeline */
.timeline { position: relative; padding-left: 30px; }
.timeline::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-dark);
}
.timeline-item { position: relative; padding-bottom: var(--space-lg); }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
    position: absolute;
    left: -25px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--border-medium);
    border: 2px solid var(--bg-darkest);
}
.timeline-dot.gold { background: var(--accent-primary); }
.timeline-dot.red { background: var(--error); }
.timeline-dot.green { background: var(--success); }
.timeline-dot.blue { background: var(--accent-blue); }
.timeline-time { font-size: var(--font-size-xs); color: var(--text-muted); }
.timeline-content { font-size: var(--font-size-md); color: var(--text-secondary); margin-top: 2px; }

/* Empty State */
.empty-state {
    text-align: center;
    padding: var(--space-3xl) var(--space-xl);
    color: var(--text-muted);
}
.empty-state-icon { font-size: 3rem; margin-bottom: var(--space-md); opacity: 0.4; }
.empty-state-title { font-size: var(--font-size-lg); color: var(--text-secondary); margin-bottom: var(--space-sm); }
.empty-state-text { font-size: var(--font-size-md); max-width: 400px; margin: 0 auto var(--space-lg); }

/* Tooltips */
.tooltip { position: relative; }
.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 12px;
    background: var(--bg-dark);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--transition-fast);
    z-index: var(--z-tooltip);
}
.tooltip:hover::after { opacity: 1; }

/* Color Picker */
.color-picker-wrapper { display: flex; align-items: center; gap: var(--space-sm); }
.color-picker-preview {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border-medium);
    cursor: pointer;
}
.color-picker-input { width: 100px; }

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, var(--bg-medium) 25%, var(--border-dark) 50%, var(--bg-medium) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}
.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-text:last-child { width: 60%; }
.skeleton-title { height: 24px; width: 40%; margin-bottom: 16px; }
.skeleton-card { height: 120px; }

/* Embed Builder */
.embed-builder { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-lg); }
.embed-builder-form { display: flex; flex-direction: column; gap: var(--space-md); }
.embed-builder-preview-container { position: sticky; top: var(--space-lg); }

@media (max-width: 768px) {
    .embed-builder { grid-template-columns: 1fr; }
    .toast-container { left: var(--space-md); right: var(--space-md); top: var(--space-md); }
    .toast { min-width: auto; }
    .form-row { flex-direction: column; }
}

/* Searchable Select Dropdown */
.searchable-select { position: relative; width: 100%; }
.ss-display {
    background: var(--bg-input);
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--text-primary);
    font-size: var(--font-size-md);
    transition: border-color var(--transition-fast);
}
.ss-display:hover { border-color: var(--border-medium); }
.searchable-select.open .ss-display { border-color: var(--accent-primary); }
.ss-arrow { font-size: 12px; color: var(--text-muted); transition: transform var(--transition-fast); }
.searchable-select.open .ss-arrow { transform: rotate(180deg); }
.ss-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--bg-dark);
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-md);
    margin-top: 4px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    overflow: hidden;
}
.searchable-select.open .ss-dropdown { display: block; }
.ss-search {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: none;
    border-bottom: 1px solid var(--border-dark);
    color: var(--text-primary);
    font-size: var(--font-size-md);
    outline: none;
    box-sizing: border-box;
}
.ss-search::placeholder { color: var(--text-muted); }
.ss-search:focus { border-color: var(--accent-primary); }
.ss-options { max-height: 220px; overflow-y: auto; }
.ss-option {
    padding: 8px 14px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: var(--font-size-md);
    transition: background var(--transition-fast);
}
.ss-option:hover { background: var(--bg-medium); color: var(--text-primary); }
.ss-option[data-selected] { background: var(--accent-primary-dim); color: var(--accent-primary); }

/* Multi-select search input */
.multi-searchable .ss-search {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--font-size-md);
    outline: none;
    margin-bottom: 8px;
    box-sizing: border-box;
}
.multi-searchable .ss-search:focus { border-color: var(--accent-primary); }
.multi-searchable .ss-search::placeholder { color: var(--text-muted); }

/* ============================================
   Advanced Embed Builder Styles
   ============================================ */
.eb-wrapper { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; min-height: 400px; }
.eb-editor { display: flex; flex-direction: column; min-width: 0; }
.eb-preview { display: flex; flex-direction: column; min-width: 0; }
.eb-preview-label { font-size: var(--font-size-sm); color: var(--text-muted); margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.eb-preview-area { background: #36393f; border-radius: var(--radius-md); padding: 16px; min-height: 200px; overflow-y: auto; max-height: 600px; }

.eb-tabs { display: flex; align-items: center; border-bottom: 1px solid var(--border-dark); gap: 0; flex-wrap: wrap; }
.eb-tab { padding: 8px 14px; background: none; border: none; border-bottom: 2px solid transparent; color: var(--text-muted); cursor: pointer; font-size: var(--font-size-sm); display: flex; align-items: center; gap: 6px; transition: all var(--transition-fast); }
.eb-tab:hover { color: var(--text-secondary); }
.eb-tab.active { color: var(--accent-primary); border-bottom-color: var(--accent-primary); }
.eb-tab-actions { margin-left: auto; display: flex; gap: 4px; padding: 4px 0; }
.eb-tab-content { flex: 1; overflow-y: auto; max-height: 550px; padding: 12px 0; }

.eb-section { margin-bottom: 12px; }
.eb-label { font-size: var(--font-size-sm); color: var(--text-muted); margin-bottom: 4px; display: flex; align-items: center; justify-content: space-between; }
.eb-char-count { font-size: var(--font-size-xs); color: var(--text-dimmed); font-family: var(--font-mono); }
.eb-char-count.warning { color: var(--warning); }
.eb-char-count.error { color: var(--error); font-weight: 600; }

.eb-color-row { display: flex; align-items: center; gap: 8px; }
.eb-color-picker { width: 36px; height: 36px; border: 2px solid var(--border-medium); border-radius: var(--radius-md); cursor: pointer; padding: 0; }
.eb-color-hex { width: 100px !important; font-family: var(--font-mono); }

.eb-embed-nav { display: flex; gap: 4px; margin-bottom: 12px; flex-wrap: wrap; }
.eb-embed-tab { padding: 6px 12px; background: var(--bg-medium); border: 1px solid var(--border-dark); border-radius: var(--radius-sm); color: var(--text-muted); cursor: pointer; font-size: var(--font-size-sm); transition: all var(--transition-fast); }
.eb-embed-tab:hover { border-color: var(--border-medium); color: var(--text-primary); }
.eb-embed-tab.active { background: var(--accent-primary-dim); border-color: var(--accent-primary); color: var(--accent-primary); }
.eb-embed-tab.eb-add { color: var(--success); border-style: dashed; }
.eb-embed-tab.eb-add:hover { border-color: var(--success); }
.eb-embed-tab.eb-remove { color: var(--error); }
.eb-embed-tab.eb-remove:hover { border-color: var(--error); }

.eb-group { background: var(--bg-medium); border: 1px solid var(--border-dark); border-radius: var(--radius-md); margin-bottom: 8px; }
.eb-group > summary { padding: 10px 14px; cursor: pointer; font-size: var(--font-size-sm); font-weight: 500; color: var(--text-secondary); list-style: none; display: flex; align-items: center; gap: 8px; }
.eb-group > summary::-webkit-details-marker { display: none; }
.eb-group > summary::before { content: '\f054'; font-family: "Font Awesome 6 Free"; font-weight: 900; font-size: 10px; color: var(--text-muted); transition: transform var(--transition-fast); }
.eb-group[open] > summary::before { transform: rotate(90deg); }
.eb-group-body { padding: 0 14px 14px; display: flex; flex-direction: column; gap: 8px; }

.eb-field-item { background: var(--bg-card); border: 1px solid var(--border-dark); border-radius: var(--radius-md); padding: 10px; margin-bottom: 8px; }
.eb-field-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.eb-field-num { font-size: var(--font-size-xs); color: var(--text-muted); font-weight: 600; }
.eb-field-actions { display: flex; gap: 2px; }
.eb-field-item .form-input,
.eb-field-item .form-textarea { margin-bottom: 6px; }

/* Components tab */
.eb-action-row { background: var(--bg-medium); border: 1px solid var(--border-dark); border-radius: var(--radius-md); padding: 12px; margin-bottom: 8px; }
.eb-row-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: var(--font-size-sm); color: var(--text-secondary); font-weight: 500; }
.eb-buttons-list { display: flex; flex-direction: column; gap: 8px; }
.eb-button-editor { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.eb-button-editor .form-select { width: 110px; min-width: 110px; }
.eb-button-editor .form-input { flex: 1; min-width: 80px; }
.eb-comp-add { display: flex; gap: 8px; margin-top: 8px; }
.eb-select-editor { display: flex; flex-direction: column; gap: 8px; }
.eb-select-options { display: flex; flex-direction: column; gap: 6px; }
.eb-select-opt { display: flex; gap: 6px; align-items: center; }
.eb-select-opt .form-input { flex: 1; min-width: 60px; }

/* Code tab */
.eb-code-section { display: flex; flex-direction: column; height: 100%; }
.eb-code-toolbar { display: flex; gap: 6px; margin-bottom: 8px; }
.eb-code-error { background: var(--error-dim); color: var(--error); padding: 8px 12px; border-radius: var(--radius-md); font-size: var(--font-size-sm); margin-bottom: 8px; }
.json-editor-wrapper { position: relative; flex: 1; min-height: 300px; border-radius: var(--radius-md); overflow: hidden; border: 1px solid var(--border-dark); }
.json-highlight {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    padding: 12px; margin: 0; font-family: var(--font-mono); font-size: var(--font-size-sm);
    line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; overflow: auto;
    color: var(--text-secondary); background: var(--bg-input); pointer-events: none;
}
.json-editor {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    padding: 12px; margin: 0; font-family: var(--font-mono); font-size: var(--font-size-sm);
    line-height: 1.5; background: transparent; color: transparent; caret-color: var(--text-primary);
    border: none; outline: none; resize: none; overflow: auto; white-space: pre-wrap; word-wrap: break-word;
}
.json-key { color: var(--accent-primary); }
.json-string { color: #98c379; }
.json-number { color: #56b6c2; }
.json-bool { color: #d19a66; }

/* Discord preview styles */
.discord-msg { display: flex; gap: 12px; font-family: 'gg sans', 'Noto Sans', Helvetica, Arial, sans-serif; }
.discord-msg-avatar { flex-shrink: 0; }
.discord-avatar-placeholder { width: 40px; height: 40px; border-radius: 50%; background: #5865f2; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 16px; }
.discord-msg-body { flex: 1; min-width: 0; }
.discord-msg-header { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.discord-username { color: #fff; font-weight: 600; font-size: 15px; }
.discord-timestamp { color: #72767d; font-size: 12px; }
.discord-content { color: #dcddde; font-size: 15px; line-height: 1.375; margin-bottom: 4px; word-wrap: break-word; }
.discord-content br { display: block; margin-top: 2px; }

.discord-embed { background: #2f3136; border-radius: 4px; border-left: 4px solid #7c4dff; padding: 12px 16px 12px 12px; margin-top: 4px; max-width: 516px; display: flex; flex-direction: column; }
.discord-embed-with-thumb { display: flex; gap: 16px; }
.discord-embed-main { flex: 1; min-width: 0; }
.discord-embed-author { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 13px; font-weight: 600; color: #fff; }
.discord-embed-author img { width: 24px; height: 24px; border-radius: 50%; }
.discord-embed-title { font-size: 15px; font-weight: 700; color: #00aff4; margin-bottom: 4px; }
.discord-embed-title a { color: #00aff4; text-decoration: none; }
.discord-embed-title a:hover { text-decoration: underline; }
.discord-embed-desc { font-size: 14px; color: #dcddde; line-height: 1.45; margin-bottom: 8px; word-wrap: break-word; }
.discord-embed-fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 8px; }
.discord-embed-field { min-width: 0; }
.discord-embed-field:not(.inline) { grid-column: 1 / -1; }
.discord-embed-field-name { font-size: 13px; font-weight: 700; color: #fff; margin-bottom: 2px; }
.discord-embed-field-value { font-size: 13px; color: #dcddde; line-height: 1.3; word-wrap: break-word; }
.discord-embed-thumb { width: 80px; height: 80px; border-radius: 4px; object-fit: cover; flex-shrink: 0; }
.discord-embed-img { max-width: 100%; border-radius: 4px; margin-top: 8px; max-height: 300px; }
.discord-embed-footer { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #72767d; margin-top: 8px; }
.discord-embed-footer img { width: 20px; height: 20px; border-radius: 50%; }
.discord-inline-code { background: #2f3136; border-radius: 3px; padding: 1px 4px; font-family: var(--font-mono); font-size: 13px; }
.discord-codeblock { display: block; background: #2f3136; border-radius: 4px; padding: 8px; font-family: var(--font-mono); font-size: 13px; margin: 4px 0; white-space: pre-wrap; }

.discord-action-row { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.discord-btn { padding: 4px 16px; border-radius: 3px; font-size: 14px; font-weight: 500; border: none; cursor: default; display: inline-flex; align-items: center; gap: 4px; height: 32px; }
.discord-btn-primary { background: #5865f2; color: #fff; }
.discord-btn-secondary { background: #4f545c; color: #fff; }
.discord-btn-success { background: #3ba55d; color: #fff; }
.discord-btn-danger { background: #ed4245; color: #fff; }
.discord-btn-link { background: #4f545c; color: #fff; }
.discord-btn-emoji { font-size: 16px; }
.discord-select { flex: 1; max-width: 400px; padding: 8px 12px; background: #1e1f22; border: 1px solid #3f4147; border-radius: 4px; color: #8b8d94; font-size: 14px; display: flex; align-items: center; justify-content: space-between; cursor: default; }
.discord-select i { font-size: 10px; }

/* Template list */

/* Click-to-edit preview */
.eb-clickable { cursor: pointer; position: relative; transition: outline 0.15s ease, background 0.15s ease; border-radius: 3px; }
.eb-clickable:hover { outline: 2px solid rgba(124, 77, 255, 0.4); outline-offset: 2px; background: rgba(124, 77, 255, 0.05); }
.eb-clickable:hover::after { content: f304; font-family: "Font Awesome 6 Free"; font-weight: 900; position: absolute; top: 2px; right: 4px; font-size: 10px; color: var(--accent-primary); opacity: 0.7; pointer-events: none; }
.eb-preview-hint { font-size: 11px; color: var(--text-dimmed); margin-left: auto; font-weight: 400; }

/* Section highlight on click-to-edit */
.eb-section-highlight { animation: ebHighlight 2s ease; }
.eb-field-highlight { animation: ebHighlight 2s ease; }
@keyframes ebHighlight {
    0%, 10% { box-shadow: 0 0 0 2px var(--accent-primary); }
    100% { box-shadow: none; }
}

/* Color presets */
.eb-color-presets { display: flex; gap: 4px; margin-left: 8px; align-items: center; }
.eb-color-preset { width: 20px; height: 20px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; transition: all 0.15s; padding: 0; }
.eb-color-preset:hover { border-color: var(--text-primary); transform: scale(1.2); }

/* Total character count */
.eb-total-chars { font-size: 11px; color: var(--text-dimmed); font-family: var(--font-mono); text-align: right; padding: 4px 0; }

/* Empty preview state */
.eb-empty-preview { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 20px; color: var(--text-muted); text-align: center; cursor: pointer; }
.eb-empty-preview i { font-size: 32px; margin-bottom: 12px; color: var(--text-dimmed); }
.eb-empty-preview:hover { color: var(--accent-primary); }
.eb-empty-preview:hover i { color: var(--accent-primary); }

/* Group icons */
.eb-group > summary i { width: 16px; text-align: center; color: var(--text-dimmed); font-size: 12px; }

.eb-template-list { display: flex; flex-direction: column; gap: 4px; }
.eb-template-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: var(--bg-medium); border: 1px solid var(--border-dark); border-radius: var(--radius-md); cursor: pointer; transition: all var(--transition-fast); }
.eb-template-item:hover { border-color: var(--accent-primary); background: var(--accent-primary-dim); }
.eb-template-name { font-weight: 500; color: var(--text-primary); }
.eb-template-date { font-size: var(--font-size-xs); color: var(--text-muted); }

@media (max-width: 768px) {
    .eb-wrapper { grid-template-columns: 1fr; }
    .eb-button-editor { flex-direction: column; }
    .eb-button-editor .form-select { width: 100%; }
}

/* ============================================
   Mobile Component Overrides
   ============================================ */
@media (max-width: 768px) {
    /* Buttons - touch friendly */
    .btn { padding: 12px 16px; min-height: 44px; font-size: 14px; }
    .btn-small { padding: 8px 12px; min-height: 36px; }
    .btn-group { flex-wrap: wrap; }
    .btn-group .btn { flex: 1; min-width: 0; }

    /* Cards */
    .card { padding: 12px; }
    .card-header { padding: 10px 12px; flex-wrap: wrap; gap: 8px; }
    .card-body { padding: 12px; }

    /* Stat cards - 2 per row */
    .stat-grid, .stats-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 8px; }
    .stat-card { padding: 12px; }
    .stat-card-value { font-size: 1.4rem; }
    .stat-card-label { font-size: 11px; }
    .stat-card-icon { width: 36px; height: 36px; font-size: 0.9rem; }

    /* Tables - horizontal scroll */
    .data-table-wrapper, .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -12px; padding: 0 12px; }
    .data-table { min-width: 500px; }
    .data-table th, .data-table td { padding: 10px 8px; font-size: 13px; white-space: nowrap; }

    /* Forms */
    .form-group { margin-bottom: 12px; }
    .form-input, .form-select, .form-textarea { padding: 12px; font-size: 16px; min-height: 44px; }
    .form-label { font-size: 13px; margin-bottom: 4px; }
    .form-row { flex-direction: column; gap: 0; }
    .form-row .form-group { width: 100% !important; flex: none !important; }

    /* Toggle switch */
    .toggle-switch { min-width: 44px; min-height: 24px; }

    /* Tabs */
    .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; gap: 0; padding-bottom: 2px; }
    .tab { flex-shrink: 0; padding: 10px 14px; font-size: 13px; min-height: 44px; white-space: nowrap; }

    /* Badges */
    .badge { font-size: 11px; padding: 3px 8px; }

    /* Empty states */
    .empty-state { padding: 24px 16px; }
    .empty-state-icon { font-size: 2rem; }
    .empty-state-title { font-size: 1rem; }

    /* Pagination */
    .pagination { flex-wrap: wrap; justify-content: center; gap: 4px; }
    .pagination .btn { padding: 8px 12px; min-width: 36px; }

    /* Toast on mobile - full width */
    .toast-container { left: 8px; right: 8px; bottom: 8px; max-width: none; }
    .toast { font-size: 14px; }

    /* Loading spinner */
    .loading-container { padding: 24px; }

    /* Search select dropdowns */
    .ss-dropdown { max-height: 200px; }
    .ss-option { padding: 12px; min-height: 44px; }

    /* Role/channel multi-select */
    .role-option, .channel-option { padding: 10px; min-height: 40px; }

    /* Embed builder */
    .embed-builder-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .stat-grid, .stats-grid { grid-template-columns: 1fr !important; }
    .form-input, .form-select, .form-textarea { font-size: 16px; } /* prevents iOS zoom */
}
