/**
 * RE::DACT Component Styles
 * 
 * This file contains:
 * - News panel
 * - User profile box (light theme variant)
 */

/* --- NEWS PANEL --- */
.news-panel {
    width: 320px;
    display: flex;
    flex-direction: column;
    background: var(--color-bg-primary);
    flex-shrink: 0;
}

.news-header {
    display: flex;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--color-border-light);
    font-weight: 600;
}

.news-config-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-accent);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.news-list {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.news-item {
    padding: 12px;
    background: var(--color-bg-secondary);
    border-radius: 8px;
    margin-bottom: 12px;
    opacity: 0.8;
    cursor: pointer;
}

.news-item:hover {
    opacity: 1;
}

.news-item-title {
    font-weight: 500;
    margin-bottom: 4px;
    font-size: 13px;
}

.news-item-source {
    font-size: 10px;
    color: var(--color-text-tertiary);
}

.news-item-url {
    font-size: 9px;
    color: #0066cc;
    margin-top: 6px;
    word-break: break-all;
}

.copy-url-btn {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 4px;
    background: var(--color-bg-tertiary);
    border-radius: 2px;
    font-size: 8px;
    cursor: pointer;
}

.copy-url-btn.copied {
    background: #16A34A;
    color: white;
}

/* --- USER PROFILE BOX (Light Theme Variant) --- */
/* Note: Dark theme variant is in sidebar.css */
.user-profile-box {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 8px;
}

.user-profile-box:hover {
    background: var(--color-bg-secondary);
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--color-bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    overflow: hidden;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.guest-avatar {
    background: var(--color-text-tertiary);
    color: white;
}

.user-name {
    font-size: 13px;
    font-weight: 500;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.user-settings-trigger {
    font-size: 14px;
    margin-left: auto;
    opacity: 0.6;
    display: flex;
    align-items: center;
}

.user-settings-trigger svg {
    width: 16px;
    height: 16px;
}

/* --- SYNC BUTTON (Google Icons) --- */
.sync-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    transition: background 0.2s, transform 0.2s;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

.sync-btn svg {
    display: block;
}

.sync-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

.sync-btn:active {
    transform: scale(0.95);
}

/* Combined icons (G + Drive) for synced state */
.sync-icon-combo {
    display: flex;
    align-items: center;
    gap: 2px;
}

/* Spinning animation for syncing */
.sync-btn.syncing .sync-spinner {
    animation: sync-spin 1s linear infinite;
}

/* Error state - red tint */
.sync-icon-error svg path {
    fill: var(--color-error, #ef4444);
}

.sync-btn.error {
    opacity: 0.8;
}

.sync-btn.no_access {
    opacity: 0.6;
}

.sync-btn.no_access:hover {
    opacity: 1;
}

.sync-btn.disabled {
    opacity: 0.8;
}

.sync-btn.disabled:hover {
    opacity: 1;
}

@keyframes sync-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* --- SPARK CATCHER ALERTS INDICATOR --- */
.alerts-btn {
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    color: #FFD700;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.alerts-btn:hover {
    background: rgba(255, 215, 0, 0.1);
}

.alerts-bulb {
    width: 20px;
    height: 20px;
    animation: pulse-bulb 2s ease-in-out infinite;
    filter: drop-shadow(0 0 4px rgba(255, 215, 0, 0.6));
}

.alerts-count {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #ef4444;
    color: white;
    font-size: 10px;
    font-weight: 600;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

@keyframes pulse-bulb {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.1);
    }
}

/* --- HEADER ICON BUTTONS --- */
.header-icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
    height: 36px;
    width: 36px;
}

.header-icon-btn:hover {
    color: var(--color-accent);
}

.header-icon-btn svg {
    width: 18px;
    height: 18px;
    display: block;
}

/* Resource panel button — extends header-icon-btn, adds relative for badge */
.header-actions .resource-panel-btn {
    position: relative;
}

.header-actions .resource-panel-btn:hover {
    color: var(--color-accent);
}

.header-actions .resource-panel-btn svg {
    width: 18px;
    height: 18px;
}

/* Counter badge on resource button */
.header-actions .resource-panel-btn .alerts-count {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 14px;
    height: 14px;
    background: var(--color-accent);
    color: white;
    font-size: 9px;
    font-weight: 600;
    border-radius: 7px;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
}

.header-actions .resource-panel-btn .alerts-count.visible {
    display: flex;
}

/* --- RESOURCE SIDEBAR (Right) --- */
.resource-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 320px;
    height: 100vh;
    background: var(--color-bg-primary);
    border-left: none;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: -4px 0 24px rgba(var(--color-overlay-dark), 0.1);
}

.resource-sidebar.open {
    transform: translateX(0);
}

/* Header bar — themed accent color, same height as app header */
.resource-sidebar-header {
    display: flex;
    align-items: center;
    padding: 0 16px 0 0;
    background: var(--color-accent);
    color: var(--color-accent-text);
    flex-shrink: 0;
    height: 56px;
}

.resource-sidebar-tabs {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 100%;
    padding-left: 12px;
}

.resource-tab {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px 10px;
    color: var(--color-accent-text);
    opacity: 0.5;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    height: 100%;
    width: 36px;
    position: relative;
}

.resource-tab:hover {
    opacity: 0.8;
}

.resource-tab.active {
    opacity: 1;
}

/* Red dot badge for alerts count on tab */
.resource-tab.has-count::before {
    content: '';
    position: absolute;
    top: 8px;
    right: 4px;
    width: 6px;
    height: 6px;
    background: #ff3b30;
    border-radius: 50%;
}

.resource-sidebar-title {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-align: right;
    padding-right: 12px;
    color: var(--color-accent-text);
}

.resource-sidebar-close {
    display: none;
}

/* Search bar — matches left sidebar finder style */
.resource-sidebar-search {
    padding: 12px 20px 8px 20px;
    flex-shrink: 0;
    position: relative;
}

.resource-sidebar-search .finder-icon {
    position: absolute;
    left: 32px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--color-text-muted);
    pointer-events: none;
}

