/**
 * Ambient AI Insights Styles
 * v=20241218-ambient-ai
 *
 * Components:
 * - AmbientInsightBar: Fixed bottom bar for contextual insights
 * - ChatTakeover: Slide-in conversation panel
 * - InsightsPage: Saved/archived insights view
 */

/* ============================================
   AMBIENT INSIGHT BAR
   ============================================ */

.ambient-bar {
    position: fixed;
    bottom: 0;
    left: 256px; /* Sidebar width */
    right: 0;
    z-index: 100;
    padding: 12px 24px;
    background: linear-gradient(180deg, rgba(255,255,255,0.95) 0%, rgba(255,255,255,1) 100%);
    border-top: 1px solid #E5E7EB;
    backdrop-filter: blur(8px);
    transform: translateY(0);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.ambient-bar.hidden {
    transform: translateY(100%);
    opacity: 0;
    pointer-events: none;
}

.ambient-bar.sidebar-collapsed {
    left: 64px;
}

@media (max-width: 1024px) {
    .ambient-bar {
        left: 0;
    }
}

.ambient-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 14px;
    padding: 12px 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.ambient-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #F6339A 0%, #FF6B6B 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.ambient-avatar.win {
    background: linear-gradient(135deg, #10B981 0%, #34D399 100%);
}

.ambient-avatar.opportunity {
    background: linear-gradient(135deg, #3B82F6 0%, #60A5FA 100%);
}

.ambient-avatar.needs-attention {
    background: linear-gradient(135deg, #F59E0B 0%, #FBBF24 100%);
}

.ambient-avatar.info {
    background: linear-gradient(135deg, #8B5CF6 0%, #A78BFA 100%);
}

.ambient-content {
    flex: 1;
    min-width: 0;
}

.ambient-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.ambient-meta img {
    width: 16px;
    height: 16px;
    border-radius: 50%;
}

.ambient-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.33;
}

.ambient-badge.win {
    background: #DCFCE7;
    color: #166534;
}

.ambient-badge.opportunity {
    background: #DBEAFE;
    color: #1E40AF;
}

.ambient-badge.needs-attention {
    background: #FEF3C7;
    color: #92400E;
}

.ambient-badge.info {
    background: #ECEEF2;
    color: #030213;
}

.ambient-source {
    font-size: 12px;
    color: #6A7282;
}

.ambient-title {
    font-size: 14px;
    font-weight: 600;
    color: #101828;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ambient-description {
    font-size: 13px;
    color: #4A5565;
    margin: 2px 0 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 400px;
}

.ambient-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.ambient-bookmark {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6A7282;
    transition: background 0.15s ease, color 0.15s ease;
}

.ambient-bookmark:hover {
    background: #F3F4F6;
    color: #155DFC;
}

.ambient-bookmark.saved {
    color: #155DFC;
}

.ambient-bookmark.saved svg {
    fill: #155DFC;
}

.ambient-discuss {
    padding: 8px 16px;
    border: none;
    background: linear-gradient(90deg, #9810FA 0%, #155DFC 100%);
    color: white;
    font-size: 13px;
    font-weight: 500;
    border-radius: 10px;
    cursor: pointer;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.ambient-discuss:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.ambient-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #6A7282;
    font-size: 12px;
    margin-left: 8px;
}

.ambient-nav-btn {
    width: 28px;
    height: 28px;
    border: 1px solid #E5E7EB;
    background: #FFFFFF;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6A7282;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.ambient-nav-btn:hover {
    background: #F9FAFB;
    border-color: #D1D5DB;
}

.ambient-nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.ambient-dismiss {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9CA3AF;
    font-size: 16px;
    margin-left: 4px;
    transition: background 0.15s ease, color 0.15s ease;
}

.ambient-dismiss:hover {
    background: #FEE2E2;
    color: #DC2626;
}

/* ============================================
   CHAT TAKEOVER OVERLAY
   ============================================ */

.ambient-chat-overlay {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 200;
    display: flex;
    justify-content: flex-end;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.ambient-chat-overlay.open {
    opacity: 1;
    visibility: visible;
}

.ambient-chat-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(2px);
}

.ambient-chat-panel {
    position: relative;
    width: 500px;
    max-width: 100%;
    height: 100%;
    background: #FFFFFF;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.ambient-chat-overlay.open .ambient-chat-panel {
    transform: translateX(0);
}

@media (min-width: 1200px) {
    .ambient-chat-panel {
        width: 600px;
    }
}

.ambient-chat-header {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #E5E7EB;
    gap: 12px;
}

.ambient-chat-header h3 {
    flex: 1;
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #101828;
}

.ambient-chat-time {
    font-size: 12px;
    color: #6A7282;
}

.ambient-save-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid #E5E7EB;
    background: #FFFFFF;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #364153;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.ambient-save-btn:hover {
    background: #F9FAFB;
    border-color: #D1D5DB;
}

.ambient-save-btn.saved {
    background: #EFF6FF;
    border-color: #BFDBFE;
    color: #1447E6;
}

.ambient-close-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6A7282;
    font-size: 18px;
    transition: background 0.15s ease;
}

.ambient-close-btn:hover {
    background: #F3F4F6;
}

/* Chat Messages */
.ambient-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ambient-message {
    display: flex;
    gap: 12px;
    animation: messageSlideIn 0.3s ease;
}

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

.ambient-message.user {
    flex-direction: row-reverse;
}

.ambient-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8B5CF6 0%, #A78BFA 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.ambient-message.user .ambient-message-avatar {
    background: #E5E7EB;
    color: #4A5565;
}

.ambient-message-content {
    max-width: 80%;
    background: #F3F4F6;
    border-radius: 12px;
    padding: 12px 16px;
}

.ambient-message.user .ambient-message-content {
    background: linear-gradient(90deg, #9810FA 0%, #155DFC 100%);
    color: white;
}

.ambient-message-text {
    font-size: 14px;
    line-height: 1.5;
    color: #101828;
    margin: 0;
}

.ambient-message.user .ambient-message-text {
    color: white;
}

/* Typing Indicator */
.ambient-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 0;
}

.ambient-typing-dot {
    width: 8px;
    height: 8px;
    background: #9CA3AF;
    border-radius: 50%;
    animation: typingBounce 1.4s ease-in-out infinite;
}

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

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

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-4px);
    }
}

