/* ============================================
   OPTKAS — XRPL TRAINING ACADEMY STYLES
   Extends styles.css for training-specific elements
   ============================================ */

/* --- Module Tag --- */
.module-tag {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
    margin-bottom: 8px;
}

/* --- Training Content Container --- */
.training-content {
    padding: 0;
}

/* --- Teach Blocks --- */
.teach-block {
    margin-bottom: 36px;
    padding-bottom: 36px;
    border-bottom: 1px solid var(--border);
}

.teach-block:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.teach-block h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.teach-block p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 12px;
}

.teach-block code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--accent-cyan);
}

/* --- Concept Cards --- */
.concept-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px 24px;
    margin: 16px 0;
}

.concept-card h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--accent-amber);
    margin-bottom: 10px;
}

.concept-card p {
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.concept-card ul {
    list-style: none;
    padding: 0;
}

.concept-card li {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 4px 0;
    padding-left: 16px;
    position: relative;
}

.concept-card li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: var(--accent-cyan);
}

/* --- Three Column Mini Cards --- */
.three-col-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin: 16px 0;
}

.mini-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}

.mini-icon {
    font-size: 28px;
    margin-bottom: 8px;
}

.mini-card h4 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.mini-card p {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* --- Use Case Grid --- */
.use-case-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin: 16px 0;
}

.use-case-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    transition: border-color 0.2s;
}

.use-case-card:hover {
    border-color: var(--accent-blue);
}

.uc-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

.use-case-card h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.use-case-card p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 12px;
}

.uc-engines {
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    border-top: 1px solid var(--border);
    padding-top: 8px;
}

/* --- Service Cards Grid --- */
.service-cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin: 16px 0;
}

.service-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    transition: border-color 0.2s;
}

.service-card:hover {
    border-color: var(--accent-green);
}

.svc-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

.service-card h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.service-card p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 8px;
}

.svc-rev {
    font-size: 12px;
    color: var(--accent-amber);
    font-weight: 600;
}

/* --- Engine Grid --- */
.engine-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin: 16px 0;
}

.engine-item {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 18px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.eng-cat {
    display: inline-block;
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    margin-right: 8px;
    letter-spacing: 0.3px;
}

/* --- Completion Box --- */
.completion-box {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(59, 130, 246, 0.1));
    border: 2px solid var(--accent-green);
    border-radius: 16px;
    padding: 40px;
    display: inline-block;
    max-width: 600px;
}

.completion-box h2 {
    font-size: 24px;
    margin-bottom: 8px;
    color: var(--accent-green);
}

.completion-box p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.7;
}

.training-link-btn {
    display: inline-block;
    padding: 10px 24px;
    background: var(--accent-blue);
    color: #fff;
    border-radius: 8px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s;
}

.training-link-btn:hover {
    background: #2563eb;
}

/* --- Read/Listen Label --- */
.read-listen-label {
    display: inline-block;
    font-size: 12px;
    color: var(--text-muted);
    margin-left: 12px;
}

/* --- Step Box (for operations module) --- */
.step-box {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px 24px;
    margin: 16px 0;
}

.step-box h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--accent-cyan);
    margin-bottom: 10px;
}

.step-box ol {
    padding-left: 20px;
}

.step-box li {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 4px 0;
    line-height: 1.6;
}

/* --- Responsive --- */
@media (max-width: 1200px) {
    .three-col-cards,
    .use-case-grid,
    .service-cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .three-col-cards,
    .use-case-grid,
    .service-cards-grid,
    .engine-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   AI KNOWLEDGE ASSISTANT — Chat Widget
   ============================================ */

/* Floating Action Button */
.ai-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #10b981, #3b82f6);
    color: #fff;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-sans, 'Inter', sans-serif);
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.4);
    transition: all 0.3s ease;
}
.ai-fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 28px rgba(16, 185, 129, 0.5);
}
.ai-fab-active {
    background: linear-gradient(135deg, #ef4444, #f59e0b);
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.4);
}
.ai-fab-icon { font-size: 20px; }
.ai-fab-label { letter-spacing: 0.5px; }