.resource-sidebar-search input {
    width: 100%;
    padding: 10px 12px 10px 36px;
    border: 1px solid var(--color-border-light);
    border-radius: 10px;
    font-size: 13px;
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.08);
}

.resource-sidebar-search input:focus {
    border-color: var(--color-border-medium);
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.08), 0 0 0 3px rgba(var(--color-overlay-dark), 0.05);
}

.resource-sidebar-search input::placeholder {
    color: var(--color-text-muted);
}

/* Scrollable content area */
.resource-sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Resource card - plafon style */
.resource-card {
    padding: 10px 12px;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border-light);
    border-left: 3px solid var(--color-accent);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.resource-card:hover {
    border-color: var(--color-accent);
    background: rgba(var(--color-overlay-dark), 0.03);
    border-left-color: var(--color-accent);
}

.resource-card-title {
    font-size: 11px;
    color: var(--color-text-primary);
    font-weight: 500;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.resource-card-preview {
    font-size: 10px;
    color: var(--color-text-muted);
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.resource-card-meta {
    font-size: 9px;
    color: var(--color-text-tertiary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.resource-card-meta svg {
    width: 10px;
    height: 10px;
    flex-shrink: 0;
}

.resource-card-meta > span:first-of-type {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 50%;
}

.resource-card-date {
    margin-left: auto;
    white-space: nowrap;
    flex-shrink: 0;
}

.resource-card-tag {
    font-size: 9px;
    padding: 2px 6px;
    background: rgba(var(--color-overlay-dark), 0.06);
    border-radius: 8px;
    display: inline-block;
    margin-bottom: 4px;
}

.resource-card-delete {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border-light);
    border-radius: 4px;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.15s;
    z-index: 10;
    font-size: 12px;
    color: var(--color-text-tertiary);
}

.resource-card:hover .resource-card-delete {
    opacity: 1;
    visibility: visible;
}

.resource-card-delete:hover {
    background: rgba(255, 59, 48, 0.9);
    border-color: rgba(255, 59, 48, 0.9);
    color: white;
}

/* Artifacts panel */
.artifacts-section { margin-bottom: 16px; }
.artifacts-section-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-secondary, #888); padding: 8px 12px 4px; }
.artifacts-memory-content { font-size: 12px; line-height: 1.5; padding: 8px 12px; color: var(--text-primary, #ccc); white-space: pre-wrap; max-height: 300px; overflow-y: auto; }
.resource-empty-hint { font-size: 11px; color: var(--text-tertiary, #666); padding: 4px 12px; font-style: italic; }
.artifacts-plan-step { display: flex; align-items: center; gap: 8px; padding: 4px 12px; font-size: 12px; }
.artifacts-plan-step .step-icon { flex-shrink: 0; }
.artifacts-plan-step.completed .step-text { color: var(--text-secondary, #888); text-decoration: line-through; }
.artifacts-plan-step.running .step-text { color: var(--accent, #6366f1); font-weight: 500; }
.artifacts-plan-step.failed .step-text { color: #ef4444; }

/* Overlay */
.resource-sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(var(--color-overlay-dark), 0.3);
    z-index: 1999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.resource-sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Alert items in sidebar (kept for alerts tab) */
.sidebar-alert-item {
    padding: 10px 12px;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border-light);
    border-left: 3px solid var(--color-accent);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.sidebar-alert-item:hover {
    border-color: var(--color-accent);
    background: rgba(var(--color-overlay-dark), 0.03);
    border-left-color: var(--color-accent);
}

.sidebar-alert-item.unread {
    border-color: var(--color-accent);
    animation: alertShake 0.5s ease-in-out infinite;
    animation-delay: calc(var(--shake-delay, 0) * 0.1s);
}

.sidebar-alert-item.unread:hover {
    animation: none;
}

@keyframes alertShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    75% { transform: translateX(2px); }
}

.sidebar-alert-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.sidebar-alert-strength {
    display: flex;
    gap: 2px;
}

.sidebar-alert-bulb {
    width: 12px;
    height: 12px;
    color: var(--color-text-tertiary);
}

.sidebar-alert-bulb.active {
    color: var(--color-accent);
}

.sidebar-alert-idea-box {
    font-size: 9px;
    color: var(--color-accent);
    padding: 2px 6px;
    background: rgba(var(--color-overlay-dark), 0.06);
    border-radius: 8px;
}

.sidebar-alert-title {
    font-size: 11px;
    color: var(--color-text-primary);
    font-weight: 500;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-alert-source {
    font-size: 9px;
    color: var(--color-text-tertiary);
    display: flex;
    align-items: center;
    gap: 4px;
    width: 100%;
}

.sidebar-alert-source svg {
    width: 10px;
    height: 10px;
    flex-shrink: 0;
}

.sidebar-alert-source > span:first-of-type {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 50%;
}

.sidebar-alert-date {
    margin-left: auto;
    white-space: nowrap;
    flex-shrink: 0;
    color: var(--color-text-tertiary);
}

.sidebar-alert-delete {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border-light);
    border-radius: 4px;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.15s;
    z-index: 10;
    font-size: 12px;
    color: var(--color-text-tertiary);
}

.sidebar-alert-item:hover .sidebar-alert-delete {
    opacity: 1;
    visibility: visible;
}

.sidebar-alert-delete:hover {
    background: rgba(255, 59, 48, 0.9);
    border-color: rgba(255, 59, 48, 0.9);
    color: white;
}

/* Empty states */
.sidebar-alerts-empty,
.resource-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 12px;
    text-align: center;
    color: var(--color-text-tertiary);
    flex: 1;
}

.sidebar-alerts-empty svg,
.resource-empty svg {
    width: 32px;
    height: 32px;
    opacity: 0.3;
    margin-bottom: 8px;
}

.sidebar-alerts-empty p,
.resource-empty p {
    font-size: 11px;
    margin: 0;
}

.sidebar-alerts-empty .hint,
.resource-empty .hint {
    font-size: 10px;
    color: var(--color-text-tertiary);
    margin-top: 4px;
}

/* RSS feed input area — sticky at bottom of content */
.resource-rss-add {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    padding: 8px 0;
    margin-top: auto;
    background: var(--color-bg-primary);
}

.resource-rss-add input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid var(--color-border-light);
    border-radius: 6px;
    background: var(--color-bg-secondary);
    color: var(--color-text-primary);
    font-size: 11px;
    outline: none;
}

.resource-rss-add input:focus {
    border-color: var(--color-accent);
}

.resource-rss-add button {
    padding: 6px 12px;
    background: var(--color-accent);
    color: var(--color-accent-text);
    border: none;
    border-radius: 6px;
    font-size: 11px;
    cursor: pointer;
    white-space: nowrap;
    transition: opacity 0.2s;
}

.resource-rss-add button:hover {
    opacity: 0.9;
}

/* Topic group header in sparks view */
.resource-group-header {
    font-size: 10px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 4px 4px;
    margin-top: 4px;
}

.resource-group-header:first-child {
    margin-top: 0;
}

/* Recording cards — theme accent color */
.resource-card-rec {
    border-left-color: var(--color-accent);
}

.resource-card-rec:hover {
    border-left-color: var(--color-accent);
}

/* Marker sub-cards (half height, indented, gray) */
.resource-card-marker {
    margin-left: 14px;
    padding: 5px 8px;
    font-size: 11px;
    min-height: unset;
    border-left-color: var(--color-text-muted);
    background: var(--color-bg-primary);
}

.resource-card-marker:hover {
    border-left-color: var(--color-text-secondary);
    border-color: var(--color-text-muted);
}

.resource-card-marker .resource-card-title {
    font-size: 11px;
}

.resource-card-marker .resource-card-preview {
    font-size: 10px;
    -webkit-line-clamp: 2;
}

.resource-mark-ts {
    color: var(--color-text-muted);
    font-weight: 600;
}

/* Record expand arrow */
.rec-expand-arrow {
    display: inline-block;
    font-size: 9px;
    margin-right: 4px;
    color: var(--color-text-muted);
    transition: transform 0.15s;
}

/* Markers group container */
.rec-markers-group {
    margin-bottom: 2px;
}

/* RE::CORD Prompter */
.record-prompter {
    flex-shrink: 0;
    display: none;
    flex-direction: column;
    background: var(--color-accent) !important;
    color: var(--color-accent-text) !important;
}
.record-prompter.visible {
    display: flex;
}

/* Toggle bar — always visible, clickable */
.prompter-toggle-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 18px;
    cursor: pointer;
    user-select: none;
}
.prompter-toggle-bar:hover {
    filter: brightness(1.1);
}
.prompter-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--color-accent-text) !important;
    letter-spacing: 1px;
}
.prompter-chevron {
    color: var(--color-accent-text);
    transition: transform 0.2s;
}

/* Collapsed state — body hidden, chevron points up */
.record-prompter.collapsed .prompter-body {
    display: none;
}
.record-prompter.collapsed .prompter-chevron {
    transform: rotate(180deg);
}

/* Expanded body */
.prompter-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 0 18px 18px 18px;
    height: 31vh;
}
.prompter-header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}
.prompter-tabs {
    display: flex;
    gap: 4px;
}
.prompter-tab {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.2) !important;
    background: transparent !important;
    color: var(--color-accent-text) !important;
    cursor: pointer;
    opacity: 0.5;
    transition: all 0.15s;
}
.prompter-tab:hover {
    opacity: 0.8;
}
.prompter-tab.active {
    background: var(--color-accent-text) !important;
    color: var(--color-accent) !important;
    border-color: var(--color-accent-text) !important;
    opacity: 1;
}
.prompter-textarea {
    flex: 1;
    resize: none;
    background: var(--color-bg, #fff) !important;
    border: none !important;
    border-radius: 6px;
    padding: 10px;
    font-size: 11px;
    font-family: Inter, sans-serif;
    color: var(--color-text, #1a1a1a) !important;
    outline: none;
}
.prompter-textarea:focus {
    box-shadow: 0 0 0 2px rgba(255,255,255,0.2);
}
.prompter-textarea::placeholder {
    color: var(--color-text-muted, #999) !important;
    opacity: 0.6;
}

@media (max-width: 768px) {
    .resource-sidebar {
        width: 75vw;
        top: 0;
        height: 100vh;
        height: 100svh;
        border-left: none;
        box-shadow: -2px 0 12px rgba(0, 0, 0, 0.15);
    }

    /* Fill gap above header with accent color (iOS Liquid Glass fix) */
    .resource-sidebar::before {
        content: '';
        display: block;
        height: 56px;
        background: var(--color-accent);
        flex-shrink: 0;
    }

    .resource-sidebar-header {
        height: 48px;
    }

    /* Prompter — taller toggle bar for easier tap on mobile */
    .prompter-toggle-bar {
        padding: 14px 18px;
    }
}
