/* =================================================
   AI AGENTS TAB - Light Theme with Sidebar Layout
   Matches Chat tab design language
   ================================================= */

/* =================================================
   FULL-WIDTH OVERRIDES FOR AGENTS TAB
   ================================================= */

/* Prevent page content scroll when agents tab is active - BUT KEEP SCROLLBAR TRACK */
html:has(#agents.content.active) {
    overflow-y: scroll !important;
    /* Keep scrollbar visible to prevent layout shift */
    height: 100vh !important;
}

body:has(#agents.content.active) {
    overflow: hidden !important;
    height: 100vh !important;
}

/* Make agents tab full-width like chat - NO GAP */
#agents.content {
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    background: #FFFFFF !important;
    height: 100% !important;
    max-height: 100% !important;
    min-height: 100% !important;
    overflow: hidden !important;
}

#agents.content.active {
    display: flex !important;
}

/* Override parent containers - CRITICAL: Remove margin/padding gap */
body.agent-workspace-active,
body:has(#agents.content.active) {
    overflow: hidden !important;
    background: #FFFFFF !important;
}

body.agent-workspace-active .main-content-centered,
.main-content-centered:has(#agents.content.active) {
    max-width: 100% !important;
    width: 100% !important;
    padding: var(--header-height) 0 0 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
    background: #FFFFFF !important;
    min-height: 100vh !important;
}

body.agent-workspace-active .tab-content,
.tab-content:has(#agents.content.active) {
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
    height: calc(100vh - var(--header-height)) !important;
    background: #FFFFFF !important;
}

/* =================================================
   HIDE BOTTOM NAVIGATION WHEN AGENT WORKSPACE IS OPEN
   ================================================= */

/* Hide bottom nav when agent workspace is visible */
body:has(.agent-workspace[style*="display: flex"]) .bottom-nav-container,
body:has(.agent-workspace[style*="display:flex"]) .bottom-nav-container,
body.agent-workspace-active .bottom-nav-container {
    transform: translateX(-50%) translateY(150%);
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
}

/* Also hide the action menu overlay when in agent workspace */
body:has(.agent-workspace[style*="display: flex"]) .action-menu-overlay,
body:has(.agent-workspace[style*="display:flex"]) .action-menu-overlay,
body.agent-workspace-active .action-menu-overlay {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

/* =================================================
   AGENTS CONTAINER - Sidebar + Main Layout
   Fixed height with internal scrolling
   ================================================= */

.agents-marketplace {
    display: flex;
    width: 100%;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
    background: #FFFFFF;
}

/* =================================================
   AGENTS SIDEBAR - Premium Design System
   ================================================= */

.agents-sidebar {
    width: 280px;
    height: 100%;
    background: #FFFFFF;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
}

/* =================================================
   Create Agent CTA Section
   ================================================= */

.sidebar-cta {
    padding: 20px 16px 16px;
    flex-shrink: 0;
}

.create-agent-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px 20px;
    background: var(--color-primary);
    background-size: 200% 200%;
    color: #ffffff;
    border: none;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow:
        0 4px 15px rgba(var(--color-primary-rgb), 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.create-agent-btn .btn-glow {
    position: absolute;
    inset: -2px;
    background: var(--color-primary);
    border-radius: 16px;
    opacity: 0;
    filter: blur(8px);
    transition: opacity 0.3s ease;
    z-index: -1;
}

.create-agent-btn:hover .btn-glow {
    opacity: 0.6;
    animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {

    0%,
    100% {
        opacity: 0.4;
        transform: scale(1);
    }

    50% {
        opacity: 0.7;
        transform: scale(1.02);
    }
}

.create-agent-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s ease;
}

.create-agent-btn:hover::before {
    left: 100%;
}

.create-agent-btn:hover {
    transform: translateY(-2px) scale(1.02);
    background: var(--color-primary-hover);
    box-shadow:
        0 8px 25px rgba(var(--color-primary-rgb), 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.create-agent-btn:active {
    transform: translateY(0) scale(0.98);
}

.create-agent-btn svg {
    width: 18px;
    height: 18px;
}

/* =================================================
   Sidebar Section - Collapsible Container
   ================================================= */

.sidebar-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    background: rgba(0, 0, 0, 0.01);
}

.section-header:hover {
    background: rgba(0, 0, 0, 0.03);
}

.section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    /* Reduced gap */
    width: 100%;
}

.section-title-group {
    display: flex;
    flex-direction: column;
}

/* .section-icon used to be here, cleaned up */

.section-text {
    font-size: 14px;
    /* Larger, readable title */
    font-weight: 600;
    color: #1f2937;
    text-transform: none;
    /* Natural case */
    letter-spacing: normal;
    line-height: 1.2;
}

.section-helper {
    font-size: 11px;
    color: #6b7280;
    font-weight: 400;
}

.section-count {
    background: var(--color-primary);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 10px;
    min-width: 22px;
    text-align: center;
}

.section-toggle {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #9ca3af;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.section-toggle:hover {
    background: rgba(var(--color-primary-rgb), 0.08);
    color: var(--color-primary);
}

.section-toggle svg {
    transition: transform 0.3s ease;
}

.section-header.collapsed .section-toggle svg {
    transform: rotate(-90deg);
}

.section-content {
    flex: 1;
    overflow-y: auto;
    transition: max-height 0.3s ease;
}

.section-header.collapsed+.section-content {
    max-height: 0;
    overflow: hidden;
}

/* =================================================
   Agent List - Premium Scrollable Area
   ================================================= */

.agents-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 12px 16px;
}

.agents-list::-webkit-scrollbar {
    width: 5px;
}

.agents-list::-webkit-scrollbar-track {
    background: transparent;
}

.agents-list::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(var(--color-primary-rgb), 0.25) 0%, rgba(var(--color-accent-rgb), 0.25) 100%);
    border-radius: 3px;
}

.agents-list::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(var(--color-primary-rgb), 0.4) 0%, rgba(var(--color-accent-rgb), 0.4) 100%);
}

/* =================================================
   Agent Card - Premium Interactive Design
   ================================================= */

.agent-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    /* Slightly more compact */
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: transparent;
    /* Cleaner default */
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
    /* animation: slideIn 0.4s ease-out backwards; - Removed per request for calm minimal feel, or keep if preferred. User said "No animations longer than 300ms". 0.4s is > 300ms. Let's remove list slide in for now or speed it up. */
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Staggered animation for items */
.agent-list-item:nth-child(1) {
    animation-delay: 0.05s;
}

.agent-list-item:nth-child(2) {
    animation-delay: 0.1s;
}

.agent-list-item:nth-child(3) {
    animation-delay: 0.15s;
}

.agent-list-item:nth-child(4) {
    animation-delay: 0.2s;
}

.agent-list-item:nth-child(5) {
    animation-delay: 0.25s;
}

/* Active State - Focused & Clear */
.agent-list-item.active {
    background: #FFFFFF;
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.03),
        inset 3px 0 0 var(--color-primary);
    transform: none;
}

.agent-list-item.active .agent-list-name {
    color: #111827;
    /* High contrast */
    font-weight: 600;
}

.agent-list-item.active .agent-list-now {
    color: var(--color-primary);
    opacity: 1;
    font-style: normal;
}

/* Hover State */
.agent-list-item:hover {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

@media (prefers-reduced-motion: reduce) {
    .agent-list-item:hover {
        transform: none;
    }
}

.agent-list-item::before {
    display: none;
    /* Remove old gradient border */
}

@keyframes pulse-green {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    }

    70% {
        box-shadow: 0 0 0 4px rgba(16, 185, 129, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

.agent-list-item.active .status-dot-green {
    animation: pulse-green 2s infinite;
}

/* =================================================
   Agent Avatar - With Status Ring
   ================================================= */

.agent-list-avatar {
    position: relative;
    font-size: 1.3rem;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(var(--color-primary-rgb), 0.1) 0%, rgba(var(--color-accent-rgb), 0.06) 100%);
    border-radius: 12px;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

/* Remove old status ring logic from avatar, now handled by agent-list-status-dot */
.agent-list-avatar::after {
    display: none;
}

.agent-list-item:hover .agent-list-avatar {
    transform: scale(1.02);
    /* Subtle scale */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    /* Soft shadow */
}

.agent-list-item.active .agent-list-avatar {
    background: linear-gradient(135deg, rgba(var(--color-primary-rgb), 0.15) 0%, rgba(var(--color-accent-rgb), 0.12) 100%);
}

/* =================================================
   Initial-Based Avatar System
   ================================================= */

.initial-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Size variants */
.initial-avatar-sm {
    width: 28px;
    height: 28px;
    font-size: 11px;
}

.initial-avatar-lg {
    width: 44px;
    height: 44px;
    font-size: 18px;
    font-weight: 700;
}

/* Update agent-list-avatar to work as container for initial-avatar */
.agent-list-avatar {
    background: transparent !important;
    width: auto;
    height: auto;
}

/* =================================================
   Agent Info
   ================================================= */

.agent-list-info {
    flex: 1;
    min-width: 0;
}

.agent-list-name {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    /* Darker for prominence */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0 0 2px 0;
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.agent-list-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot-green {
    background: #10b981;
    box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.2);
}

.status-dot-gray {
    background: #d1d5db;
}

.agent-list-now {
    font-size: 10px;
    color: #9ca3af;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 400;
    opacity: 0.85;
}

/* Idle agents have italic styling */
.agent-list-now.idle {
    font-style: italic;
    color: #d1d5db;
}

.agent-list-template {
    font-size: 10px;
    color: #9ca3af;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Handled in main active block */

/* =================================================
   Delete Button - Animated
   ================================================= */

.agent-list-delete {
    opacity: 0;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #d1d5db;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    transition: all 0.3s ease;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.agent-list-item:hover .agent-list-delete {
    opacity: 1;
}

.agent-list-delete:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.4);
    color: #ef4444;
    transform: scale(1.15);
}

/* =================================================
   Empty State - Inviting Design
   ================================================= */

.agents-empty-sidebar {
    text-align: center;
    padding: 40px 24px;
    color: #9ca3af;
}

.agents-empty-sidebar .empty-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

.agents-empty-sidebar p {
    font-size: 14px;
    font-weight: 600;
    color: #6b7280;
    margin: 0 0 4px 0;
}

.agents-empty-sidebar .empty-hint {
    font-size: 12px;
    color: #9ca3af;
}

/* =================================================
   Sidebar Footer
   ================================================= */

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    background: #FFFFFF;
    flex-shrink: 0;
}

.sidebar-footer-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    background: transparent;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sidebar-footer-btn:hover {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.15);
    color: var(--text-primary);
}

.sidebar-footer-btn svg {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

.sidebar-footer-btn:hover svg {
    transform: rotate(90deg);
}

/* =================================================
   AGENTS MAIN CONTENT - Right Panel
   ================================================= */

.agents-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    overflow: hidden;
    background: transparent;
    height: 100%;
    position: relative;
}

/* Bottom fade for agents main content - doesn't cover sidebar */
.agents-main::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100px;
    background: linear-gradient(to top,
            rgba(255, 255, 255, 1) 0%,
            rgba(255, 255, 255, 0.9) 40%,
            rgba(255, 255, 255, 0.5) 70%,
            rgba(255, 255, 255, 0) 100%);
    pointer-events: none;
    z-index: 10;
}

/* Welcome/Template Selection View */
.agents-welcome {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 12px 24px;
    text-align: center;
    overflow-y: auto;
    width: 100%;
}

.agents-welcome-content {
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: translateX(-150px);
    /* Offset left by half sidebar width (300px/2) for visual centering */
}

/* Explainer Section */
.agents-explainer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    /* Increased gap */
    margin-bottom: 30px;
    width: 100%;
    max-width: 800px;
    /* Wider hero stance */
    margin-top: 20px;
    /* Slight top spacing */
}

.explainer-title {
    font-size: 1.25rem;
    font-weight: 600;
    text-align: center;
    color: #374151;
    /* Neutral dark gray */
    margin: 0;
    line-height: 1.4;
    max-width: 500px;
}

.explainer-steps {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    background: rgba(var(--color-primary-rgb), 0.03);
    padding: 20px 32px;
    border-radius: 16px;
    border: 1px solid rgba(var(--color-primary-rgb), 0.06);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
    width: 100%;
}

