/* ==============================================================
   SACourtWorkspaces - AI Helper & Interactive Guide Stylesheet
   ============================================================== */

/* Modal Backdrop & Container */
#ai-helper-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background-color: rgba(2, 6, 23, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out;
}

#ai-helper-modal.hidden {
    display: none !important;
}

/* Modal Card */
.ai-helper-card {
    background-color: #0f172a;
    border: 1px solid #334155;
    border-radius: 1.25rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    width: 100%;
    max-width: 64rem; /* 1024px */
    height: 88vh;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: #f1f5f9;
    font-family: 'Inter', sans-serif;
    animation: aiHelperFadeIn 0.2s ease-out;
}

@keyframes aiHelperFadeIn {
    from {
        opacity: 0;
        transform: scale(0.97);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Header */
.ai-helper-header {
    background-color: #1e293b;
    border-bottom: 1px solid #334155;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.ai-helper-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.ai-helper-icon-wrap {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.75rem;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 1.25rem;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
    flex-shrink: 0;
}

.ai-helper-title-wrap h3 {
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 0.025em;
    text-transform: uppercase;
    color: #ffffff;
    margin: 0;
}

.ai-helper-title-wrap p {
    font-size: 0.75rem;
    color: #94a3b8;
    margin: 0.15rem 0 0 0;
    font-weight: 500;
}

.ai-helper-header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.ai-helper-badge-online {
    background-color: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.25rem 0.6rem;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
}

.ai-helper-badge-online::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #34d399;
    box-shadow: 0 0 6px #34d399;
}

.ai-helper-close-btn {
    background: #334155;
    border: 1px solid #475569;
    color: #94a3b8;
    border-radius: 0.5rem;
    padding: 0.35rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.ai-helper-close-btn:hover {
    background-color: #e11d48;
    color: #ffffff;
    border-color: #e11d48;
}

/* Tabs Bar */
.ai-helper-tabs {
    background-color: #0f172a;
    border-bottom: 1px solid #1e293b;
    padding: 0.5rem 1.5rem 0 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.ai-helper-tab-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.6rem 1rem;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.ai-helper-tab-btn:hover {
    color: #cbd5e1;
    background-color: rgba(51, 65, 85, 0.4);
    border-radius: 0.5rem 0.5rem 0 0;
}

.ai-helper-tab-btn.active {
    color: #818cf8;
    border-bottom: 2px solid #6366f1;
    background-color: rgba(99, 102, 241, 0.1);
    border-radius: 0.5rem 0.5rem 0 0;
}

/* Content Container */
.ai-helper-content {
    flex: 1 1 0%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background-color: #0b0f19;
}

/* Custom Scrollbar */
.ai-helper-scroll {
    scrollbar-width: thin;
    scrollbar-color: #475569 rgba(15, 23, 42, 0.6);
    overflow-y: auto;
}

.ai-helper-scroll::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.ai-helper-scroll::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.6);
    border-radius: 4px;
}

.ai-helper-scroll::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 4px;
    border: 2px solid rgba(15, 23, 42, 0.6);
}

.ai-helper-scroll::-webkit-scrollbar-thumb:hover {
    background: #6366f1;
}

/* -------------------------------------------------------------
   TAB 1: ASK AI HELPER (CHAT)
   ------------------------------------------------------------- */
.ai-chat-view {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    flex: 1 1 0%;
}

