/**
 * CrisisManual360 - Custom Styles
 */

/* ============================================
   ATREVIA Brand Colors
   ============================================ */
:root {
    --cm360-primary: #1a1a2e;
    --cm360-secondary: #16213e;
    --cm360-accent: #0f3460;
    --cm360-highlight: #e94560;
    --cm360-success: #2ecc71;
    --cm360-warning: #f39c12;
    --cm360-danger: #e74c3c;
    --cm360-info: #3498db;
}

/* ============================================
   Auth Pages
   ============================================ */
.auth-fluid {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 100vh;
    flex-direction: row;
    background: linear-gradient(135deg, var(--cm360-primary) 0%, var(--cm360-secondary) 50%, var(--cm360-accent) 100%);
}

.auth-fluid .auth-fluid-form-box {
    max-width: 480px;
    z-index: 2;
    padding: 3rem;
    width: 100%;
    margin: 0 auto;
}

.auth-fluid .auth-brand {
    margin-bottom: 2rem;
    text-align: center;
}

.auth-fluid .auth-brand img {
    height: 40px;
}

.auth-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    padding: 2.5rem;
}

[data-bs-theme="dark"] .auth-card {
    background: #1e2639;
}

/* ============================================
   Logo sizing in sidebar/topbar
   ============================================ */
.logo-topbar .logo-lg img,
.leftside-menu .logo .logo-lg img {
    max-height: 22px;
    width: auto;
}

.logo-topbar .logo-sm img,
.leftside-menu .logo .logo-sm img {
    max-height: 28px;
    width: auto;
}

/* ============================================
   Dashboard Cards
   ============================================ */
.widget-flat .widget-icon {
    font-size: 2rem;
    opacity: 0.35;
}

/* ============================================
   Chart Export Buttons
   ============================================ */
.chart-export-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
}

.chart-export-btn .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.chart-container {
    position: relative;
}

/* ============================================
   Manual Viewer
   ============================================ */
.manual-section-card {
    border-left: 4px solid var(--cm360-accent);
    margin-bottom: 1.5rem;
    transition: border-color 0.2s;
}

.manual-section-card:hover {
    border-left-color: var(--cm360-highlight);
}

.manual-section-card .section-type-badge {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Ensure content uses full available width */
.manual-section-content {
    width: 100%;
    max-width: 100%;
    line-height: 1.7;
    font-size: 0.95rem;
}

.manual-section-content p {
    text-align: justify;
    margin-bottom: 0.75rem;
}

.manual-section-content h4 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    font-weight: 700;
    color: var(--cm360-accent, #0f3460);
}

.manual-section-content h5 {
    margin-top: 1.25rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.manual-section-content h6 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.manual-section-content .table {
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

.manual-section-content .table th {
    white-space: nowrap;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.manual-section-content .table td {
    vertical-align: top;
}

.manual-section-content .card {
    margin-bottom: 1rem;
}

.manual-section-content .alert {
    font-size: 0.9rem;
}

.manual-section-content ul, .manual-section-content ol {
    margin-bottom: 1rem;
}

/* TOC Offcanvas */
#tocOffcanvas {
    max-width: 340px;
}

#tocOffcanvas .toc-link {
    color: #495057;
    font-size: 0.875rem;
    transition: background-color 0.15s, color 0.15s;
    text-decoration: none;
}

#tocOffcanvas .toc-link:hover {
    background-color: rgba(15, 52, 96, 0.08);
    color: var(--cm360-accent, #0f3460);
}

#tocOffcanvas .toc-link.active {
    background-color: rgba(15, 52, 96, 0.12);
    color: var(--cm360-accent, #0f3460);
    font-weight: 600;
}

/* ============================================
   Agent Chat
   ============================================ */
.agent-chat-container {
    height: calc(100vh - 280px);
    min-height: 400px;
}

.agent-message {
    max-width: 80%;
    margin-bottom: 1rem;
}

.agent-message.agent {
    margin-right: auto;
}

.agent-message.user {
    margin-left: auto;
}

.agent-message .message-bubble {
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.agent-message.agent .message-bubble {
    background: #f0f2f5;
    border-bottom-left-radius: 4px;
}

.agent-message.user .message-bubble {
    background: var(--cm360-accent);
    color: #fff;
    border-bottom-right-radius: 4px;
}

[data-bs-theme="dark"] .agent-message.agent .message-bubble {
    background: #2a3142;
}

/* ============================================
   Interactive HTML Manual
   ============================================ */
.interactive-manual-header {
    text-align: center;
    padding: 2rem 0;
    border-bottom: 2px solid #eee;
    margin-bottom: 2rem;
}

.interactive-manual-header img {
    max-height: 60px;
    margin-bottom: 1rem;
}

.interactive-manual-footer {
    text-align: center;
    padding: 2rem 0;
    border-top: 2px solid #eee;
    margin-top: 2rem;
}

.interactive-manual-footer img {
    max-height: 40px;
    opacity: 0.6;
}

/* ============================================
   Tables exportable
   ============================================ */
.table-exportable {
    position: relative;
}

.table-export-actions {
    position: absolute;
    top: -40px;
    right: 0;
    z-index: 5;
}

/* ============================================
   Workspace card
   ============================================ */
.workspace-card {
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.workspace-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.workspace-card .workspace-logo {
    width: 60px;
    height: 60px;
    object-fit: contain;
    border-radius: 8px;
    background: #f8f9fa;
    padding: 8px;
}

/* ============================================
   Manual List Card
   ============================================ */
.manual-list-card {
    transition: transform 0.2s, box-shadow 0.2s;
}

.manual-list-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

.manual-list-card .card-footer {
    border-top: 1px solid #e9ecef;
}

/* ============================================
   Manual TOC links (detail page)
   ============================================ */
.manual-toc-link {
    padding: 0.25rem 0.75rem;
    color: #6c757d;
    border-left: 2px solid transparent;
    transition: all 0.2s;
}

.manual-toc-link:hover {
    color: var(--cm360-accent);
    border-left-color: var(--cm360-accent);
    background: rgba(15, 52, 96, 0.04);
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    .auth-fluid .auth-fluid-form-box {
        padding: 1.5rem;
    }

    .auth-card {
        padding: 1.5rem;
    }

    .agent-message {
        max-width: 90%;
    }
}