/* Remove frosted glass for cleaner look */
.explainer-steps::before {
    display: none;
}

/* Ensure content is above background */
.explainer-step,
.step-separator {
    position: relative;
    z-index: 1;
}

.explainer-step {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex: 1;
    padding: 8px 12px;
    /* Prepare for hover background */
    border-radius: 12px;
    transition: all 0.25s ease-out;
}

@media (hover: hover) {
    .explainer-step {
        cursor: pointer;
    }

    /* De-emphasize non-hovered steps */
    .explainer-steps:hover .explainer-step {
        opacity: 0.85;
    }

    /* Active Hover State */
    .explainer-steps .explainer-step:hover {
        opacity: 1;
        background: rgba(109, 93, 246, 0.05);
        /* Soft purple tint */
        transform: translateY(-2px);
    }

    /* Arrow Animations - Slide next arrow when hovering step */
    .step-separator svg {
        transition: transform 0.2s ease, opacity 0.2s ease;
    }

    /* Hover Step 1 -> Animate Separator 1 */
    .explainer-step:nth-child(1):hover~.step-separator:nth-child(2) svg {
        transform: translateX(3px);
        opacity: 1;
        /* Slight fade/highlight effect */
    }

    /* Hover Step 2 -> Animate Separator 2 */
    .explainer-step:nth-child(3):hover~.step-separator:nth-child(4) svg {
        transform: translateX(3px);
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {

    .explainer-step,
    .step-separator svg {
        transition: none !important;
        transform: none !important;
    }
}

.step-icon {
    font-size: 1rem;
    background: transparent;
    color: #4b5563;
    /* Soft Gray */
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 2px;
    flex-shrink: 0;
    box-shadow: none;
}

/* Remove specific Chat emphasis to keep it uniform and clean as requested */

.step-icon svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 2;
}

.step-info {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.step-info strong {
    font-size: 0.9rem;
    color: var(--color-primary);
    /* Trivio Purple Titles */
    font-weight: 600;
    margin-bottom: 4px;
    display: block;
}

.step-capabilities {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.step-capabilities li {
    font-size: 0.8rem;
    color: #6b7280;
    /* Gray 500 */
    line-height: 1.3;
    white-space: nowrap;
}

.step-separator {
    color: rgba(0, 0, 0, 0.8);
    /* Black/Dark Charcoal */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    height: auto;
    /* Allow natural height */
    margin: 0;
    /* Centered by parent flex align-items: center */
}

.explainer-actions {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.explainer-cta {
    padding: 10px 24px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.explainer-cta.primary {
    background: var(--color-primary);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(109, 93, 246, 0.25);
}

.explainer-cta.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(109, 93, 246, 0.35);
}

.explainer-cta.secondary {
    background: transparent;
    color: var(--color-primary);
    border: 1px solid rgba(109, 93, 246, 0.2);
}

.explainer-cta.secondary:hover {
    background: rgba(109, 93, 246, 0.05);
    border-color: rgba(109, 93, 246, 0.4);
}

/* Guidance Message */
.explainer-guidance {
    font-size: 0.85rem;
    color: #6b7280;
    margin-top: 12px;
    text-align: center;
}

.explainer-guidance strong {
    color: #4b5563;
    font-weight: 600;
}

@keyframes gradientFlow {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.agents-welcome p {
    font-size: 0.9rem;
    color: #6b7280;
    margin: 0 0 16px 0;
    line-height: 1.5;
    max-width: 600px;
}

/* Template Grid - Clean Layout */
.templates-grid {
    display: grid;
    grid-template-columns: repeat(3, 280px);
    gap: 20px;
    justify-content: center;
    padding-bottom: 60px;
}

/* Template Card - World-Class Design */
.template-card {
    width: 100%;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.05);
    /* Softer initial border */
    border-radius: 16px;
    padding: 28px 24px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    /* Smoother transition */
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.template-card:hover {
    transform: translateY(-4px);
    /* Lift 4px */
    border-color: rgba(109, 93, 246, 0.2);
    /* Soft purple border */
    box-shadow:
        0 12px 24px -6px rgba(109, 93, 246, 0.12),
        /* Soft purple glow */
        0 4px 6px -2px rgba(109, 93, 246, 0.05);
}

.template-card:active {
    transform: translateY(0);
}

/* Icon Container - Clean & Minimal */
.template-card-icon {
    width: 56px;
    /* Reduced from 64px */
    height: 56px;
    /* Reduced from 64px */
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.03);
    /* Neutral background */
    border-radius: 14px;
    /* Slightly adjusted radius */
    margin-bottom: 16px;
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    color: #4b5563;
    /* Soft Gray 600 */
}

.template-card-icon svg {
    width: 28px;
    /* Slightly smaller for scale */
    height: 28px;
    stroke: currentColor;
    stroke-width: 1.5;
    /* Lighter weight */
    transition: stroke 0.2s ease;
}

.template-card:hover .template-card-icon {
    background: rgba(109, 93, 246, 0.1);
    /* Light Purple Tint on Hover */
    color: var(--color-primary);
    /* Active Purple */
    transform: scale(1.05);
}

/* Card Name - Clean Typography */
.template-card-name {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 8px 0;
    letter-spacing: -0.01em;
}

/* Card Description - Subtle */
.template-card-description {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Hide category badge - No longer needed */
.template-card-category {
    display: none;
}

/* =================================================
   AGENT WORKSPACE - Light Theme (Fixed Layout)
   ================================================= */

.agent-workspace {
    display: none;
    flex-direction: column;
    height: 100%;
    max-height: 100%;
    width: 100%;
    background: #FFFFFF;
    overflow: hidden;
    position: relative;  /* Required for drag overlay positioning */
}

/* When workspace is shown */
.agent-workspace[style*="flex"] {
    display: flex !important;
}

/* Workspace Layout with sidebar */
.workspace-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Workspace Agent Sidebar (mini sidebar when in workspace) */
.workspace-agents-panel {
    width: 280px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(249, 250, 251, 0.98) 100%);
    border-right: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    padding: 20px;
    flex-shrink: 0;
    overflow-y: auto;
}

/* Chat Area */
.workspace-chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* =================================================
   Workspace Header - Compact Redesign
   ================================================= */

.workspace-header {
    height: 60px;
    /* Reduced specific height */
    padding: 0 20px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(109, 93, 246, 0.08);
    /* Subtle border */
    flex-shrink: 0;
    z-index: 10;
    width: 100%;
    /* Header stays full width */
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.back-to-agents {
    width: 28px;
    /* Smaller */
    height: 28px;
    border: none;
    border-radius: 8px;
    background: rgba(109, 93, 246, 0.08);
    /* System color */
    color: var(--color-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.back-to-agents:hover {
    background: rgba(109, 93, 246, 0.15);
    transform: translateX(-2px);
}

.workspace-agent-status-pill {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 12px;
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    display: inline-flex;
    align-items: center;
    line-height: 1;
}

.workspace-agent-status-pill.status-idle {
    background: rgba(243, 244, 246, 1);
    color: #6b7280;
}

.agent-name-medium {
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
}

.agent-avatar-small {
    width: 32px;
    height: 32px;
    color: #6b7280;
    background: rgba(107, 114, 128, 0.08);
    /* Gray background */
}

.workspace-agent-status.status-idle::before {
    background: #9ca3af;
    /* Gray dot */
    box-shadow: none;
    animation: none;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.workspace-header-right {
    display: flex;
    gap: 8px;
}

.workspace-action-btn {
    width: 28px;
    /* Smaller */
    height: 28px;
    border: none;
    border-radius: 8px;
    background: rgba(109, 93, 246, 0.08);
    color: var(--color-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.workspace-action-btn:hover {
    background: rgba(109, 93, 246, 0.15);
    transform: scale(1.05);
}

/* Workspace Content - Chat + Context Sidebar */
.workspace-content {
    flex: 1;
    display: flex;
    overflow: hidden;
    min-height: 0;
    /* Important for flex children to properly shrink */
}

/* Chat Section */
.workspace-chat {
    flex: 7;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    /* Allow shrinking */
    background: transparent;
}

.workspace-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px 80px;
    /* More horizontal padding for spacious feel */
    display: flex;
    flex-direction: column;
    gap: 20px;
    scroll-behavior: smooth;
    /* Center messages in the middle */
    align-items: center;
}

/* Welcome message in workspace */
.agent-welcome-message {
    text-align: center;
    padding: 60px 40px;
    max-width: 600px;
    margin: auto;
}

.agent-welcome-message p {
    font-size: 1.1rem;
    color: #6b7280;
    margin-bottom: 24px;
}

.agent-quick-prompts {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.agent-quick-prompt {
    padding: 12px 20px;
    background: linear-gradient(135deg, rgba(var(--color-primary-rgb), 0.06) 0%, rgba(var(--color-accent-rgb), 0.04) 100%);
    border: 1px solid rgba(var(--color-primary-rgb), 0.15);
    border-radius: 24px;
    color: var(--color-primary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.agent-quick-prompt:hover {
    background: linear-gradient(135deg, rgba(var(--color-primary-rgb), 0.12) 0%, rgba(var(--color-accent-rgb), 0.08) 100%);
    border-color: rgba(var(--color-primary-rgb), 0.35);
    transform: translateY(-2px);
}

/* ================================================================
   CHAT MESSAGE WRAPPER - Matches Main Chat Tab Design
   Structure: message-wrapper > message-avatar + message-content > message-bubble
   ================================================================ */

/* Message Wrapper - Container for avatar + content */
.workspace-chat-messages .message-wrapper {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    align-items: flex-start;
    width: 100%;
    max-width: 1200px;
    /* Wider than before but still centered */
    /* Assistant messages centered like Gemini */
    align-self: center;
}

/* User messages: align right */
.workspace-chat-messages .message-wrapper.user {
    flex-direction: row-reverse;
    /* User messages align right */
    align-self: flex-end;
    margin-left: auto;
}

/* Message Avatar */
.workspace-chat-messages .message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
    background: var(--purple-light, #EEE9F7);
    color: var(--color-primary, #4B2A7A);
}

.workspace-chat-messages .message-wrapper.user .message-avatar {
    background: var(--color-primary, #4B2A7A);
    color: #ffffff;
}

/* Message Content Container */
.workspace-chat-messages .message-content {
    flex: 1;
    min-width: 0;
}

/* Assistant messages - centered like Gemini */
.workspace-chat-messages .message-wrapper:not(.user) .message-content {
    max-width: 100%;
    /* Use full width of container */
    margin: 0 auto;
    /* Center the content */
}

/* User messages - align right */
.workspace-chat-messages .message-wrapper.user .message-content {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    max-width: 75%;
    /* Limit width for user messages */
    margin-left: auto;
    /* Push to right */
}

/* Message Bubble */
.workspace-chat-messages .message-bubble {
    padding: 14px 18px;
    border-radius: 20px;
    font-size: 0.95rem;
    line-height: 1.7;
    word-wrap: break-word;
}

/* Reset pre/code defaults inside message bubbles */
.workspace-chat-messages .message-bubble pre:not(.code-block) {
    background: transparent;
    margin: 0;
    padding: 0;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    white-space: pre-wrap;
    overflow: visible;
    border: none;
    color: inherit;
}

/* User message bubble */
.workspace-chat-messages .message-wrapper.user .message-bubble {
    background: var(--purple-light, #EEE9F7);
    color: var(--text-primary, #1F1F1F);
    border-bottom-right-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* Assistant message bubble */
.workspace-chat-messages .message-wrapper.assistant .message-bubble {
    background: transparent;
    color: var(--text-primary, #1F1F1F);
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
}

/* Loading state */
.workspace-chat-messages .message-wrapper.loading {
    opacity: 0.8;
}

.workspace-chat-messages .message-wrapper.loading .message-bubble {
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ================================================================
   MESSAGE ATTACHMENTS (Inline like Gemini/ChatGPT)
   ================================================================ */

.workspace-chat-messages .message-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.workspace-chat-messages .message-attachment {
    border-radius: 8px;
    overflow: hidden;
    background: #f5f5f5;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.workspace-chat-messages .attachment-image {
    max-width: 200px;
    max-height: 200px;
    display: block;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.workspace-chat-messages .attachment-image:hover {
    transform: scale(1.02);
}

.workspace-chat-messages .attachment-file {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    min-width: 150px;
}

.workspace-chat-messages .attachment-file svg {
    flex-shrink: 0;
    color: #666;
}

.workspace-chat-messages .attachment-filename {
    font-size: 13px;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

.workspace-chat-messages .attachment-filesize {
    font-size: 11px;
    color: #888;
    white-space: nowrap;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .workspace-chat-messages .message-attachment {
        background: rgba(255, 255, 255, 0.08);
        border-color: rgba(255, 255, 255, 0.1);
    }

    .workspace-chat-messages .message-attachments {
        border-top-color: rgba(255, 255, 255, 0.1);
    }

    .workspace-chat-messages .attachment-file svg {
        color: #aaa;
    }

    .workspace-chat-messages .attachment-filename {
        color: #eee;
    }

    .workspace-chat-messages .attachment-filesize {
        color: #888;
    }
}

/* ================================================================
   AGENT RESPONSE FORMATTING - Matches Chat Tab
   ================================================================ */

/* Headings in responses */
.workspace-chat-messages .message-bubble .response-heading {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 16px 0 8px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(var(--color-primary-rgb), 0.1);
}

.workspace-chat-messages .message-bubble .response-heading:first-child {
    margin-top: 0;
}

/* Headings that come directly from markdown (e.g. ### Step 1) */
.workspace-chat-messages .message-bubble h1,
.workspace-chat-messages .message-bubble h2,
.workspace-chat-messages .message-bubble h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 16px 0 8px 0;
    padding-bottom: 0;
    border-bottom: none;
}

.workspace-chat-messages .message-bubble h3 {
    text-transform: none;
    letter-spacing: normal;
}

/* Paragraphs in responses */
.workspace-chat-messages .message-bubble p {
    margin: 0 0 12px 0;
    line-height: 1.7;
}

.workspace-chat-messages .message-bubble p:last-child {
    margin-bottom: 0;
}

/* Lists in responses - Clean, scannable format matching main Chat */
.workspace-chat-messages .message-bubble .response-list {
    margin: 12px 0;
    padding-left: 0;
    list-style: none;
    color: var(--text-primary, #1F2937);
}

.workspace-chat-messages .message-bubble .response-list li {
    margin: 12px 0;
    line-height: 1.7;
    position: relative;
    padding-left: 24px;
    color: var(--text-primary, #1F2937);
}

.workspace-chat-messages .message-bubble .response-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 10px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-hover) 100%);
}

.workspace-chat-messages .message-bubble ol.response-list {
    counter-reset: item;
}

.workspace-chat-messages .message-bubble ol.response-list li {
    counter-increment: item;
}

.workspace-chat-messages .message-bubble ol.response-list li::before {
    content: counter(item) '.';
    left: -24px;
    font-weight: 600;
    color: var(--color-primary);
}

.workspace-chat-messages .message-bubble .response-list li strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Code blocks in responses */
.workspace-chat-messages .message-bubble .code-block-wrapper {
    margin: 16px 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.workspace-chat-messages .message-bubble .code-block {
    background: #f8f9fa;
    color: #1e293b;
    padding: 16px;
    font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    line-height: 1.5;
    overflow-x: auto;
    white-space: pre;
    margin: 0;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.workspace-chat-messages .message-bubble .code-block code {
    background: transparent;
    padding: 0;
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    border: none;
}

/* Remove borders from highlight.js syntax spans */
.workspace-chat-messages .message-bubble .code-block code *,
.workspace-chat-messages .message-bubble .code-block code span,
.workspace-chat-messages .message-bubble .code-block .hljs,
.workspace-chat-messages .message-bubble .code-block .hljs * {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
}

/* Code copy button (for code blocks) */
.workspace-chat-messages .message-bubble .code-copy-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 6px 10px;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
    z-index: 10;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.workspace-chat-messages .message-bubble .code-copy-btn:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
    color: #374151;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.workspace-chat-messages .message-bubble .code-copy-btn.copied {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
    color: #22c55e;
}

/* Message action buttons (copy whole message) */
.workspace-chat-messages .message-content .message-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.workspace-chat-messages .message-wrapper:hover .message-actions {
    opacity: 1;
}

.workspace-chat-messages .message-action-btn {
    background: transparent;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 6px 8px;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 14px;
}

.workspace-chat-messages .message-action-btn:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
    color: #374151;
}

/* Inline code */
.workspace-chat-messages .message-bubble .inline-code,
.workspace-chat-messages .message-bubble code:not(.code-block code) {
    background: rgba(var(--color-primary-rgb), 0.08);
    color: var(--color-primary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
    font-size: 0.9em;
}

/* Strong/Bold text */
.workspace-chat-messages .message-bubble strong {
    font-weight: 600;
    color: var(--text-primary);
}

/* Emphasis/Italic text */
.workspace-chat-messages .message-bubble em {
    font-style: italic;
    color: var(--text-secondary);
}

.typing-dots {
    display: inline-flex;
    gap: 4px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: var(--color-primary);
    border-radius: 50%;
    animation: typingDot 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) {
    animation-delay: 0s;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingDot {

    0%,
    80%,
    100% {
        transform: scale(0.6);
        opacity: 0.5;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ================================================================
   STANDALONE TYPING INDICATOR - Matches Main Chat Tab
   Small pill with dots, NOT inside a message wrapper
   ================================================================ */
.agent-typing-indicator {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 12px 16px;
    margin-left: 48px;
    /* Align with where assistant messages start (avatar width + gap) */
}

.agent-typing-indicator .typing-dots {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 20px;
    background: rgba(128, 128, 128, 0.08);
    border-radius: 20px;
    border: none !important;
    box-shadow: none !important;
}

.agent-typing-indicator .typing-dots .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #7c3aed;
    /* Fallback purple color */
    background: var(--color-primary, #7c3aed);
    opacity: 0.6;
    animation: agentTypingPulse 1.4s infinite ease-in-out;
}

.agent-typing-indicator .typing-dots .dot:nth-child(1) {
    animation-delay: 0s;
}

.agent-typing-indicator .typing-dots .dot:nth-child(2) {
    animation-delay: 0.16s;
}

.agent-typing-indicator .typing-dots .dot:nth-child(3) {
    animation-delay: 0.32s;
}

@keyframes agentTypingPulse {

    0%,
    60%,
    100% {
        transform: scale(0.8);
        opacity: 0.4;
    }

    30% {
        transform: scale(1.1);
        opacity: 1;
    }
}

/* ================================
   INLINE ATTACHMENT PREVIEWS (Claude-style)
   ================================ */

/* Container for inline attachment previews */
.inline-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 12px;
    margin-bottom: 4px;
}

/* Inline attachment thumbnail */
.inline-attachment {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    overflow: hidden;
    background: rgba(var(--color-primary-rgb), 0.08);
    border: 1.5px solid rgba(var(--color-primary-rgb), 0.15);
    cursor: pointer;
    transition: all 0.2s ease;
}

.inline-attachment:hover {
    transform: scale(1.05);
    border-color: var(--color-primary);
}

.inline-attachment img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* File type icon for non-images */
.inline-attachment .file-icon {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
}

.inline-attachment .file-icon svg {
    width: 20px;
    height: 20px;
}

/* Remove button on hover */
.inline-attachment .remove-btn {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ef4444;
    color: white;
    border: 2px solid white;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    cursor: pointer;
}

.inline-attachment:hover .remove-btn {
    opacity: 1;
}

.inline-attachment .remove-btn svg {
    width: 10px;
    height: 10px;
}

/* ================================
   DRAG AND DROP OVERLAY
   ================================ */

.drag-overlay {
    position: fixed;
    inset: 0;
    background: rgba(var(--color-primary-rgb), 0.1);
    backdrop-filter: blur(4px);
    border: 3px dashed var(--color-primary);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.drag-overlay.active {
    display: flex;
}

.drag-overlay-content {
    background: white;
    padding: 32px 48px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(var(--color-primary-rgb), 0.2);
    pointer-events: auto;
}

.drag-overlay-content svg {
    width: 48px;
    height: 48px;
    color: var(--color-primary);
    margin-bottom: 16px;
}

.drag-overlay-content h3 {
    margin: 0 0 8px;
    color: #1f2937;
    font-size: 18px;
}

.drag-overlay-content p {
    margin: 0;
    color: #6b7280;
    font-size: 14px;
}

/* ================================
   UNIFIED CHAT INPUT STYLES
   Matching Claude/Gemini/ChatGPT design
   ================================ */

/* Base input container - unified design */
.workspace-chat-input {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    padding: 12px 16px 16px;
    background: transparent;
    position: relative;
    max-width: 100%;
    margin: 0 auto;
    width: 100%;
}

/* Unified input container pill shape */
.workspace-chat-input .input-container,
.modern-input-container {
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg-card);
    border: 1.5px solid rgba(var(--color-primary-rgb), 0.12);
    border-radius: 20px;
    box-shadow:
        0 4px 16px rgba(var(--color-primary-rgb), 0.06),
        0 2px 6px rgba(0, 0, 0, 0.03);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

/* Focus state - subtle glow */
.workspace-chat-input .input-container:focus-within,
.modern-input-container:focus-within {
    border-color: rgba(var(--color-primary-rgb), 0.3);
    box-shadow:
        0 6px 24px rgba(var(--color-primary-rgb), 0.1),
        0 3px 8px rgba(0, 0, 0, 0.04);
}

/* With attachments */
.workspace-chat-input .input-container.has-attachments,
.modern-input-container.has-attachments {
    border-color: rgba(var(--color-primary-rgb), 0.35);
}

/* Unified action button (+ button) */
.workspace-chat-input .input-actions-btn,
.modern-input-container .input-action-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1.5px solid rgba(var(--color-primary-rgb), 0.15);
    background: rgba(var(--color-primary-rgb), 0.05);
    color: var(--color-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.workspace-chat-input .input-actions-btn:hover,
.modern-input-container .input-action-btn:hover {
    background: rgba(var(--color-primary-rgb), 0.1);
    border-color: rgba(var(--color-primary-rgb), 0.3);
    transform: scale(1.05);
}

.workspace-chat-input .input-actions-btn[aria-expanded="true"],
.modern-input-container .input-action-btn[aria-expanded="true"] {
    background: rgba(var(--color-primary-rgb), 0.12);
    border-color: var(--color-primary);
    transform: rotate(45deg);
}

/* Unified textarea */
.workspace-chat-input textarea,
.modern-chat-input {
    flex: 1;
    border: none !important;
    background: transparent !important;
    font-size: 15px;
    color: #0f172a;
    resize: none;
    outline: none !important;
    box-shadow: none !important;
    -webkit-box-shadow: none !important;
    font-family: inherit;
    line-height: 1.5;
    max-height: 120px;
    min-height: 22px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    -webkit-text-fill-color: #0f172a;
    padding: 8px 0;
}

.workspace-chat-input textarea:focus,
.modern-chat-input:focus {
    background: transparent !important;
    outline: none !important;
    box-shadow: none !important;
}

.workspace-chat-input textarea::placeholder,
.modern-chat-input::placeholder {
    color: #9ca3af;
    font-weight: 500;
}

/* Unified send button */
.workspace-chat-input .send-btn-enhanced,
.modern-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: var(--color-primary);
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    flex-shrink: 0;
    box-shadow:
        0 4px 12px rgba(var(--color-primary-rgb), 0.25),
        0 0 16px rgba(var(--color-primary-rgb), 0.08);
}

.workspace-chat-input .send-btn-enhanced:hover,
.modern-send-btn:hover {
    transform: scale(1.08);
    box-shadow:
        0 6px 20px rgba(var(--color-primary-rgb), 0.35),
        0 0 30px rgba(var(--color-primary-rgb), 0.12);
}

.workspace-chat-input .send-btn-enhanced:disabled,
.modern-send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Voice Input Recording State */
.voice-input-btn.recording {
    background: #ef4444 !important;
    border-color: #ef4444 !important;
    animation: voicePulse 1.5s ease-in-out infinite;
}

.voice-input-btn.recording svg {
    color: white;
}

@keyframes voicePulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }
}

/* Chat Input - New Design */
.workspace-chat-input {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    padding: 16px 80px 24px;
    /* Match chat messages padding */
    background: transparent;
    position: relative;
    max-width: 1200px;
    /* Match chat messages max-width */
    margin: 0 auto;
    width: 100%;
}

.chat-plus-btn {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    border: 1px solid rgba(109, 93, 246, 0.2);
    background: #fff;
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(109, 93, 246, 0.1);
}

.chat-plus-btn:hover,
.chat-plus-btn.active {
    background: rgba(109, 93, 246, 0.05);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(109, 93, 246, 0.15);
}

/* Popover Menu */
.chat-actions-popover {
    position: absolute;
    bottom: 80px;
    left: 24px;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
    padding: 8px;
    min-width: 220px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 1000;
    transform-origin: bottom left;
    animation: popoverScale 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes popoverScale {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.popover-header {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: #9ca3af;
    padding: 8px 12px 4px;
    letter-spacing: 0.5px;
}

.popover-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
    color: #374151;
    font-weight: 500;
    transition: all 0.2s;
}

.popover-item:hover {
    background: rgba(109, 93, 246, 0.06);
    color: var(--color-primary);
}

.popover-icon {
    font-size: 1.1rem;
    width: 20px;
    display: inline-flex;
    justify-content: center;
}

.popover-divider {
    height: 1px;
    background: rgba(0, 0, 0, 0.08);
    margin: 8px 0;
}

.popover-item-upload {
    color: var(--purple-dark, #4B2A7A);
}

.popover-item-upload:hover {
    background: var(--purple-light, #EEE9F7);
}

/* Context Sidebar - Tasks, Files, Memory */
/* Permanent Right Panel */
.workspace-right-panel {
    width: 380px;
    /* Slightly wider for better content */
    background: #ffffff;
    border-left: 1px solid rgba(109, 93, 246, 0.08);
    /* Subtle border matching header */
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
    z-index: 5;
}

/* Remove collapsed state styles - Panel is permanent */
.workspace-right-panel.collapsed {
    width: 380px;
    /* Force open even if class exists */
    border-left: 1px solid rgba(109, 93, 246, 0.08);
}

.panel-tabs {
    display: flex;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    background: #fafbfc;
}

.panel-tab {
    flex: 1;
    padding: 12px 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: #6b7280;
    background: transparent;
    border: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.panel-tab:hover {
    color: var(--color-primary);
    background: rgba(var(--color-primary-rgb), 0.02);
}

.panel-tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
    background: #ffffff;
}

.panel-body {
    flex: 1;
    overflow-y: auto;
    position: relative;
    background: #ffffff;
}

.panel-tab-content {
    display: none;
    padding: 0;
    height: 100%;
    animation: fadeIn 0.3s ease-out;
}

.panel-tab-content.active {
    display: flex;
    flex-direction: column;
}

.panel-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 40px;
    text-align: center;
    color: #9ca3af;
}

.placeholder-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.placeholder-hint {
    font-size: 0.75rem;
    background: rgba(102, 126, 234, 0.1);
    color: var(--color-primary);
    padding: 4px 8px;
    border-radius: 4px;
    margin-top: 12px;
}

.panel-footer-action {
    padding: 16px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    background: #fafbfc;
    margin-top: auto;
}

.sidebar-panel {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 20px 24px;
    transition: background 0.2s ease;
}

.sidebar-panel:hover {
    background: rgba(102, 126, 234, 0.02);
}

.sidebar-panel:last-child {
    border-bottom: none;
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.panel-icon {
    font-size: 1.2rem;
}

.panel-title {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 700;
    color: #1f2937;
    flex: 1;
}

.panel-count {
    font-size: 0.75rem;
    padding: 3px 10px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(168, 85, 247, 0.1) 100%);
    color: var(--color-primary);
    border-radius: 12px;
    font-weight: 600;
}

.panel-content {
    min-height: 60px;
    max-height: 180px;
    overflow-y: auto;
    margin-bottom: 12px;
}

.panel-empty {
    color: #9ca3af;
    font-size: 0.875rem;
    text-align: center;
    padding: 20px 0;
    margin: 0;
    font-style: italic;
}

.panel-action-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(168, 85, 247, 0.05) 100%);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 12px;
    color: var(--color-primary);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.panel-action-btn:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(168, 85, 247, 0.1) 100%);
    border-color: rgba(102, 126, 234, 0.4);
    transform: translateY(-1px);
}

/* Panel Items */
.panel-task-item,
.panel-automation-item,
.panel-memory-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 10px;
    margin-bottom: 8px;
    font-size: 0.875rem;
    color: #374151;
}

.panel-task-item:last-child,
.panel-automation-item:last-child,
.panel-memory-item:last-child {
    margin-bottom: 0;
}

.panel-task-checkbox {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(102, 126, 234, 0.4);
    border-radius: 5px;
    flex-shrink: 0;
    cursor: pointer;
    transition: all 0.2s ease;
}

.panel-task-checkbox.completed {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-color: #10b981;
}

.panel-automation-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.panel-automation-status.active {
    background: #10b981;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

.panel-automation-status.paused {
    background: #f59e0b;
}

.panel-memory-key {
    font-weight: 600;
    color: var(--color-primary);
}

/* Memory Panel Interactive Styles */
.panel-memory-item {
    position: relative;
    justify-content: space-between;
}

.panel-memory-item .memory-text {
    flex: 1;
    word-break: break-word;
}

.panel-memory-item .memory-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.panel-memory-item:hover .memory-actions {
    opacity: 1;
}

.panel-memory-item .memory-edit,
.panel-memory-item .memory-delete,
.panel-memory-item .memory-save,
.panel-memory-item .memory-cancel {
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    transition: all 0.2s ease;
    background: transparent;
}

.panel-memory-item .memory-edit:hover {
    background: rgba(102, 126, 234, 0.15);
}

.panel-memory-item .memory-delete:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.panel-memory-item .memory-save {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.panel-memory-item .memory-save:hover {
    background: rgba(16, 185, 129, 0.25);
}

.panel-memory-item .memory-cancel:hover {
    background: rgba(107, 114, 128, 0.15);
}

.panel-memory-item .memory-edit-input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 6px;
    font-size: 0.875rem;
    background: #f9fafb;
    outline: none;
    transition: border-color 0.2s ease;
}

.panel-memory-item .memory-edit-input:focus {
    border-color: var(--color-primary);
    background: #ffffff;
}

/* Conversations Panel Styles */
.panel-conversation-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 10px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.panel-conversation-item:hover {
    background: rgba(102, 126, 234, 0.05);
    border-color: rgba(102, 126, 234, 0.2);
}

.panel-conversation-item.active {
    background: rgba(102, 126, 234, 0.1);
    border-color: rgba(102, 126, 234, 0.4);
}

.panel-conversation-item .conversation-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.panel-conversation-item .conversation-title {
    font-size: 0.85rem;
    font-weight: 500;
    color: #374151;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.panel-conversation-item .conversation-date {
    font-size: 0.7rem;
    color: #9ca3af;
}

.panel-conversation-item .conversation-delete {
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #9ca3af;
    font-size: 1rem;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.panel-conversation-item:hover .conversation-delete {
    opacity: 1;
}

.panel-conversation-item .conversation-delete:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

/* New Chat Button Styling */
.panel-action-btn.new-chat-btn {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(168, 85, 247, 0.1) 100%);
    color: var(--color-primary);
    font-weight: 600;
}

/* Quick Actions Bar - Fixed at bottom */
.workspace-quick-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 16px 32px;
    background: rgba(255, 255, 255, 0.95);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    flex-wrap: wrap;
    backdrop-filter: blur(10px);
    flex-shrink: 0;
}

.quick-action-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: #ffffff;
    border: 1px solid rgba(102, 126, 234, 0.15);
    border-radius: 14px;
    color: #4b5563;
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.quick-action-btn:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(168, 85, 247, 0.05) 100%);
    border-color: rgba(102, 126, 234, 0.3);
    color: var(--color-primary);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.12);
}

.quick-action-icon {
    font-size: 1.2rem;
}

/* =================================================
   AGENT CREATION MODAL - Light Theme
   ================================================= */

.agent-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.agent-modal[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
}

.agent-modal-content {
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 24px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.95);
    transition: transform 0.3s ease;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
}

.agent-modal[aria-hidden="false"] .agent-modal-content {
    transform: scale(1);
}

.agent-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.agent-modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
}

.agent-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.agent-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    background: #fafbfc;
}

/* Template Preview in Modal */
.selected-template-preview {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(168, 85, 247, 0.05) 100%);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 16px;
    margin-bottom: 24px;
}

.template-preview-icon {
    font-size: 2.5rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.template-preview-info h4 {
    margin: 0 0 4px 0;
    color: #1f2937;
    font-size: 1.1rem;
    font-weight: 700;
}

.template-preview-info p {
    margin: 0;
    color: #6b7280;
    font-size: 0.875rem;
}

/* Form Groups */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #374151;
    font-size: 0.9rem;
    font-weight: 600;
}

.form-group input[type="text"],
#agentNameInput {
    width: 100%;
    padding: 14px 16px;
    background: #ffffff;
    border: 2px solid #9ca3af !important;
    border-radius: 12px;
    color: #1f2937;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.form-group input[type="text"]:hover,
#agentNameInput:hover {
    border-color: #6b7280 !important;
}

/* Empty/invalid state */
.form-group input[type="text"]:invalid,
.form-group input[type="text"].invalid {
    border-color: #fca5a5;
    background: #fef2f2;
}

.form-group input[type="text"]:focus {
    outline: none;
    border-color: rgba(102, 126, 234, 0.5);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group input[type="text"]::placeholder {
    color: #9ca3af;
}

/* Avatar Picker */
.avatar-picker {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.avatar-option {
    width: 50px;
    height: 50px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    background: #ffffff;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-option:hover {
    border-color: rgba(102, 126, 234, 0.3);
    background: rgba(102, 126, 234, 0.05);
}

.avatar-option.selected {
    border-color: var(--color-primary);
    /* Primary */
    background: rgba(109, 93, 246, 0.1);
    box-shadow: 0 0 0 4px rgba(109, 93, 246, 0.15);
    /* Thicker purple ring */
    transform: scale(1.05);
}

/* Validation Message */
.input-with-validation {
    position: relative;
}

.validation-message {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #10b981;
    /* Green */
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0;
    /* Hidden by default */
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.validation-message::before {
    content: '✓';
    font-weight: bold;
}

.validation-message.visible {
    opacity: 1;
}

/* Capabilities Preview */
.capabilities-preview {
    margin-bottom: 24px;
    background: #fafbfc;
    border-radius: 12px;
    padding: 16px;
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.capabilities-preview label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #9ca3af;
    margin-bottom: 8px;
    font-weight: 700;
}

.capabilities-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.capabilities-list li {
    font-size: 0.85rem;
    color: #4b5563;
    display: flex;
    align-items: center;
    gap: 6px;
}

.agent-list-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.03);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #4b5563;
    /* Soft Gray 600 - Matches Cards */
    flex-shrink: 0;
}

.agent-list-avatar svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 1.5;
    /* Matches Cards */
}

.agent-list-item:hover .agent-list-avatar,
.agent-list-item.active .agent-list-avatar {
    background: rgba(109, 93, 246, 0.1);
    color: var(--color-primary);
    /* Active Purple */
}

/* Tone Options */
.tone-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.tone-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    color: #4b5563;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tone-option:hover {
    background: rgba(109, 93, 246, 0.05);
    border-color: rgba(109, 93, 246, 0.2);
}

.tone-option.selected {
    background: linear-gradient(135deg, rgba(109, 93, 246, 0.1) 0%, rgba(168, 85, 247, 0.08) 100%);
    border-color: rgba(109, 93, 246, 0.4);
    color: var(--color-primary);
    font-weight: 600;
}

.tone-icon {
    font-size: 1.3rem;
}

/* Modal Buttons */
.modal-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-btn.secondary {
    background: rgba(0, 0, 0, 0.05);
    color: #4b5563;
}

.modal-btn.secondary:hover {
    background: rgba(0, 0, 0, 0.1);
}

.modal-btn.primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-hover) 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(109, 93, 246, 0.3);
}

.modal-btn.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(109, 93, 246, 0.4);
}

.modal-btn.primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Close button */
.close-modal-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.05);
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.close-modal-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* =================================================
   RESPONSIVE DESIGN
   ================================================= */

@media (max-width: 1200px) {
    .workspace-chat {
        flex: 6;
    }

    .workspace-sidebar {
        flex: 4;
    }

    .templates-grid {
        grid-template-columns: repeat(3, minmax(220px, 280px));
    }
}

@media (max-width: 1024px) {

    .agents-sidebar,
    .workspace-agents-panel {
        width: 260px;
    }

    .templates-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .agents-welcome {
        padding: 20px 30px;
    }
}

@media (max-width: 768px) {
    .agents-marketplace {
        flex-direction: column;
    }

    .agents-sidebar {
        width: 100%;
        height: auto;
        max-height: 200px;
        border-right: none;
        border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    }

    .agents-list {
        flex-direction: row;
        overflow-x: auto;
        gap: 8px;
    }

    .agent-list-item {
        min-width: 150px;
        flex-shrink: 0;
    }

    .workspace-content {
        flex-direction: column;
    }

    .workspace-chat {
        flex: 1;
        min-height: 50vh;
    }

    .workspace-sidebar {
        flex: none;
        height: 200px;
        flex-direction: row;
        overflow-x: auto;
        border-left: none;
        border-top: 1px solid rgba(0, 0, 0, 0.06);
    }

    .sidebar-panel {
        min-width: 220px;
        border-bottom: none;
        border-right: 1px solid rgba(0, 0, 0, 0.05);
    }

    .sidebar-panel:last-child {
        border-right: none;
    }

    .templates-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .workspace-chat-messages,
    .workspace-chat-input {
        padding-left: 20px;
        padding-right: 20px;
    }
}

@media (max-width: 480px) {
    .agents-welcome h2 {
        font-size: 1.8rem;
    }

    .templates-grid {
        grid-template-columns: 1fr;
    }

    .template-card {
        padding: 20px;
    }

    .workspace-header {
        padding: 12px 16px;
    }

    .workspace-agent-name {
        font-size: 1.1rem;
    }

    .quick-action-btn {
        padding: 10px 14px;
        font-size: 0.85rem;
    }

    .tone-options {
        grid-template-columns: 1fr;
    }
}

/* =================================================
   Agent Activity Strip
   ================================================= */
.agents-activity-strip {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-bottom: 24px;
    width: 100%;
    max-width: 600px;
    animation: fadeIn 0.5s ease-out;
}

.agent-stat-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    background: #ffffff;
    border: 1px solid rgba(102, 126, 234, 0.15);
    border-radius: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    font-size: 0.85rem;
    transition: all 0.2s ease;
    cursor: default;
}

.agent-stat-pill:hover {
    border-color: rgba(102, 126, 234, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.08);
}

.stat-label {
    color: #6b7280;
    font-weight: 500;
}

.stat-value {
    color: var(--color-primary);
    font-weight: 700;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }

}

/* =================================================
   Template Actions
   ================================================= */
.template-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    width: 100%;
}

.template-btn-create,
.template-btn-preview {
    flex: 1;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.template-btn-create {
    background: var(--purple-light);
    color: var(--purple-dark);
    border: 1px solid var(--purple-border);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.template-btn-create:hover {
    background: #DDD5EC;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
}

.template-btn-preview {
    background: var(--white);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.template-btn-preview:hover {
    background: rgba(0, 0, 0, 0.02);
    border-color: var(--purple-border);
}

/* =================================================
   Marketplace Layout Enhancements
   ================================================= */
.agents-section-label {
    text-align: left;
    /* Or center if preferred, matching layout */
    width: 100%;
    max-width: 900px;
    margin: 0 auto 16px;
    color: var(--color-primary);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.9;
}

.agents-divider {
    width: 100%;
    max-width: 200px;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(109, 93, 246, 0.1), transparent);
    margin: 32px auto;
}

.section-header-row {
    text-align: center;
    margin-bottom: 24px;
}

.section-subtitle {
    font-size: 0.9rem;
    color: #6b7280;
    margin-top: -12px;
    margin-bottom: 0;
}

/* Update Activity Strip to match hierarchy */
.agents-activity-strip {
    margin-bottom: 8px;
}

/* Update colors in Activity Strip */
.agent-stat-pill {
    border: 1px solid rgba(109, 93, 246, 0.15);
    /* Purple tint */
}

.agent-stat-pill:hover {
    border-color: rgba(109, 93, 246, 0.3);
    box-shadow: 0 4px 8px rgba(109, 93, 246, 0.08);
}

.stat-value {
    color: var(--color-primary);
}

/* Mobile responsive for template buttons */
@media (max-width: 768px) {
    .template-actions {
        flex-direction: column;
    }
}

/* =================================================
   Agent State Card (Empty State)
   ================================================= */
.agent-state-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: #ffffff;
    border: 1px solid rgba(109, 93, 246, 0.1);
    border-radius: 16px;
    padding: 32px;
    margin: 40px auto;
    max-width: 500px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    animation: fadeIn 0.5s ease-out;
}

.agent-state-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 16px;
}

.agent-state-avatar {
    font-size: 3rem;
    margin-bottom: 12px;
    background: rgba(109, 93, 246, 0.1);
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.agent-state-header h3 {
    font-size: 1.5rem;
    margin: 0;
    color: #1f2937;
}

.agent-state-desc {
    color: #6b7280;
    font-size: 0.95rem;
    margin-bottom: 24px;
    line-height: 1.5;
}

.agent-state-prompts {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.state-prompt-chip {
    background: #f3f4f6;
    border: 1px solid transparent;
    padding: 8px 16px;
    border-radius: 20px;
    color: #4b5563;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.state-prompt-chip:hover {
    background: #ffffff;
    border-color: rgba(109, 93, 246, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    color: var(--color-primary);
}

/* Thinking Status Animation */
.status-thinking {
    color: var(--color-primary) !important;
    font-weight: 600;
    animation: statusPulse 1.5s infinite ease-in-out;
}

@keyframes statusPulse {
    0% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.6;
    }
}

/* =================================================
   Action Suggestions (Above Input)
   ================================================= */
.action-suggestions {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    padding: 0 4px;
    overflow-x: auto;
    /* Hide scrollbar */
    scrollbar-width: none;
}

.action-suggestions::-webkit-scrollbar {
    display: none;
}

.action-suggestion-pill {
    background: rgba(109, 93, 246, 0.08);
    /* Primary soft */
    color: var(--color-primary);
    border: 1px solid transparent;
    border-radius: 16px;
    padding: 6px 12px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.action-suggestion-pill:hover {
    background: rgba(109, 93, 246, 0.15);
    transform: translateY(-1px);
}

/* =================================================
   Workspace Header Tooltip
   ================================================= */
.workspace-agent-tooltip {
    margin-left: 8px;
    color: #9ca3af;
    cursor: help;
    display: flex;
    align-items: center;
    transition: color 0.2s;
    position: relative;
}

.workspace-agent-tooltip:hover {
    color: var(--color-primary);
}

/* Agent Brain Panel Enhancements */
.panel-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.tab-count {
    font-size: 0.7rem;
    background: rgba(109, 93, 246, 0.1);
    color: var(--color-primary);
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 700;
    line-height: 1;
}

.panel-tab.active .tab-count {
    background: var(--color-primary);
    color: #ffffff;
}

.panel-inline-action {
    background: transparent;
    border: none;
    color: var(--color-primary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 16px;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: inline-block;
}

.panel-inline-action:hover {
    background: rgba(109, 93, 246, 0.08);
    transform: translateY(-1px);
}

.panel-inline-action.disabled {
    color: #9ca3af;
    cursor: not-allowed;
    background: transparent !important;
    transform: none;
}

/* =================================================
   Panel Placeholders Refinement
   ================================================= */
.panel-placeholder.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.panel-placeholder.disabled .placeholder-hint {
    background: rgba(0, 0, 0, 0.05);
    color: #9ca3af;
}

/* Files Panel Items */
.panel-file-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.panel-file-item:hover {
    background: rgba(109, 93, 246, 0.03);
    border-color: rgba(109, 93, 246, 0.2);
    transform: translateY(-1px);
}

.file-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(109, 93, 246, 0.1);
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.file-info {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-meta {
    font-size: 0.75rem;
    color: #9ca3af;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Scrollbar refinement for panels */
.panel-body::-webkit-scrollbar {
    width: 5px;
}

.panel-body::-webkit-scrollbar-track {
    background: transparent;
}

.panel-body::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

.panel-body::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

/* =================================================
   AGENT CHAT REDESIGN - UI/UX OVERHAUL
   Modern, accessible, and engaging interface
   ================================================= */

/* Screen Reader Only Utility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* =================================================
   HEADER REDESIGN
   ================================================= */

.workspace-header-redesigned {
    height: 64px;
    padding: 0 24px;
    background: var(--white);
    border-bottom: 1px solid var(--purple-border, #E3DBF3);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    transition: box-shadow var(--transition-fast, 0.2s ease);
    flex-shrink: 0;
}

.workspace-header-redesigned.scrolled {
    box-shadow: var(--shadow-sm, 0px 2px 4px rgba(0, 0, 0, 0.04));
}

.header-left-group {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-right-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Breadcrumb Navigation */
.header-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
}

.breadcrumb-back {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: var(--radius-sm, 8px);
    background: var(--purple-light, #EEE9F7);
    color: var(--purple-dark, #4B2A7A);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast, 0.2s ease);
}

.breadcrumb-back:hover {
    background: var(--purple-dark, #4B2A7A);
    color: var(--white);
    transform: translateX(-2px);
}

.breadcrumb-back:focus-visible {
    outline: 2px solid var(--purple-dark, #4B2A7A);
    outline-offset: 2px;
}

.breadcrumb-separator {
    color: var(--text-tertiary, #9A9A9A);
    font-size: 14px;
}

.breadcrumb-current {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary, #6B6B6B);
}

/* Agent Identity Card */
.agent-identity-card {
    display: flex;
    align-items: center;
    gap: 12px;
}

.agent-avatar-container {
    position: relative;
}

.agent-avatar-ring {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm, 8px);
    background: var(--purple-light, #EEE9F7);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid transparent;
    transition: border-color var(--transition-fast, 0.2s ease);
    font-size: 1.2rem;
}

.agent-avatar-ring[data-status="active"] {
    border-color: var(--success-color, #10B981);
}

.agent-avatar-ring[data-status="thinking"] {
    border-color: var(--purple-dark, #4B2A7A);
    animation: avatarPulse 1.5s ease-in-out infinite;
}

@keyframes avatarPulse {

    0%,
    100% {
        border-color: var(--purple-dark, #4B2A7A);
        opacity: 1;
    }

    50% {
        border-color: var(--purple-light, #EEE9F7);
        opacity: 0.7;
    }
}

.status-indicator {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--success-color, #10B981);
    border: 2px solid var(--white);
    transition: background var(--transition-fast, 0.2s ease);
}

.agent-identity-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.workspace-header-redesigned .workspace-agent-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary, #1F1F1F);
    margin: 0;
    line-height: 1.2;
}

.agent-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color, #10B981);
}

.status-badge.thinking {
    background: var(--purple-light, #EEE9F7);
    color: var(--purple-dark, #4B2A7A);
    animation: statusPulse 1.5s ease-in-out infinite;
}

@keyframes statusPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

.conversation-count {
    font-size: 11px;
    color: var(--text-tertiary, #9A9A9A);
}

/* Header Actions */
.header-actions-cluster {
    display: flex;
    gap: 4px;
}

.header-action-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--radius-sm, 8px);
    background: transparent;
    color: var(--text-secondary, #6B6B6B);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast, 0.2s ease);
}

.header-action-btn:hover {
    background: var(--purple-light, #EEE9F7);
    color: var(--purple-dark, #4B2A7A);
}

.header-action-btn:focus-visible {
    outline: 2px solid var(--purple-dark, #4B2A7A);
    outline-offset: 2px;
}

/* Panel Toggle Enhanced */
.panel-toggle-enhanced {
    width: 40px;
    height: 40px;
    border: 1px solid var(--purple-border, #E3DBF3);
    border-radius: var(--radius-sm, 8px);
    background: var(--white);
    color: var(--purple-dark, #4B2A7A);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all var(--transition-fast, 0.2s ease);
    margin-left: 8px;
}

.panel-toggle-enhanced:hover {
    background: var(--purple-light, #EEE9F7);
    border-color: var(--purple-dark, #4B2A7A);
}

.panel-toggle-enhanced[aria-expanded="false"] .panel-icon-open {
    display: none;
}

.panel-toggle-enhanced[aria-expanded="true"] .panel-icon-closed {
    display: none;
}

.panel-notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: var(--purple-dark, #4B2A7A);
    color: var(--white);
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.panel-notification-badge[hidden] {
    display: none;
}

/* =================================================
   WELCOME EXPERIENCE
   ================================================= */

.welcome-experience {
    max-width: 560px;
    margin: 40px auto;
    padding: 48px 40px;
    text-align: center;
    animation: welcomeFadeIn 0.5s ease-out;
}

@keyframes welcomeFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.welcome-hero {
    margin-bottom: 40px;
}

.welcome-avatar-large {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    border-radius: var(--radius-md, 16px);
    background: linear-gradient(135deg, var(--purple-light, #EEE9F7) 0%, var(--white) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: var(--shadow-md, 0px 4px 12px rgba(0, 0, 0, 0.06));
    font-size: 2.5rem;
}

.welcome-avatar-glow {
    position: absolute;
    inset: -4px;
    border-radius: 20px;
    background: var(--purple-dark, #4B2A7A);
    opacity: 0.1;
    filter: blur(12px);
    z-index: -1;
}

.welcome-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary, #1F1F1F);
    margin: 0 0 12px;
}

.welcome-title span {
    color: var(--purple-dark, #4B2A7A);
}

.welcome-description {
    font-size: 15px;
    color: var(--text-secondary, #6B6B6B);
    line-height: 1.6;
    margin: 0;
}

/* Capabilities Section */
.welcome-capabilities {
    margin-bottom: 32px;
}

.capabilities-title,
.suggestions-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-tertiary, #9A9A9A);
    margin: 0 0 16px;
}

.capability-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.capability-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--white);
    border: 1px solid var(--purple-border, #E3DBF3);
    border-radius: var(--radius-full, 9999px);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary, #1F1F1F);
    cursor: pointer;
    transition: all var(--transition-fast, 0.2s ease);
}

.capability-chip:hover {
    background: var(--purple-light, #EEE9F7);
    border-color: var(--purple-dark, #4B2A7A);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm, 0px 2px 4px rgba(0, 0, 0, 0.04));
}

.capability-chip svg {
    width: 16px;
    height: 16px;
    color: var(--purple-dark, #4B2A7A);
}

/* Suggestion Prompts */
.welcome-suggestions {
    text-align: left;
}

.suggestion-prompts {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.suggestion-prompts .agent-quick-prompt {
    padding: 14px 20px;
    background: var(--purple-light, #EEE9F7);
    border: 1px solid transparent;
    border-radius: var(--radius-sm, 8px);
    font-size: 14px;
    font-weight: 500;
    color: var(--purple-dark, #4B2A7A);
    cursor: pointer;
    text-align: left;
    transition: all var(--transition-fast, 0.2s ease);
}

.suggestion-prompts .agent-quick-prompt:hover {
    background: var(--white);
    border-color: var(--purple-dark, #4B2A7A);
    transform: translateX(4px);
}

/* =================================================
   TYPING INDICATOR
   ================================================= */

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 0;
    animation: typingFadeIn 0.3s ease-out;
}

.typing-indicator[hidden] {
    display: none;
}

@keyframes typingFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.typing-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm, 8px);
    background: var(--purple-light, #EEE9F7);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--purple-dark, #4B2A7A);
}

.typing-bubble {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--white);
    border: 1px solid var(--border-color, #E6E6E6);
    border-radius: var(--radius-md, 16px);
    border-bottom-left-radius: 4px;
}

.typing-text {
    font-size: 13px;
    color: var(--text-secondary, #6B6B6B);
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--purple-dark, #4B2A7A);
    animation: typingBounce 1.4s ease-in-out infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.4;
    }

    30% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

/* =================================================
   ENHANCED INPUT AREA
   ================================================= */

.workspace-chat-input-enhanced {
    position: relative;
    padding: 16px 24px 24px;
    background: linear-gradient(to top, var(--white) 0%, var(--white) 80%, transparent 100%);
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

/* Attachments Preview */
.input-attachments {
    display: flex;
    gap: 8px;
    padding: 12px;
    margin-bottom: 12px;
    background: var(--purple-light, #EEE9F7);
    border-radius: var(--radius-sm, 8px);
    overflow-x: auto;
}

.input-attachments[hidden] {
    display: none;
}

.attachment-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--white);
    border-radius: 6px;
    font-size: 13px;
}

.attachment-remove {
    width: 20px;
    height: 20px;
    border: none;
    border-radius: 50%;
    background: var(--text-tertiary, #9A9A9A);
    color: var(--white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast, 0.2s ease);
}

.attachment-remove:hover {
    background: var(--error-color, #EF4444);
}

/* Context Suggestions Bar */
.input-context-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    margin-bottom: 12px;
    background: var(--white);
    border: 1px solid var(--purple-border, #E3DBF3);
    border-radius: var(--radius-sm, 8px);
}

.input-context-bar[hidden] {
    display: none;
}

.context-label {
    font-size: 12px;
    color: var(--text-tertiary, #9A9A9A);
    white-space: nowrap;
}

.context-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
}

.context-chip {
    padding: 6px 12px;
    background: var(--purple-light, #EEE9F7);
    border: none;
    border-radius: var(--radius-full, 9999px);
    font-size: 12px;
    font-weight: 500;
    color: var(--purple-dark, #4B2A7A);
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition-fast, 0.2s ease);
}

.context-chip:hover {
    background: var(--purple-dark, #4B2A7A);
    color: var(--white);
}

/* Main Input Container - Matches Chat Tab Design */
.input-container {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: var(--bg-card, #FFFFFF);
    border: 1.5px solid rgba(var(--color-primary-rgb), 0.1);
    border-radius: 24px;
    box-shadow:
        0 4px 20px rgba(var(--color-primary-rgb), 0.08),
        0 2px 8px rgba(0, 0, 0, 0.03);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.input-container:focus-within {
    background: var(--bg-card, #FFFFFF);
    border-color: rgba(102, 126, 234, 0.4);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Simple glow on focus */
.input-container::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 27px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    opacity: 0;
    z-index: -1;
    transition: opacity 0.3s ease;
    filter: blur(12px);
}

.input-container:focus-within::before {
    opacity: 0.3;
}

/* Input container with attachments */
.input-container.has-attachments {
    border-color: rgba(102, 126, 234, 0.4);
}

/* Actions Button - Matches Chat + button */
.input-actions-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1.5px solid rgba(var(--color-primary-rgb), 0.15);
    background: rgba(var(--color-primary-rgb), 0.04);
    color: var(--color-primary, #4B2A7A);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.input-actions-btn:hover {
    background: rgba(var(--color-primary-rgb), 0.1);
    border-color: rgba(var(--color-primary-rgb), 0.3);
    transform: scale(1.05);
}

.input-actions-btn:active {
    transform: scale(0.95);
    background: rgba(var(--color-primary-rgb), 0.15);
}

.input-actions-btn[aria-expanded="true"] {
    background: rgba(var(--color-primary-rgb), 0.12);
    border-color: var(--color-primary, #4B2A7A);
    transform: rotate(45deg);
}

.input-actions-btn[aria-expanded="true"] .icon-plus {
    display: none;
}

.input-actions-btn[aria-expanded="false"] .icon-close,
.input-actions-btn:not([aria-expanded="true"]) .icon-close {
    display: none;
}

/* Text Input Wrapper - Matches Chat Design */
.input-field-wrapper {
    flex: 1;
    position: relative;
}

.input-field-wrapper textarea {
    width: 100%;
    padding: 0;
    border: none !important;
    background: transparent !important;
    background-color: transparent !important;
    font-family: inherit;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text-primary, #1F1F1F);
    resize: none;
    max-height: 120px;
    min-height: 22px;
    outline: none !important;
    box-shadow: none !important;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.input-field-wrapper textarea:focus {
    background: transparent !important;
    outline: none !important;
    box-shadow: none !important;
    border: none !important;
}

.input-field-wrapper textarea::placeholder {
    color: #9ca3af;
    font-weight: 500;
}

.input-character-count {
    position: absolute;
    bottom: 4px;
    right: 8px;
    font-size: 10px;
    color: var(--text-tertiary, #9A9A9A);
}

.input-character-count[hidden] {
    display: none;
}

.input-character-count.warning {
    color: var(--warning-color, #F59E0B);
}

.input-character-count.error {
    color: var(--error-color, #EF4444);
}

/* Voice Input Button */
.voice-input-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: var(--radius-sm, 8px);
    background: transparent;
    color: var(--text-tertiary, #9A9A9A);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--transition-fast, 0.2s ease);
    position: relative;
}

.voice-input-btn:hover:not(:disabled) {
    background: var(--purple-light, #EEE9F7);
    color: var(--purple-dark, #4B2A7A);
}

.voice-input-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.voice-input-btn.recording {
    background: var(--error-color, #EF4444);
    color: var(--white);
    animation: voicePulse 1s ease-in-out infinite;
}

@keyframes voicePulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

/* Send Button Enhanced - Matches Chat Tab Design */
.send-btn-enhanced {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: var(--color-primary, #4B2A7A);
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 12px rgba(var(--color-primary-rgb), 0.3);
}

.send-btn-enhanced:hover:not(:disabled) {
    transform: scale(1.08);
    box-shadow: 0 6px 16px rgba(var(--color-primary-rgb), 0.4);
    background: var(--color-primary-hover, #3D2263);
}

.send-btn-enhanced:disabled {
    background: rgba(var(--color-primary-rgb), 0.15);
    color: var(--color-primary, #4B2A7A);
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.send-btn-enhanced.loading .send-icon {
    display: none;
}

.send-btn-enhanced:not(.loading) .loading-icon {
    display: none;
}

.send-btn-enhanced .loading-icon {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.send-btn-enhanced.success {
    animation: sendSuccess 0.5s ease-out;
}

@keyframes sendSuccess {
    0% {
        background: var(--purple-dark, #4B2A7A);
    }

    50% {
        background: var(--success-color, #10B981);
    }

    100% {
        background: var(--purple-dark, #4B2A7A);
    }
}

/* Actions Popover Enhanced */
.chat-actions-popover-enhanced {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 24px;
    min-width: 280px;
    background: var(--white);
    border: 1px solid var(--purple-border, #E3DBF3);
    border-radius: var(--radius-md, 16px);
    box-shadow: var(--shadow-lg, 0px 8px 24px rgba(0, 0, 0, 0.08));
    padding: 8px;
    z-index: 1000;
    animation: popoverSlideUp 0.2s ease-out;
}

.chat-actions-popover-enhanced[hidden] {
    display: none;
}

@keyframes popoverSlideUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.popover-section-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-tertiary, #9A9A9A);
    padding: 8px 12px 4px;
}

.popover-action {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-radius: var(--radius-sm, 8px);
    background: transparent;
    cursor: pointer;
    text-align: left;
    transition: all var(--transition-fast, 0.2s ease);
}

.popover-action:hover {
    background: var(--purple-light, #EEE9F7);
}

.popover-action-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm, 8px);
    background: var(--purple-light, #EEE9F7);
    color: var(--purple-dark, #4B2A7A);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.popover-action:hover .popover-action-icon {
    background: var(--purple-dark, #4B2A7A);
    color: var(--white);
}

.popover-action-content {
    flex: 1;
}

.popover-action-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary, #1F1F1F);
    display: block;
}

.popover-action-hint {
    font-size: 12px;
    color: var(--text-tertiary, #9A9A9A);
    display: block;
    margin-top: 2px;
}

.popover-divider {
    height: 1px;
    background: var(--border-color, #E6E6E6);
    margin: 8px 12px;
}

/* =================================================
   ENHANCED RIGHT PANEL - VERTICAL TABS
   ================================================= */

.workspace-right-panel-enhanced {
    width: 360px;
    min-width: 280px;
    max-width: 480px;
    height: 100%;
    background: var(--white);
    border-left: 1px solid var(--purple-border, #E3DBF3);
    display: flex;
    flex-shrink: 0;
    position: relative;
    transition: width 0.3s ease, transform 0.3s ease;
}

.workspace-right-panel-enhanced.collapsed {
    width: 56px;
    min-width: 56px;
}

/* Vertical Tab Strip */
.panel-tab-strip {
    width: 56px;
    background: var(--purple-light, #EEE9F7);
    border-right: 1px solid var(--purple-border, #E3DBF3);
    display: flex;
    flex-direction: column;
    padding: 8px;
    gap: 4px;
    flex-shrink: 0;
}

.panel-tab-vertical {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: var(--radius-sm, 8px);
    background: transparent;
    color: var(--text-secondary, #6B6B6B);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all var(--transition-fast, 0.2s ease);
}

.panel-tab-vertical:hover {
    background: var(--white);
    color: var(--purple-dark, #4B2A7A);
}

.panel-tab-vertical.active {
    background: var(--white);
    color: var(--purple-dark, #4B2A7A);
    box-shadow: var(--shadow-sm, 0px 2px 4px rgba(0, 0, 0, 0.04));
}

.panel-tab-vertical:focus-visible {
    outline: 2px solid var(--purple-dark, #4B2A7A);
    outline-offset: 2px;
}

.panel-tab-vertical .tab-icon {
    width: 20px;
    height: 20px;
}

.panel-tab-vertical .tab-label {
    position: absolute;
    left: 52px;
    background: var(--text-primary, #1F1F1F);
    color: var(--white);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-4px);
    transition: all var(--transition-fast, 0.2s ease);
    z-index: 1000;
}

.panel-tab-vertical:hover .tab-label {
    opacity: 1;
    transform: translateX(0);
}

.panel-tab-vertical .tab-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 14px;
    height: 14px;
    padding: 0 4px;
    border-radius: 7px;
    background: var(--purple-dark, #4B2A7A);
    color: var(--white);
    font-size: 9px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.panel-tab-vertical .tab-badge:empty,
.panel-tab-vertical .tab-badge[data-count="0"] {
    display: none;
}

/* Panel Content Area */
.panel-content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

.workspace-right-panel-enhanced.collapsed .panel-content-area {
    display: none;
}

.panel-content-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color, #E6E6E6);
    flex-shrink: 0;
}

.panel-content-header .panel-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary, #1F1F1F);
    margin: 0;
}

.panel-header-action {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 6px;
    background: var(--purple-light, #EEE9F7);
    color: var(--purple-dark, #4B2A7A);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast, 0.2s ease);
}

.panel-header-action:hover {
    background: var(--purple-dark, #4B2A7A);
    color: var(--white);
}

.panel-content-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
}

/* Tab Content */
.workspace-right-panel-enhanced .panel-tab-content {
    display: none;
    flex-direction: column;
    height: 100%;
}

.workspace-right-panel-enhanced .panel-tab-content.active {
    display: flex;
    animation: panelFadeIn 0.2s ease-out;
}

@keyframes panelFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Empty State */
.panel-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px;
    height: 100%;
}

.empty-illustration {
    width: 80px;
    height: 80px;
    margin-bottom: 16px;
    color: var(--purple-dark, #4B2A7A);
    opacity: 0.3;
}

.empty-illustration svg {
    width: 100%;
    height: 100%;
}

.empty-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary, #1F1F1F);
    margin: 0 0 8px;
}

.empty-description {
    font-size: 13px;
    color: var(--text-tertiary, #9A9A9A);
    margin: 0 0 20px;
    line-height: 1.5;
}

.empty-action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--purple-light, #EEE9F7);
    border: 1px solid var(--purple-border, #E3DBF3);
    border-radius: var(--radius-sm, 8px);
    font-size: 13px;
    font-weight: 500;
    color: var(--purple-dark, #4B2A7A);
    cursor: pointer;
    transition: all var(--transition-fast, 0.2s ease);
}

.empty-action-btn:hover {
    background: var(--purple-dark, #4B2A7A);
    border-color: var(--purple-dark, #4B2A7A);
    color: var(--white);
}

/* File List Items */
.file-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--white);
    border: 1px solid var(--purple-border, #E3DBF3);
    border-radius: var(--radius-sm, 8px);
    margin-bottom: 8px;
    transition: all var(--transition-fast, 0.2s ease);
}

.file-item:hover {
    border-color: var(--purple-dark, #4B2A7A);
    box-shadow: 0 2px 8px rgba(75, 42, 122, 0.1);
}

.file-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--purple-light, #EEE9F7);
    border-radius: 6px;
    color: var(--purple-dark, #4B2A7A);
    flex-shrink: 0;
}

.file-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.file-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary, #1F1F1F);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    font-size: 11px;
    color: var(--text-tertiary, #9A9A9A);
}

.file-delete-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-tertiary, #9A9A9A);
    cursor: pointer;
    opacity: 0;
    transition: all var(--transition-fast, 0.2s ease);
}

.file-item:hover .file-delete-btn {
    opacity: 1;
}

.file-delete-btn:hover {
    background: #FEE2E2;
    color: #DC2626;
}

/* File Actions Container */
.file-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.file-attach-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-tertiary, #9A9A9A);
    cursor: pointer;
    opacity: 0;
    transition: all var(--transition-fast, 0.2s ease);
}

.file-item:hover .file-attach-btn {
    opacity: 1;
}

.file-attach-btn:hover {
    background: var(--purple-light, #EEE9F7);
    color: var(--purple-dark, #4B2A7A);
}

/* Attachment Preview Container */
.attachment-preview-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px;
    background: var(--purple-light, #EEE9F7);
    border-radius: 12px 12px 0 0;
    margin-bottom: -4px;
}

.attachment-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--white, #fff);
    border: 1px solid var(--purple-border, #E3DBF3);
    border-radius: 20px;
    font-size: 12px;
    color: var(--text-primary, #1F1F1F);
    animation: chipSlideIn 0.2s ease;
}

@keyframes chipSlideIn {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.attachment-icon {
    font-size: 14px;
}

.attachment-name {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attachment-remove {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 50%;
    color: var(--text-tertiary, #9A9A9A);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast, 0.2s ease);
}

.attachment-remove:hover {
    background: #FEE2E2;
    color: #DC2626;
}

/* Resize Handle */
.panel-resize-handle {
    position: absolute;
    left: -4px;
    top: 0;
    bottom: 0;
    width: 8px;
    cursor: col-resize;
    z-index: 10;
}

.panel-resize-handle:hover,
.panel-resize-handle:focus {
    background: var(--purple-dark, #4B2A7A);
    opacity: 0.2;
}

/* Panel Backdrop (Mobile) */
.panel-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 199;
}

.panel-backdrop.visible {
    display: block;
}

/* Context Info Section */
.context-info-section {
    padding: 0;
}

/* =================================================
   MESSAGE BUBBLES - REDESIGNED
   ================================================= */

.message-group {
    display: flex;
    gap: 12px;
    max-width: 85%;
    animation: messageSlideIn 0.3s ease-out;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-group[data-sender="user"] {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-group[data-sender="assistant"] {
    align-self: flex-start;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm, 8px);
    background: var(--purple-light, #EEE9F7);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1rem;
}

.message-group[data-sender="user"] .message-avatar {
    background: var(--purple-dark, #4B2A7A);
    color: var(--white);
}

.message-content-wrapper {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 4px;
}

.message-sender {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary, #1F1F1F);
}

.message-time {
    font-size: 11px;
    color: var(--text-tertiary, #9A9A9A);
}

/* Message Bubbles */
.message-bubble {
    padding: 14px 18px;
    border-radius: var(--radius-md, 16px);
    font-size: 15px;
    line-height: 1.6;
    position: relative;
}

.message-bubble.assistant {
    background: var(--white);
    border: 1px solid var(--border-color, #E6E6E6);
    border-bottom-left-radius: 4px;
    box-shadow: var(--shadow-sm, 0px 2px 4px rgba(0, 0, 0, 0.04));
    color: var(--text-primary, #1F1F1F);
}

.message-bubble.user {
    background: var(--purple-light, #EEE9F7);
    color: var(--text-primary, #1F1F1F);
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 8px rgba(75, 42, 122, 0.1);
}

/* Message Feedback (shown on hover) */
.message-feedback {
    display: flex;
    gap: 4px;
    padding: 4px 0;
    opacity: 0;
    transform: translateY(-4px);
    transition: all var(--transition-fast, 0.2s ease);
}

.message-group:hover .message-feedback,
.message-group:focus-within .message-feedback {
    opacity: 1;
    transform: translateY(0);
}

.feedback-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-tertiary, #9A9A9A);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast, 0.2s ease);
}

.feedback-btn:hover {
    background: var(--purple-light, #EEE9F7);
    color: var(--purple-dark, #4B2A7A);
}

.feedback-btn.active {
    background: var(--purple-dark, #4B2A7A);
    color: var(--white);
}

.feedback-btn[data-feedback="helpful"].active {
    background: var(--success-color, #10B981);
}

.feedback-btn[data-feedback="not-helpful"].active {
    background: var(--error-color, #EF4444);
}

/* Copy Tooltip */
.copy-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 8px;
    background: var(--text-primary, #1F1F1F);
    color: var(--white);
    font-size: 11px;
    border-radius: 4px;
    white-space: nowrap;
    animation: tooltipFade 1.5s ease-out forwards;
}

@keyframes tooltipFade {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(4px);
    }

    20% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }

    80% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

/* Quick Action Chips (after messages) */
.quick-action-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 0;
    margin-top: 8px;
}

.action-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--white);
    border: 1px solid var(--purple-border, #E3DBF3);
    border-radius: var(--radius-full, 9999px);
    font-size: 12px;
    font-weight: 500;
    color: var(--purple-dark, #4B2A7A);
    cursor: pointer;
    transition: all var(--transition-fast, 0.2s ease);
}

.action-chip:hover {
    background: var(--purple-light, #EEE9F7);
    border-color: var(--purple-dark, #4B2A7A);
    transform: translateY(-1px);
}

.action-chip svg {
    width: 14px;
    height: 14px;
}

/* =================================================
   RESPONSIVE DESIGN
   ================================================= */

/* Tablet (768px - 1024px) */
@media (max-width: 1024px) {
    .workspace-header-redesigned {
        padding: 0 16px;
    }

    .breadcrumb-current,
    .conversation-count {
        display: none;
    }

    .workspace-right-panel-enhanced {
        position: fixed;
        right: 0;
        top: 0;
        bottom: 0;
        z-index: 200;
        transform: translateX(100%);
        box-shadow: var(--shadow-lg, 0px 8px 24px rgba(0, 0, 0, 0.08));
    }

    .workspace-right-panel-enhanced.visible {
        transform: translateX(0);
    }

    .workspace-chat {
        max-width: 100%;
    }

    .workspace-chat-input-enhanced {
        padding: 12px 16px 20px;
    }
}

/* Mobile (< 768px) */
@media (max-width: 768px) {
    .workspace-header-redesigned {
        height: 56px;
        padding: 0 12px;
    }

    .header-breadcrumb {
        display: none;
    }

    .agent-identity-info {
        display: none;
    }

    .agent-avatar-container {
        margin-right: auto;
    }

    .message-group {
        max-width: 95%;
    }

    .message-bubble {
        padding: 12px 14px;
        font-size: 14px;
    }

    .input-container {
        padding: 6px;
    }

    .input-actions-btn,
    .voice-input-btn,
    .send-btn-enhanced {
        width: 36px;
        height: 36px;
    }

    .send-btn-enhanced {
        width: 40px;
        height: 40px;
    }

    .input-field-wrapper textarea {
        font-size: 16px;
        /* Prevent iOS zoom */
    }

    .workspace-right-panel-enhanced {
        width: 100%;
        max-width: 100%;
    }

    .panel-tab-strip {
        width: 100%;
        flex-direction: row;
        overflow-x: auto;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 201;
        border-right: none;
        border-top: 1px solid var(--purple-border, #E3DBF3);
        justify-content: space-around;
        padding: 8px 16px;
    }

    .panel-tab-vertical .tab-label {
        display: none;
    }

    .panel-content-area {
        padding-bottom: 64px;
    }

    .welcome-experience {
        padding: 32px 20px;
    }

    .welcome-avatar-large {
        width: 64px;
        height: 64px;
    }

    .welcome-title {
        font-size: 20px;
    }

    .capability-chips {
        flex-direction: column;
    }

    .capability-chip {
        width: 100%;
        justify-content: center;
    }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus States */
*:focus-visible {
    outline: 2px solid var(--purple-dark, #4B2A7A);
    outline-offset: 2px;
}

/* Loading shimmer effect */
.loading-shimmer {
    background: linear-gradient(90deg,
            var(--purple-light, #EEE9F7) 0%,
            var(--white) 50%,
            var(--purple-light, #EEE9F7) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

/* ================================================================
   USAGE TRACKER - Context Tab
   ================================================================ */

/* Usage Section */
.usage-section {
    background: var(--purple-light, #EEE9F7);
    border-radius: var(--radius-md, 16px);
    padding: 20px;
    margin-bottom: 24px;
}

.usage-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.usage-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary, #1F1F1F);
}

.usage-plan-badge {
    background: var(--purple-dark, #4B2A7A);
    color: #FFFFFF;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Progress Container */
.usage-progress-container {
    margin-bottom: 12px;
}

.usage-progress-bar {
    height: 12px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 8px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.usage-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #10B981 0%, #059669 100%);
    border-radius: 6px;
    transition: width 0.3s ease, background 0.3s ease;
}

/* Color states */
.usage-progress-fill[data-level="warning"] {
    background: linear-gradient(90deg, #F59E0B 0%, #D97706 100%);
}

.usage-progress-fill[data-level="danger"] {
    background: linear-gradient(90deg, #EF4444 0%, #DC2626 100%);
}

.usage-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
}

.usage-amount {
    color: var(--text-primary, #1F1F1F);
    font-weight: 600;
}

.usage-percentage {
    color: var(--text-secondary, #6B6B6B);
    font-weight: 500;
}

.usage-reset-info {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary, #6B6B6B);
    font-size: 0.8rem;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.usage-reset-info svg {
    flex-shrink: 0;
}

/* Conversation Stats Section */
.conversation-stats-section {
    margin-bottom: 24px;
}

.section-subtitle {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary, #6B6B6B);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color, #E6E6E6);
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary, #6B6B6B);
}

.stat-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary, #1F1F1F);
}

/* Upgrade Prompt */
.upgrade-prompt {
    background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%);
    border: 1px solid #F59E0B;
    border-radius: var(--radius-md, 16px);
    padding: 20px;
    margin-bottom: 24px;
    text-align: center;
}

.upgrade-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.upgrade-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary, #1F1F1F);
    margin-bottom: 8px;
}

.upgrade-description {
    font-size: 0.875rem;
    color: var(--text-secondary, #6B6B6B);
    margin-bottom: 16px;
}

.upgrade-plans {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.plan-option {
    flex: 1;
    background: rgba(255, 255, 255, 0.8);
    border-radius: var(--radius-sm, 8px);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.plan-option strong {
    color: var(--purple-dark, #4B2A7A);
    font-weight: 700;
    font-size: 0.95rem;
}

.plan-option span {
    color: var(--text-secondary, #6B6B6B);
    font-size: 0.75rem;
}

.upgrade-btn {
    background: var(--purple-dark, #4B2A7A);
    color: #FFFFFF;
    border: none;
    border-radius: var(--radius-sm, 8px);
    padding: 12px 24px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.upgrade-btn:hover {
    background: #3D2263;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(75, 42, 122, 0.3);
}

/* Agent Details Section */
.agent-details-section {
    margin-top: 24px;
    padding: 16px;
    background: var(--bg-secondary, #EEE9F7);
    border-radius: var(--radius-sm, 8px);
}

.agent-details-section summary {
    cursor: pointer;
    user-select: none;
    font-weight: 600;
    color: var(--text-secondary, #6B6B6B);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.agent-details-section summary:hover {
    color: var(--purple-dark, #4B2A7A);
}

.agent-details-content {
    margin-top: 12px;
    font-size: 0.8rem;
    color: var(--text-secondary, #6B6B6B);
    font-family: monospace;
    line-height: 1.6;
}

.agent-details-content div {
    margin-bottom: 6px;
}

.agent-details-content strong {
    color: var(--text-primary, #1F1F1F);
    font-weight: 600;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .usage-section {
        padding: 16px;
    }

    .upgrade-plans {
        flex-direction: column;
    }

    .plan-option {
        text-align: center;
    }
}

/* ============================================
   USAGE LIMIT MODAL - REDESIGNED
   ============================================ */

.usage-limit-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.usage-limit-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    cursor: pointer;
}

.usage-limit-modal-content {
    position: relative;
    background: white;
    border-radius: 24px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

.modal-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border: none;
    background: #f5f5f5;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transition: all 0.2s;
    z-index: 1;
}

.modal-close-btn:hover {
    background: #e0e0e0;
    color: #333;
    transform: scale(1.1);
}

.usage-limit-header {
    text-align: center;
    margin-bottom: 32px;
}

.usage-limit-icon-circle {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, #FF6B6B 0%, #EE5A6F 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.usage-limit-header h2 {
    font-size: 28px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 12px 0;
}

.usage-limit-subtitle {
    font-size: 16px;
    color: #666;
    margin: 0;
}

.usage-limit-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 32px;
    padding: 24px;
    background: #f8f9fa;
    border-radius: 16px;
}

.usage-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.stat-label {
    font-size: 13px;
    color: #666;
    font-weight: 500;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a;
}

.upgrade-options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.upgrade-card-modern {
    position: relative;
    border: 2px solid #e0e0e0;
    border-radius: 16px;
    padding: 24px;
    background: white;
    transition: all 0.3s;
}

.upgrade-card-modern:hover {
    border-color: #4B2A7A;
    box-shadow: 0 8px 24px rgba(75, 42, 122, 0.15);
    transform: translateY(-4px);
}

.plan-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #4B2A7A 0%, #6B46A8 100%);
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.plan-badge.premium {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #1a1a1a;
}

.plan-header {
    margin-bottom: 20px;
    padding-top: 8px;
}

.plan-header h3 {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 12px 0;
}

.plan-price {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.price-amount {
    font-size: 32px;
    font-weight: 800;
    color: #4B2A7A;
}

.price-period {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.plan-features {
    list-style: none;
    padding: 0;
    margin: 0 0 20px 0;
}

.plan-features li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    font-size: 14px;
    color: #333;
}

.plan-features li svg {
    color: #10B981;
    flex-shrink: 0;
}

.upgrade-btn {
    width: 100%;
    padding: 14px 24px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.pro-btn {
    background: linear-gradient(135deg, #4B2A7A 0%, #6B46A8 100%);
    color: white;
}

.pro-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(75, 42, 122, 0.4);
}

.max-btn {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #1a1a1a;
}

.max-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 165, 0, 0.4);
}

.usage-limit-footer {
    text-align: center;
    padding-top: 16px;
    border-top: 1px solid #e0e0e0;
}

.btn-text {
    background: none;
    border: none;
    color: #666;
    font-size: 14px;
    cursor: pointer;
    padding: 12px 24px;
    border-radius: 8px;
    transition: all 0.2s;
}

.btn-text:hover {
    background: #f5f5f5;
    color: #333;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile responsive */
@media (max-width: 640px) {
    .usage-limit-modal-content {
        padding: 32px 24px;
        max-width: 95%;
    }

    .upgrade-options-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .usage-limit-header h2 {
        font-size: 24px;
    }

    .price-amount {
        font-size: 28px;
    }
}

/* ========================================
   LOAD PREVIOUS CONVERSATIONS BUTTON
   ======================================== */

.welcome-history-section {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid #E8E8EA;
    text-align: center;
}

.load-history-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #4B2A7A 0%, #6B46A8 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(75, 42, 122, 0.2);
}

.load-history-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(75, 42, 122, 0.3);
}

.load-history-btn:active {
    transform: translateY(0);
}

.load-history-btn svg {
    flex-shrink: 0;
}

/* Hide the button when chat has messages */
.has-messages .welcome-history-section {
    display: none;
}


/* ========================================
   LOAD PREVIOUS CONVERSATIONS BUTTON - INLINE VERSION
   ======================================== */

.load-history-btn-inline {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    margin-top: 24px;
    background: linear-gradient(135deg, #4B2A7A 0%, #6B46A8 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(75, 42, 122, 0.2);
}

.load-history-btn-inline:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(75, 42, 122, 0.3);
}

.load-history-btn-inline:active {
    transform: translateY(0);
}

.load-history-btn-inline svg {
    flex-shrink: 0;
}

/* Hide the button when chat has messages */
.has-messages .load-history-btn-inline {
    display: none;
}

/* ========================================
   AGENT PREVIEW MODAL (Read-Only)
   ======================================== */

#agentPreviewModal {
    z-index: 9999;
}

.agent-preview-modal-content {
    max-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    z-index: 10000;
}

.agent-preview-body {
    padding: 24px;
}

/* Agent Header */
.preview-agent-header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--purple-border, #E3DBF3);
    margin-bottom: 24px;
}

.preview-agent-icon {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--purple-light, #EEE9F7);
    border-radius: 16px;
    font-size: 28px;
    flex-shrink: 0;
}

.preview-agent-icon svg {
    width: 32px;
    height: 32px;
    stroke: var(--purple-dark, #4B2A7A);
}

.preview-agent-info {
    flex: 1;
}

.preview-agent-info h4 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary, #1F1F1F);
    margin: 0 0 6px 0;
}

.preview-agent-info p {
    font-size: 0.9rem;
    color: var(--text-secondary, #6B6B6B);
    margin: 0 0 10px 0;
    line-height: 1.5;
}

.preview-agent-category {
    display: inline-block;
    background: var(--purple-light, #EEE9F7);
    color: var(--purple-dark, #4B2A7A);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
}

/* Sections */
.preview-section {
    margin-bottom: 24px;
}

.preview-section:last-child {
    margin-bottom: 0;
}

.preview-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.preview-section-header svg {
    color: var(--purple-dark, #4B2A7A);
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.preview-section-header h5 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary, #6B6B6B);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Tools Grid */
.preview-tools-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.preview-tool-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: var(--purple-light, #EEE9F7);
    border-radius: 10px;
    transition: all 0.2s ease;
}

.preview-tool-item:hover {
    background: #E0D6EE;
    transform: translateY(-1px);
}

.preview-tool-icon {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.preview-tool-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary, #1F1F1F);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Actions List */
.preview-actions-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.preview-actions-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #F0FDF4;
    border-radius: 8px;
    font-size: 0.875rem;
    color: var(--text-primary, #1F1F1F);
}

.action-check {
    color: #10B981;
    font-weight: 700;
    font-size: 1rem;
}

/* Sample Prompts */
.preview-prompts-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.preview-prompt-chip {
    padding: 12px 16px;
    background: var(--purple-light, #EEE9F7);
    border-radius: 10px;
    font-size: 0.875rem;
    color: var(--text-primary, #1F1F1F);
    font-style: italic;
    border-left: 3px solid var(--purple-dark, #4B2A7A);
    line-height: 1.5;
}

/* Personality */
.preview-personality {
    padding-top: 16px;
    border-top: 1px solid var(--purple-border, #E3DBF3);
}

.preview-personality-badges {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.personality-badge {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.personality-badge.tone {
    background: linear-gradient(135deg, #E0E7FF 0%, #C7D2FE 100%);
    color: #4338CA;
}

.personality-badge.expertise {
    background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%);
    color: #B45309;
}

/* Responsive */
@media (max-width: 640px) {
    .agent-preview-modal-content {
        max-width: 95%;
        padding: 16px;
    }

    .preview-tools-grid {
        grid-template-columns: 1fr;
    }

    .preview-agent-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .preview-agent-info {
        text-align: center;
    }
}