.ai-chat-messages {
    flex: 1 1 0%;
    min-height: 0;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Quick Prompt Chips */
.ai-quick-prompts-wrap {
    background-color: rgba(30, 41, 59, 0.5);
    border: 1px solid #1e293b;
    border-radius: 1rem;
    padding: 1.25rem;
    margin-bottom: 0.5rem;
    flex-shrink: 0;
}

.ai-quick-prompts-title {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.075em;
    color: #818cf8;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.ai-quick-chips-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.ai-chip-btn {
    background-color: #1e293b;
    border: 1px solid #334155;
    color: #cbd5e1;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.4rem 0.8rem;
    border-radius: 9999px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.ai-chip-btn:hover {
    background-color: #4f46e5;
    border-color: #6366f1;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(79, 70, 229, 0.3);
}

/* Chat Message Bubbles */
.ai-msg-row {
    display: flex;
    gap: 0.75rem;
    max-width: 88%;
    flex-shrink: 0;
}

.ai-msg-row.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.ai-msg-row.bot {
    align-self: flex-start;
}

.ai-msg-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.ai-msg-row.user .ai-msg-avatar {
    background-color: #4338ca;
    color: #ffffff;
}

.ai-msg-row.bot .ai-msg-avatar {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: #ffffff;
}

.ai-msg-bubble {
    padding: 1rem 1.25rem;
    border-radius: 1rem;
    font-size: 0.825rem;
    line-height: 1.65;
    position: relative;
    word-break: break-word;
}

.ai-msg-row.user .ai-msg-bubble {
    background-color: #4f46e5;
    color: #ffffff;
    border-top-right-radius: 0.2rem;
    font-weight: 500;
}

.ai-msg-row.bot .ai-msg-bubble {
    background-color: #1e293b;
    border: 1px solid #334155;
    color: #e2e8f0;
    border-top-left-radius: 0.2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
}

.ai-msg-bubble p {
    margin: 0 0 0.6rem 0;
}

.ai-msg-bubble p:last-child {
    margin-bottom: 0;
}

.ai-msg-bubble ul, .ai-msg-bubble ol {
    margin: 0.4rem 0 0.6rem 1.2rem;
    padding: 0;
}

.ai-msg-bubble li {
    margin-bottom: 0.35rem;
}

.ai-msg-bubble strong {
    color: #ffffff;
    font-weight: 700;
}

.ai-msg-bubble code {
    background-color: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.2);
    padding: 0.15rem 0.35rem;
    border-radius: 0.3rem;
    font-family: monospace;
    font-size: 0.75rem;
    color: #a5b4fc;
}

.ai-msg-bubble-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(51, 65, 85, 0.5);
}

.ai-copy-btn {
    background: transparent;
    border: 1px solid #475569;
    color: #94a3b8;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.25rem 0.5rem;
    border-radius: 0.35rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    transition: all 0.15s ease;
}

.ai-copy-btn:hover {
    background-color: #334155;
    color: #ffffff;
}

/* Typing Indicator Animation */
.ai-typing-indicator {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 0.75rem;
}

.ai-typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #818cf8;
    animation: aiTypingBounce 1.4s infinite ease-in-out both;
}