/* Suggested Chips */
.ambient-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid #E5E7EB;
    background: #F9FAFB;
}

.ambient-chips-label {
    width: 100%;
    font-size: 12px;
    color: #6A7282;
    margin-bottom: 4px;
}

.ambient-chip {
    padding: 8px 14px;
    border: 1px solid #E5E7EB;
    background: #FFFFFF;
    border-radius: 20px;
    font-size: 13px;
    color: #364153;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.ambient-chip:hover {
    background: #F3F4F6;
    border-color: #D1D5DB;
    transform: translateY(-1px);
}

.ambient-chip:active {
    transform: translateY(0);
}

/* Chat Input */
.ambient-chat-input {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid #E5E7EB;
    background: #FFFFFF;
}

.ambient-chat-input textarea {
    flex: 1;
    min-height: 44px;
    max-height: 120px;
    padding: 10px 14px;
    border: 1px solid #E5E7EB;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    outline: none;
    transition: border-color 0.15s ease;
}

.ambient-chat-input textarea:focus {
    border-color: #9810FA;
}

.ambient-chat-input textarea::placeholder {
    color: #9CA3AF;
}

.ambient-send-btn {
    width: 44px;
    height: 44px;
    border: none;
    background: linear-gradient(90deg, #9810FA 0%, #155DFC 100%);
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    transition: opacity 0.15s ease, transform 0.15s ease;
    flex-shrink: 0;
}

.ambient-send-btn:hover {
    opacity: 0.9;
    transform: scale(1.02);
}

.ambient-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.ambient-input-hint {
    font-size: 11px;
    color: #9CA3AF;
    margin-top: 4px;
}

/* ============================================
   INSIGHTS PAGE
   ============================================ */

.insights-page {
    padding: 32px;
}

.insights-header {
    margin-bottom: 32px;
}

.insights-title {
    font-size: 30px;
    font-weight: 700;
    color: #101828;
    margin: 0 0 8px;
}

.insights-subtitle {
    font-size: 16px;
    color: #4A5565;
    margin: 0;
}

/* Tab Switcher */
.insights-tabs {
    display: inline-flex;
    background: #ECECF0;
    border-radius: 14px;
    padding: 4px;
    margin-bottom: 32px;
}

.insights-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: none;
    background: transparent;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    color: #0A0A0A;
    cursor: pointer;
    transition: background 0.15s ease, box-shadow 0.15s ease;
}