/* Chat Panel */
.ai-panel {
    position: fixed;
    bottom: 80px;
    right: 24px;
    z-index: 9998;
    width: 420px;
    max-width: calc(100vw - 48px);
    height: 560px;
    max-height: calc(100vh - 120px);
    background: var(--bg-secondary, #111827);
    border: 1px solid var(--border, #2d3748);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 12px 48px rgba(0,0,0,0.5);
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.ai-panel.ai-open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Header */
.ai-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--bg-tertiary, #1a2332);
    border-bottom: 1px solid var(--border, #2d3748);
}
.ai-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}
.ai-header-icon { font-size: 22px; }
.ai-header-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary, #e2e8f0);
    letter-spacing: 0.5px;
}
.ai-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Mode Toggle */
.ai-mode-btn {
    padding: 4px 10px;
    border: 1px solid var(--border, #2d3748);
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-sans, 'Inter', sans-serif);
}
.ai-mode-simple {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green, #10b981);
    border-color: rgba(16, 185, 129, 0.3);
}
.ai-mode-deep {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-blue, #3b82f6);
    border-color: rgba(59, 130, 246, 0.3);
}

/* Close Button */
.ai-close-btn {
    background: none;
    border: none;
    color: var(--text-secondary, #94a3b8);
    font-size: 18px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.2s;
}
.ai-close-btn:hover {
    background: var(--bg-hover, #243044);
    color: var(--text-primary, #e2e8f0);
}

/* Suggestions */
.ai-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border, #2d3748);
    background: var(--bg-primary, #0a0e17);
}
.ai-suggestion {
    padding: 4px 10px;
    background: var(--bg-card, #1e293b);
    border: 1px solid var(--border, #2d3748);
    border-radius: 20px;
    color: var(--text-secondary, #94a3b8);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-sans, 'Inter', sans-serif);
    white-space: nowrap;
}
.ai-suggestion:hover {
    background: var(--bg-hover, #243044);
    color: var(--text-primary, #e2e8f0);
    border-color: var(--accent-green, #10b981);
}

/* Messages Area */
.ai-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.ai-messages::-webkit-scrollbar { width: 6px; }
.ai-messages::-webkit-scrollbar-track { background: transparent; }
.ai-messages::-webkit-scrollbar-thumb {
    background: var(--border, #2d3748);
    border-radius: 3px;
}

/* Message Bubbles */
.ai-msg {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}
.ai-msg-user {
    flex-direction: row-reverse;
}
.ai-msg-avatar {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}
.ai-msg-user .ai-msg-avatar {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: #fff;
}
.ai-msg-assistant .ai-msg-avatar {
    background: linear-gradient(135deg, #10b981, #06b6d4);
    color: #fff;
}
.ai-msg-text {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-primary, #e2e8f0);
}
.ai-msg-user .ai-msg-text {
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.25);
    border-radius: 12px 12px 2px 12px;
}
.ai-msg-assistant .ai-msg-text {
    background: var(--bg-card, #1e293b);
    border: 1px solid var(--border, #2d3748);
    border-radius: 12px 12px 12px 2px;
}
.ai-msg-text code {
    background: rgba(139, 92, 246, 0.2);
    padding: 1px 5px;
    border-radius: 3px;
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: 12px;
    color: var(--accent-purple, #8b5cf6);
}
.ai-msg-text pre {
    background: var(--bg-primary, #0a0e17);
    border: 1px solid var(--border, #2d3748);
    border-radius: 8px;
    padding: 10px;
    margin: 8px 0;
    overflow-x: auto;
    font-size: 11px;
}
.ai-msg-text pre code {
    background: none;
    padding: 0;
    color: var(--text-primary, #e2e8f0);
}
.ai-msg-text strong {
    color: var(--accent-green, #10b981);
}
.ai-msg-text em {
    color: var(--accent-amber, #f59e0b);
    font-style: italic;
}
.ai-bullet {
    color: var(--accent-cyan, #06b6d4);
    font-weight: 600;
}
.ai-related {
    margin-top: 8px;
    padding: 6px 10px;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: 6px;
    font-size: 11px;
    color: var(--text-secondary, #94a3b8);
}
.ai-related a {
    color: var(--accent-amber, #f59e0b);
    text-decoration: none;
    font-weight: 600;
}
.ai-related a:hover {
    text-decoration: underline;
}

/* Input Area */
.ai-input-area {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    background: var(--bg-tertiary, #1a2332);
    border-top: 1px solid var(--border, #2d3748);
}
.ai-input {
    flex: 1;
    padding: 10px 14px;
    background: var(--bg-primary, #0a0e17);
    border: 1px solid var(--border, #2d3748);
    border-radius: 10px;
    color: var(--text-primary, #e2e8f0);
    font-size: 13px;
    font-family: var(--font-sans, 'Inter', sans-serif);
    outline: none;
    transition: border-color 0.2s;
}
.ai-input:focus {
    border-color: var(--accent-green, #10b981);
}
.ai-input::placeholder {
    color: var(--text-muted, #64748b);
}
.ai-send {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #10b981, #3b82f6);
    border: none;
    border-radius: 10px;
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}
.ai-send:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 12px rgba(16, 185, 129, 0.4);
}

/* Mobile */
@media (max-width: 768px) {
    .ai-panel {
        width: calc(100vw - 24px);
        right: 12px;
        bottom: 72px;
        height: calc(100vh - 100px);
    }
    .ai-fab {
        right: 12px;
        bottom: 12px;
        padding: 10px 16px;
        font-size: 13px;
    }
    .ai-suggestions {
        padding: 8px 10px;
        gap: 4px;
    }
    .ai-suggestion {
        font-size: 10px;
        padding: 3px 8px;
    }
}