.ai-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.ai-typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes aiTypingBounce {
    0%, 80%, 100% { transform: scale(0); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* Chat Input Bar */
.ai-chat-input-bar {
    background-color: #1e293b;
    border-top: 1px solid #334155;
    padding: 0.85rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.ai-chat-input {
    flex: 1;
    background-color: #0f172a;
    border: 1px solid #334155;
    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.65rem 1rem;
    border-radius: 0.75rem;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ai-chat-input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.ai-chat-send-btn {
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    border: none;
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.65rem 1.25rem;
    border-radius: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.15s ease;
    box-shadow: 0 4px 8px rgba(79, 70, 229, 0.3);
    flex-shrink: 0;
}

.ai-chat-send-btn:hover {
    background: linear-gradient(135deg, #4338ca 0%, #4f46e5 100%);
    transform: translateY(-1px);
}

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

.ai-chat-clear-btn {
    background: transparent;
    border: 1px solid #475569;
    color: #94a3b8;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.65rem 0.85rem;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.ai-chat-clear-btn:hover {
    background-color: #334155;
    color: #fca5a5;
    border-color: #e11d48;
}

/* -------------------------------------------------------------
   TAB 2: INTERACTIVE FEATURE & TOOL EXPLORER
   ------------------------------------------------------------- */
.ai-explorer-view {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    flex: 1 1 0%;
    padding: 1.25rem 1.5rem;
    gap: 1rem;
    overflow: hidden;
}

.ai-explorer-search-bar {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    flex-shrink: 0;
}

.ai-explorer-search-icon {
    position: absolute;
    left: 1rem;
    width: 1rem;
    height: 1rem;
    color: #64748b;
    pointer-events: none;
}

.ai-explorer-search-input {
    width: 100%;
    background-color: #1e293b;
    border: 1px solid #334155;
    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.65rem 1rem 0.65rem 2.5rem;
    border-radius: 0.75rem;
    outline: none;
    transition: all 0.15s ease;
}

.ai-explorer-search-input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.ai-explorer-categories {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    flex-shrink: 0;
    scrollbar-width: thin;
    scrollbar-color: #334155 rgba(15, 23, 42, 0.4);
}

.ai-explorer-categories::-webkit-scrollbar {
    height: 4px;
}

.ai-explorer-categories::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.4);
    border-radius: 2px;
}

.ai-explorer-categories::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 2px;
}

.ai-cat-filter-btn {
    background-color: #1e293b;
    border: 1px solid #334155;
    color: #94a3b8;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.35rem 0.75rem;
    border-radius: 9999px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.ai-cat-filter-btn:hover {
    color: #ffffff;
    background-color: #334155;
}

.ai-cat-filter-btn.active {
    background-color: #4f46e5;
    border-color: #6366f1;
    color: #ffffff;
}

.ai-explorer-list {
    flex: 1 1 0%;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding-right: 0.35rem;
    padding-bottom: 2rem;
}

/* Feature Card (Accordion) */
.ai-feature-card {
    background-color: #1e293b;
    border: 1px solid #334155;
    border-radius: 0.85rem;
    flex-shrink: 0;
    overflow: hidden;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ai-feature-card:hover {
    border-color: #6366f1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.ai-feature-card-header {
    padding: 0.9rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    background-color: #1e293b;
    transition: background-color 0.15s ease;
    user-select: none;
    flex-shrink: 0;
}

.ai-feature-card-header:hover {
    background-color: #273549;
}

.ai-feature-card-title-wrap {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.ai-feature-card-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.ai-feature-card-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #f1f5f9;
}

.ai-feature-card-category {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.15rem 0.5rem;
    border-radius: 0.35rem;
    background-color: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.3);
    flex-shrink: 0;
}

.ai-feature-card-chevron {
    width: 1.25rem;
    height: 1.25rem;
    color: #94a3b8;
    transition: transform 0.2s ease;
    flex-shrink: 0;
    margin-left: 0.5rem;
}

.ai-feature-card.open .ai-feature-card-chevron {
    transform: rotate(180deg);
}

.ai-feature-card-body {
    display: none;
    padding: 1.25rem 1.5rem;
    background-color: #0f172a;
    border-top: 1px solid #334155;
    font-size: 0.825rem;
    line-height: 1.65;
    color: #cbd5e1;
}

.ai-feature-card.open .ai-feature-card-body {
    display: block !important;
}

.ai-step-list {
    margin: 0.75rem 0 1rem 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.ai-step-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    font-size: 0.825rem;
    line-height: 1.6;
    color: #e2e8f0;
}

.ai-step-num {
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 800;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 0.1rem;
    box-shadow: 0 2px 4px rgba(79, 70, 229, 0.3);
}

.ai-step-text {
    flex: 1 1 0%;
    min-width: 0;
    color: #cbd5e1;
}

.ai-step-text p {
    margin: 0 0 0.4rem 0;
}

.ai-step-text p:last-child {
    margin-bottom: 0;
}

.ai-step-text strong {
    color: #ffffff;
    font-weight: 700;
}

.ai-pro-tip {
    background-color: rgba(245, 158, 11, 0.12);
    border-left: 3px solid #f59e0b;
    border-radius: 0 0.5rem 0.5rem 0;
    padding: 0.75rem 1rem;
    margin-top: 1rem;
    font-size: 0.78rem;
    line-height: 1.6;
    color: #fde68a;
}

.ai-pro-tip strong {
    color: #fbbf24;
    font-weight: 700;
}

.ai-pro-tip p {
    margin: 0;
    display: inline;
}

/* -------------------------------------------------------------
   TAB 3: KEYBOARD SHORTCUTS & QUICK REFERENCE
   ------------------------------------------------------------- */
.ai-shortcuts-view {
    padding: 1.5rem;
    overflow-y: auto;
    height: 100%;
    min-height: 0;
    flex: 1 1 0%;
}

.ai-shortcuts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.25rem;
    padding-bottom: 2rem;
}

.ai-shortcuts-group {
    background-color: #1e293b;
    border: 1px solid #334155;
    border-radius: 0.85rem;
    padding: 1.25rem;
}

.ai-shortcuts-group-title {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #818cf8;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    border-bottom: 1px solid #334155;
    padding-bottom: 0.5rem;
}

.ai-shortcut-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0;
    border-bottom: 1px solid rgba(51, 65, 85, 0.4);
    font-size: 0.78rem;
    color: #cbd5e1;
}

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

kbd {
    background-color: #0f172a;
    border: 1px solid #475569;
    border-bottom: 2px solid #334155;
    color: #f8fafc;
    font-family: monospace;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 0.35rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

/* Floating Action Button (FAB) */
.ai-helper-fab {
    position: fixed;
    bottom: 5.5rem;
    right: 1.5rem;
    z-index: 9999;
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 1rem;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    box-shadow: 0 10px 25px -5px rgba(79, 70, 229, 0.5);
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-helper-fab:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 15px 30px -5px rgba(79, 70, 229, 0.6);
}

.ai-helper-fab-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background-color: #ef4444;
    color: #ffffff;
    font-size: 0.6rem;
    font-weight: 800;
    padding: 0.15rem 0.4rem;
    border-radius: 9999px;
    border: 2px solid #0f172a;
}