.insights-tab:hover {
    background: rgba(255, 255, 255, 0.5);
}

.insights-tab.active {
    background: #FFFFFF;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.insights-tab-icon {
    width: 16px;
    height: 16px;
}

.insights-tab-badge {
    padding: 2px 6px;
    background: #DBEAFE;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    color: #1447E6;
}

/* Insight Cards Grid */
.insights-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.insight-card {
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 14px;
    padding: 20px;
    transition: box-shadow 0.15s ease;
}

.insight-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.insight-card-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.insight-card-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #F6339A 0%, #FF6B6B 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.insight-card-meta {
    flex: 1;
}

.insight-card-meta-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.insight-card-staff {
    width: 16px;
    height: 16px;
}

.insight-card-timestamp {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #6A7282;
}

.insight-card-actions-menu {
    position: relative;
}

.insight-card-menu-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9CA3AF;
    transition: background 0.15s ease;
}

.insight-card-menu-btn:hover {
    background: #F3F4F6;
}

.insight-card-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    min-width: 140px;
    z-index: 10;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity 0.15s ease, visibility 0.15s ease, transform 0.15s ease;
}

.insight-card-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(4px);
}

.insight-card-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 14px;
    border: none;
    background: transparent;
    font-size: 13px;
    color: #364153;
    cursor: pointer;
    transition: background 0.15s ease;
}

.insight-card-dropdown-item:hover {
    background: #F3F4F6;
}

.insight-card-dropdown-item.danger {
    color: #DC2626;
}

.insight-card-body {
    margin-bottom: 16px;
}

.insight-card-title {
    font-size: 18px;
    font-weight: 600;
    color: #101828;
    margin: 0 0 6px;
}

.insight-card-description {
    font-size: 14px;
    color: #4A5565;
    line-height: 1.5;
    margin: 0;
}

