/* Custom styles for Hebrides Platform */

:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
}

.navbar-brand {
    font-weight: bold;
    font-size: 1.5rem;
}

.card {
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: box-shadow 0.15s ease-in-out;
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid #dee2e6;
    font-weight: 600;
}

.btn {
    border-radius: 0.375rem;
    font-weight: 500;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: #0b5ed7;
    border-color: #0a58ca;
}

.table {
    background-color: #fff;
}

.table th {
    border-top: none;
    font-weight: 600;
    color: var(--dark-color);
}

.breadcrumb {
    background-color: transparent;
    padding: 0;
    margin-bottom: 1rem;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: ">";
}

.sidebar {
    background-color: #fff;
    border-right: 1px solid #dee2e6;
    min-height: calc(100vh - 76px);
    padding: 1rem 0;
}

.sidebar .nav-link {
    color: var(--dark-color);
    padding: 0.75rem 1.5rem;
    border-radius: 0;
}

.sidebar .nav-link:hover {
    background-color: var(--light-color);
    color: var(--primary-color);
}

.sidebar .nav-link.active {
    background-color: var(--primary-color);
    color: #fff;
}

.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0.75rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: #dee2e6;
    z-index: 1;
}

.timeline-item {
    position: relative;
    margin-bottom: 2rem;
    z-index: 2;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -1.75rem;
    top: 0.5rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--primary-color, #0d6efd);
    border: 3px solid #ffffff;
    box-shadow: 0 0 0 2px var(--primary-color, #0d6efd);
    z-index: 3;
}

.file-upload-area {
    border: 2px dashed #dee2e6;
    border-radius: 0.5rem;
    padding: 2rem;
    text-align: center;
    background-color: #f8f9fa;
    transition: all 0.3s ease;
}

.file-upload-area:hover {
    border-color: var(--primary-color);
    background-color: #e3f2fd;
}

.file-upload-area.dragover {
    border-color: var(--primary-color);
    background-color: #e3f2fd;
}

.chat-container {
    height: 500px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 1rem;
    background-color: #fff;
}

.chat-message {
    margin-bottom: 1rem;
    padding: 0.75rem;
    border-radius: 0.5rem;
}

.chat-message.user {
    background-color: var(--primary-color);
    color: #fff;
    margin-left: 2rem;
}

.chat-message.assistant {
    background-color: var(--light-color);
    color: var(--dark-color);
    margin-right: 2rem;
}

.dashboard-widget {
    background-color: #fff;
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.widget-header {
    display: flex;
    justify-content: between;
    align-items: center;
    margin-bottom: 1rem;
}

.widget-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.widget-actions {
    display: flex;
    gap: 0.5rem;
}

.loading-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.progress-bar {
    transition: width 0.6s ease;
}

.alert {
    border: none;
    border-radius: 0.5rem;
}

.badge {
    font-size: 0.75rem;
    font-weight: 500;
}

/* Upload Status Styling */
.file-status-list {
    max-height: 300px;
    overflow-y: auto;
}

.file-status-item {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6 !important;
    transition: all 0.3s ease;
}

.file-status-item:hover {
    background-color: #e9ecef;
    border-color: #adb5bd !important;
}

.file-status .badge {
    font-size: 0.7rem;
    padding: 0.35em 0.65em;
}

/* Better visibility for status badges */
.badge.bg-secondary {
    background-color: #6c757d !important;
    color: white !important;
}

.badge.bg-info {
    background-color: #0dcaf0 !important;
    color: #000 !important;
}

.badge.bg-success {
    background-color: #198754 !important;
    color: white !important;
}

.badge.bg-danger {
    background-color: #dc3545 !important;
    color: white !important;
}

.badge.bg-warning {
    background-color: #ffc107 !important;
    color: #000 !important;
}

/* Progress bar styling */
.progress {
    background-color: #e9ecef;
    border-radius: 0.375rem;
}

.progress-bar {
    border-radius: 0.375rem;
}

/* Upload status card */
.card.border-info {
    border-color: #0dcaf0 !important;
}

.card-header.bg-info {
    background-color: #0dcaf0 !important;
    color: #000 !important;
}

/* Alert styling improvements */
.alert {
    margin-bottom: 1rem;
    border-left: 4px solid;
}

.alert-success {
    border-left-color: #198754;
    background-color: #d1e7dd;
    color: #0f5132;
}

.alert-danger {
    border-left-color: #dc3545;
    background-color: #f8d7da;
    color: #721c24;
}

.alert-warning {
    border-left-color: #ffc107;
    background-color: #fff3cd;
    color: #664d03;
}

.alert-info {
    border-left-color: #0dcaf0;
    background-color: #d1ecf1;
    color: #055160;
}

.dropdown-menu {
    border: none;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    border-radius: 0.5rem;
}

.modal-content {
    border: none;
    border-radius: 0.5rem;
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175);
}

.form-control, .form-select {
    border-radius: 0.375rem;
    border: 1px solid #ced4da;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Print styles for PDF generation */
@media print {
    * {
        -webkit-print-color-adjust: exact !important;
        color-adjust: exact !important;
    }
    
    body {
        margin: 0;
        padding: 0;
        font-size: 12pt;
        line-height: 1.4;
        color: #000;
        background: white;
    }
    
    /* Ensure tables stay within page boundaries */
    table {
        width: 100% !important;
        max-width: 100% !important;
        table-layout: fixed !important;
        border-collapse: collapse !important;
        page-break-inside: avoid !important;
        margin: 0 !important;
        font-size: 10pt !important;
    }
    
    table th,
    table td {
        padding: 4pt 6pt !important;
        border: 1px solid #000 !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        hyphens: auto !important;
        vertical-align: top !important;
    }
    
    table th {
        background-color: #f5f5f5 !important;
        font-weight: bold !important;
    }
    
    /* Prevent table overflow */
    .table-responsive {
        overflow: visible !important;
    }
    
    /* Ensure images don't exceed page width */
    img {
        max-width: 100% !important;
        height: auto !important;
        page-break-inside: avoid !important;
    }
    
    /* Page breaks */
    .page-break-before {
        page-break-before: always !important;
    }
    
    .page-break-after {
        page-break-after: always !important;
    }
    
    .page-break-inside-avoid {
        page-break-inside: avoid !important;
    }
    
    /* Headers and footers */
    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid !important;
        margin-top: 0 !important;
        margin-bottom: 0.5em !important;
    }
    
    /* Lists */
    ul, ol {
        page-break-inside: avoid !important;
        margin: 0.5em 0 !important;
    }
    
    li {
        page-break-inside: avoid !important;
    }
    
    /* Paragraphs */
    p {
        margin: 0.5em 0 !important;
        orphans: 3 !important;
        widows: 3 !important;
    }
    
    /* Blockquotes */
    blockquote {
        page-break-inside: avoid !important;
        margin: 1em 0 !important;
        padding: 0.5em 1em !important;
        border-left: 3px solid #ccc !important;
    }
    
    /* Code blocks */
    pre, code {
        page-break-inside: avoid !important;
        font-family: 'Courier New', monospace !important;
        font-size: 9pt !important;
        white-space: pre-wrap !important;
        word-wrap: break-word !important;
    }
    
    /* Remove unnecessary elements for print */
    .no-print,
    .btn,
    .navbar,
    .sidebar,
    .generator-sidebar,
    .document-session-sidebar,
    .prompt-section,
    .section-editor,
    .loading-spinner,
    .btn-group,
    .form-control,
    .form-select,
    .form-group,
    .alert {
        display: none !important;
    }
    
    /* Document content styling */
    .document-content {
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
        box-shadow: none !important;
        background: white !important;
        width: 100% !important;
        max-width: none !important;
    }
    
    /* Ensure content fits within page margins */
    .document-content * {
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    
    /* Page setup */
    @page {
        margin: 1in;
        size: A4;
    }
    
    /* Force page breaks for major sections */
    h1 {
        page-break-before: always !important;
    }
    
    h1:first-child {
        page-break-before: auto !important;
    }
}

/* Chart container styling */
.chat-chart-container {
    display: flex;
    justify-content: center;
    margin: 1rem 0;
    width: 100%;
}

.chat-chart-container .chart-container {
    position: relative;
    display: inline-block;
    max-width: 100%;
}

/* Chart watermark */
.chart-container::after {
    content: 'allermuircapital';
    position: absolute;
    bottom: 10px;
    right: 10px;
    font-size: 10px;
    color: rgba(0, 0, 0, 0.3);
    font-family: Arial, sans-serif;
    font-weight: bold;
    pointer-events: none;
    z-index: 10;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .sidebar {
        min-height: auto;
        border-right: none;
        border-bottom: 1px solid #dee2e6;
    }
    
    .timeline {
        padding-left: 1.5rem;
    }
    
    .timeline::before {
        left: 0.5rem;
    }
    
    .timeline-item::before {
        left: -1.25rem;
    }
    
    .chat-chart-container .chart-container {
        max-width: 100%;
    }
}
