/**
 * HeuriSight Panel System
 * Based on: mockups/apple-redesign/11-global-task-panel.html
 * 
 * Provides floating panels for tasks, notifications, and global UI elements
 */

/* =============================================================================
   TASK PANEL (Floating)
   ============================================================================= */

.hs-task-panel {
    width: 340px;
    background: var(--bg-secondary, #F5F5F7);
    border: 1px solid var(--border-default, rgba(0, 0, 0, 0.1));
    border-radius: var(--radius-md, 12px);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.hs-task-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3, 12px) var(--space-4, 16px);
    background: var(--bg-tertiary, #E8E8ED);
    border-bottom: 1px solid var(--border-default, rgba(0, 0, 0, 0.1));
}

.hs-task-panel__header-left {
    display: flex;
    align-items: center;
    gap: var(--space-2, 8px);
}

.hs-task-panel__title {
    font-size: var(--text-sm, 13px);
    font-weight: 600;
    color: var(--text-primary, #1D1D1F);
}

.hs-task-panel__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    font-size: var(--text-xs, 11px);
    font-weight: 600;
    background: var(--accent, #0071E3);
    color: white;
    border-radius: 10px;
}

.hs-task-panel__actions {
    display: flex;
    gap: var(--space-1, 4px);
}

.hs-task-panel__body {
    max-height: 400px;
    overflow-y: auto;
}

/* =============================================================================
   TASK ITEM
   ============================================================================= */

.hs-task-item {
    display: flex;
    gap: var(--space-3, 12px);
    padding: var(--space-4, 16px);
    border-bottom: 1px solid var(--border-default, rgba(0, 0, 0, 0.1));
}

.hs-task-item:last-child {
    border-bottom: none;
}

.hs-task-item__icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-top: 1px;
    color: var(--text-tertiary, #86868B);
}

.hs-task-item--running .hs-task-item__icon {
    color: var(--accent, #0071E3);
    animation: hs-spin 1s linear infinite;
}

.hs-task-item--queued .hs-task-item__icon {
    color: var(--text-tertiary, #86868B);
}

.hs-task-item--complete .hs-task-item__icon {
    color: var(--success, #34C759);
}

.hs-task-item--error .hs-task-item__icon {
    color: var(--destructive, #FF3B30);
}

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

.hs-task-item__content {
    flex: 1;
    min-width: 0;
}

.hs-task-item__title {
    font-size: var(--text-sm, 13px);
    font-weight: 500;
    color: var(--text-primary, #1D1D1F);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hs-task-item__subtitle {
    font-size: var(--text-xs, 11px);
    color: var(--text-tertiary, #86868B);
    margin-top: 2px;
}

.hs-task-item__progress {
    height: 4px;
    background: var(--bg-tertiary, #E8E8ED);
    border-radius: 2px;
    margin-top: var(--space-2, 8px);
    overflow: hidden;
}

.hs-task-item__progress-fill {
    height: 100%;
    background: var(--accent, #0071E3);
    border-radius: 2px;
    transition: width 300ms ease-out;
}

.hs-task-item--complete .hs-task-item__progress-fill {
    background: var(--success, #34C759);
}

.hs-task-item--error .hs-task-item__progress-fill {
    background: var(--destructive, #FF3B30);
}

.hs-task-item__meta {
    display: flex;
    justify-content: space-between;
    margin-top: var(--space-1, 4px);
    font-size: var(--text-xs, 11px);
    color: var(--text-tertiary, #86868B);
}

.hs-task-item__actions {
    display: flex;
    gap: var(--space-1, 4px);
    margin-left: var(--space-2, 8px);
}

/* =============================================================================
   ICON BUTTON (for panels)
   ============================================================================= */

.hs-icon-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm, 8px);
    color: var(--text-tertiary, #86868B);
    cursor: pointer;
    transition: all var(--duration-fast, 150ms) var(--ease-default);
}

.hs-icon-btn:hover {
    background: var(--bg-secondary, #F5F5F7);
    color: var(--text-primary, #1D1D1F);
}

.hs-icon-btn svg {
    width: 14px;
    height: 14px;
}

.hs-icon-btn--sm {
    width: 24px;
    height: 24px;
}

.hs-icon-btn--sm svg {
    width: 12px;
    height: 12px;
}

/* =============================================================================
   MINIMIZED PANEL
   ============================================================================= */

.hs-task-panel--minimized {
    width: auto;
}

.hs-task-panel--minimized .hs-task-panel__body {
    display: none;
}

/* =============================================================================
   FLOATING PANEL POSITION
   ============================================================================= */

.hs-floating-panel {
    position: fixed;
    z-index: var(--z-overlay, 300);
}

.hs-floating-panel--bottom-right {
    bottom: var(--space-6, 24px);
    right: var(--space-6, 24px);
}

.hs-floating-panel--bottom-left {
    bottom: var(--space-6, 24px);
    left: var(--space-6, 24px);
}

.hs-floating-panel--top-right {
    top: var(--space-6, 24px);
    right: var(--space-6, 24px);
}

/* =============================================================================
   LEGACY CLASS COMPATIBILITY
   ============================================================================= */

.panel {
    display: flex;
    flex-direction: column;
    background: var(--bg-primary, #FFFFFF);
    border: 1px solid var(--border-light, rgba(0, 0, 0, 0.06));
    border-radius: var(--radius-lg, 16px);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.panel.primary-panel {
    flex: 1;
    min-width: 0;
}

.glass-panel {
    background: var(--bg-primary, #FFFFFF);
}

.panel-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: var(--space-4, 16px);
}

.panel-content.p-0 {
    padding: 0;
}

.task-panel {
    width: 340px;
    background: var(--bg-secondary, #F5F5F7);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md, 12px);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3, 12px) var(--space-4, 16px);
    background: var(--bg-tertiary, #E8E8ED);
    border-bottom: 1px solid var(--border-default);
}

.panel-title {
    font-size: var(--text-sm, 13px);
    font-weight: 600;
}

.panel-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    font-size: var(--text-xs, 11px);
    font-weight: 600;
    background: var(--accent, #0071E3);
    color: white;
    border-radius: 10px;
}

.panel-body {
    max-height: 400px;
    overflow-y: auto;
}

.task-item {
    display: flex;
    gap: var(--space-3, 12px);
    padding: var(--space-4, 16px);
    border-bottom: 1px solid var(--border-default);
}

.task-item:last-child { border-bottom: none; }

.task-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-top: 1px;
}

.task-icon.running { color: var(--accent, #0071E3); }
.task-icon.queued { color: var(--text-tertiary, #86868B); }
.task-icon.complete { color: var(--success, #34C759); }
.task-icon.error { color: var(--destructive, #FF3B30); }

.task-icon.spinning {
    animation: hs-spin 1s linear infinite;
}

.icon-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm, 8px);
    color: var(--text-tertiary, #86868B);
    cursor: pointer;
}

.icon-btn:hover {
    background: var(--bg-secondary, #F5F5F7);
    color: var(--text-primary, #1D1D1F);
}

/* =============================================================================
   DARK THEME
   ============================================================================= */

[data-theme="dark"] .hs-task-panel,
[data-theme="dark"] .task-panel,
[data-theme="dark"] .panel,
[data-theme="dark"] .glass-panel {
    background: var(--bg-secondary, #2C2C2E);
    border-color: var(--border-default, rgba(255, 255, 255, 0.12));
}

[data-theme="dark"] .hs-task-panel__header,
[data-theme="dark"] .panel-header {
    background: var(--bg-tertiary, #3A3A3C);
}

[data-theme="dark"] .hs-icon-btn:hover,
[data-theme="dark"] .icon-btn:hover {
    background: var(--bg-tertiary, #3A3A3C);
}

/* =============================================================================
   REDUCED MOTION
   ============================================================================= */

@media (prefers-reduced-motion: reduce) {
    .hs-task-item--running .hs-task-item__icon,
    .task-icon.spinning {
        animation: none;
    }
}