.insight-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.insight-card-action-btn {
    padding: 8px 16px;
    border: none;
    background: linear-gradient(90deg, #9810FA 0%, #155DFC 100%);
    color: white;
    font-size: 12px;
    font-weight: 500;
    border-radius: 10px;
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.insight-card-action-btn:hover {
    opacity: 0.9;
}

.insight-card-context {
    display: flex;
    align-items: center;
    gap: 12px;
}

.insight-card-tag {
    padding: 2px 8px;
    background: #F3F4F6;
    border-radius: 4px;
    font-size: 12px;
    color: #4A5565;
}

.insight-card-continue {
    display: flex;
    align-items: center;
    gap: 4px;
    background: transparent;
    border: none;
    font-size: 12px;
    font-weight: 500;
    color: #155DFC;
    cursor: pointer;
}

.insight-card-continue:hover {
    text-decoration: underline;
}

/* Empty State */
.insights-empty {
    text-align: center;
    padding: 60px 20px;
    color: #6A7282;
}

.insights-empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.insights-empty h3 {
    font-size: 18px;
    font-weight: 600;
    color: #101828;
    margin: 0 0 8px;
}

.insights-empty p {
    font-size: 14px;
    margin: 0;
}

/* ============================================
   UTILITIES & ANIMATIONS
   ============================================ */

/* Smooth content padding when bar is visible */
.ai-dashboard-home.has-ambient-bar,
.ai-main-content.has-ambient-bar {
    padding-bottom: 90px;
}

/* Toast notification */
.ambient-toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #101828;
    color: white;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 14px;
    z-index: 300;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.ambient-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Debug indicator per CLAUDE.md */
.ambient-bar::after {
    content: 'v20241227-routines';
    position: absolute;
    top: 4px;
    right: 8px;
    font-size: 9px;
    color: #D1D5DB;
    pointer-events: none;
}

/* ============================================
   AI ROUTINES SECTION
   ============================================ */

.routines-section {
    display: none;
}

.routines-section.active {
    display: block;
}

.routines-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.routines-empty {
    text-align: center;
    padding: 60px 20px;
    background: #FAFAFA;
    border-radius: 16px;
    border: 2px dashed #E5E7EB;
}

.routines-empty-icon {
    font-size: 56px;
    margin-bottom: 16px;
    opacity: 0.6;
}

.routines-empty h3 {
    font-size: 20px;
    font-weight: 600;
    color: #101828;
    margin: 0 0 8px;
}

.routines-empty p {
    font-size: 14px;
    color: #6A7282;
    margin: 0 0 24px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.routines-empty-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    background: linear-gradient(90deg, #9810FA 0%, #155DFC 100%);
    color: white;
    font-size: 14px;
    font-weight: 500;
    border-radius: 12px;
    cursor: pointer;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.routines-empty-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* Routine Card */
.routine-card {
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 14px;
    padding: 20px;
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.routine-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.routine-card.paused {
    opacity: 0.7;
    border-color: #D1D5DB;
}

.routine-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.routine-card-name {
    font-size: 16px;
    font-weight: 600;
    color: #101828;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.routine-card-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.routine-active {
    background: #DCFCE7;
    color: #166534;
}

.routine-active::before {
    content: '';
    width: 6px;
    height: 6px;
    background: #22C55E;
    border-radius: 50%;
    animation: pulseGreen 2s ease-in-out infinite;
}

@keyframes pulseGreen {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.routine-paused {
    background: #FEF3C7;
    color: #92400E;
}

.routine-card-body {
    margin-bottom: 16px;
}

.routine-card-detail {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 14px;
    color: #4A5565;
}

.routine-card-label {
    color: #6A7282;
    min-width: 60px;
}

.routine-card-stats {
    display: flex;
    gap: 24px;
    padding-top: 12px;
    border-top: 1px solid #F3F4F6;
    font-size: 13px;
    color: #6A7282;
}

.routine-card-stat {
    display: flex;
    align-items: center;
    gap: 6px;
}

.routine-card-stat strong {
    color: #101828;
    font-weight: 600;
}

.routine-card-actions {
    display: flex;
    gap: 8px;
}

.routine-action-btn {
    padding: 8px 14px;
    border: 1px solid #E5E7EB;
    background: #FFFFFF;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #364153;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.routine-action-btn:hover {
    background: #F9FAFB;
    border-color: #D1D5DB;
}

.routine-action-btn.primary {
    background: linear-gradient(90deg, #9810FA 0%, #155DFC 100%);
    border: none;
    color: white;
}

.routine-action-btn.primary:hover {
    opacity: 0.9;
}

.routine-action-btn.danger {
    color: #DC2626;
    border-color: #FECACA;
}

.routine-action-btn.danger:hover {
    background: #FEE2E2;
    border-color: #FECACA;
}

/* ============================================
   ASSISTANT CHAT (Floating Panel)
   ============================================ */

.assistant-chat-container {
    position: fixed;
    bottom: 100px;
    right: 32px;
    width: 400px;
    max-height: 600px;
    background: #FFFFFF;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.08);
    display: none;
    flex-direction: column;
    z-index: 150;
    overflow: hidden;
    animation: slideUpFade 0.3s ease;
}

.assistant-chat-container.open {
    display: flex;
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.assistant-chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: linear-gradient(90deg, #9810FA 0%, #155DFC 100%);
    color: white;
}

.assistant-chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.assistant-chat-info {
    flex: 1;
}

.assistant-chat-name {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
}

.assistant-chat-role {
    font-size: 12px;
    opacity: 0.85;
    margin: 0;
}

.assistant-chat-close {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    transition: background 0.15s ease;
}

.assistant-chat-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

.assistant-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: 400px;
    min-height: 200px;
    background: #FAFAFA;
}

.assistant-message {
    display: flex;
    gap: 10px;
    animation: messageSlideIn 0.3s ease;
}

.assistant-message.user {
    flex-direction: row-reverse;
}

.assistant-message-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #9810FA 0%, #155DFC 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
    color: white;
}

.assistant-message.user .assistant-message-avatar {
    background: #E5E7EB;
    color: #4A5565;
}

.assistant-message-content {
    max-width: 75%;
    background: #FFFFFF;
    border-radius: 14px;
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.5;
    color: #101828;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.assistant-message.user .assistant-message-content {
    background: linear-gradient(90deg, #9810FA 0%, #155DFC 100%);
    color: white;
}

.assistant-message-content p {
    margin: 0 0 8px;
}

.assistant-message-content p:last-child {
    margin-bottom: 0;
}

.assistant-message-content ul,
.assistant-message-content ol {
    margin: 8px 0;
    padding-left: 20px;
}

.assistant-message-content li {
    margin: 4px 0;
}

.assistant-message-content code {
    background: rgba(0, 0, 0, 0.06);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
}

.assistant-message.user .assistant-message-content code {
    background: rgba(255, 255, 255, 0.2);
}

.assistant-message-content strong {
    font-weight: 600;
}

/* Tool result styling */
.tool-result {
    margin-top: 12px;
    padding: 12px;
    background: #F0FDF4;
    border: 1px solid #BBF7D0;
    border-radius: 8px;
    font-size: 13px;
}

.tool-result-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    color: #166534;
    margin-bottom: 6px;
}

.tool-result-content {
    color: #14532D;
}

/* Assistant Chat Input */
.assistant-chat-input-container {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 16px;
    border-top: 1px solid #E5E7EB;
    background: #FFFFFF;
}

.assistant-chat-input {
    flex: 1;
    min-height: 42px;
    max-height: 100px;
    padding: 10px 14px;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    outline: none;
    transition: border-color 0.15s ease;
}

.assistant-chat-input:focus {
    border-color: #9810FA;
}

.assistant-chat-input::placeholder {
    color: #9CA3AF;
}

.assistant-chat-send {
    width: 42px;
    height: 42px;
    border: none;
    background: linear-gradient(90deg, #9810FA 0%, #155DFC 100%);
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    transition: opacity 0.15s ease, transform 0.15s ease;
    flex-shrink: 0;
}

.assistant-chat-send:hover {
    opacity: 0.9;
    transform: scale(1.02);
}

.assistant-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Floating Action Button */
.assistant-chat-fab {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 60px;
    height: 60px;
    border: none;
    background: linear-gradient(135deg, #9810FA 0%, #155DFC 100%);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: white;
    box-shadow: 0 4px 16px rgba(152, 16, 250, 0.4);
    z-index: 140;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.assistant-chat-fab:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(152, 16, 250, 0.5);
}

.assistant-chat-fab:active {
    transform: scale(0.98);
}

.assistant-chat-fab.hidden {
    display: none;
}

.assistant-fab-label {
    position: absolute;
    right: 72px;
    background: #101828;
    color: white;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    transform: translateX(10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

.assistant-chat-fab:hover .assistant-fab-label {
    opacity: 1;
    transform: translateX(0);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 10px;
    animation: messageSlideIn 0.3s ease;
}

.typing-indicator .assistant-message-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #9810FA 0%, #155DFC 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
    color: white;
}

.typing-dots {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 14px 18px;
    background: #FFFFFF;
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: #9CA3AF;
    border-radius: 50%;
    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;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (max-width: 768px) {
    .assistant-chat-container {
        right: 16px;
        left: 16px;
        width: auto;
        bottom: 90px;
        max-height: 70vh;
    }

    .assistant-chat-fab {
        right: 16px;
        bottom: 16px;
        width: 56px;
        height: 56px;
        font-size: 24px;
    }

    .assistant-fab-label {
        display: none;
    }

    .routine-card-actions {
        flex-wrap: wrap;
    }

    .routine-card-stats {
        flex-wrap: wrap;
        gap: 16px;
    }
}
