/* Custom styles for User Manual Bot */

/* CSS Custom Properties for consistent theming */
:root {
    /* Colors */
    --primary-color: #2196F3;
    --primary-hover: #1976D2;
    --secondary-color: #64B5F6;
    --secondary-hover: #42A5F5;
    --text-color: #2c3e50;
    --text-muted: #6c757d;
    --border-color: #e0e0e0;
    --background-light: #f9fcff;
    --background-lighter: #e3f2fd;
    --background-input: #fafafa;
    --white: white;
    
    /* Gradients */
    --primary-gradient: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-hover) 100%);
    --primary-gradient-hover: linear-gradient(135deg, var(--primary-hover) 0%, #1976D2 100%);
    --secondary-gradient: linear-gradient(135deg, var(--secondary-color) 0%, #90CAF9 100%);
    --secondary-gradient-hover: linear-gradient(135deg, var(--secondary-hover) 0%, var(--secondary-color) 100%);
    --body-gradient: linear-gradient(135deg, var(--background-light) 0%, var(--background-lighter) 100%);
    
    /* Shadows */
    --shadow-light: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-medium: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-heavy: 0 6px 12px rgba(0,0,0,0.15);
    --shadow-modal: 0 10px 20px rgba(0,0,0,0.15);
    --shadow-button: 0 4px 8px;
    
    /* Border radius */
    --radius-sm: 0.25rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    
    /* Transitions */
    --transition-fast: 0.2s ease-in-out;
}

body {
    background: var(--body-gradient);
    min-height: 100vh;
    color: var(--text-color);
}

.navbar {
    box-shadow: var(--shadow-light);
    background: var(--primary-gradient) !important;
}

.navbar-brand {
    font-weight: bold;
    font-size: 1.5rem;
    color: var(--white) !important;
}

.navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.9) !important;
}

.navbar-nav .nav-link:hover {
    color: var(--white) !important;
}

.card {
    border: none;
    box-shadow: var(--shadow-medium);
    transition: transform var(--transition-fast);
    background-color: var(--white);
    border-radius: var(--radius-lg);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-heavy);
}

.hero-section {
    padding: 2rem 0;
}

.btn {
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: all var(--transition-fast);
}

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

.btn-primary:hover {
    background: var(--primary-gradient-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-button) rgba(33, 150, 243, 0.3);
}

.btn-secondary {
    background: var(--secondary-gradient);
    border: none;
    color: var(--text-color);
}

.btn-secondary:hover {
    background: var(--secondary-gradient-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-button) rgba(100, 181, 246, 0.3);
}

.form-control {
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    background-color: var(--background-input);
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(33, 150, 243, 0.25);
    background-color: var(--white);
}

.input-group-text {
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    background-color: var(--background-lighter);
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

.alert {
    border-radius: var(--radius-md);
    border: none;
}

.alert-success {
    background-color: var(--background-lighter);
    color: #1565c0;
    border-left: 4px solid var(--primary-color);
}

.alert-info {
    background-color: #e3f2fd;
    color: #1565c0;
    border-left: 4px solid #2196F3;
}

.alert-warning {
    background-color: #fff3e0;
    color: #ef6c00;
    border-left: 4px solid #ff9800;
}

.alert-danger {
    background-color: #ffebee;
    color: #c62828;
    border-left: 4px solid #f44336;
}

/* Animation for page transitions */
.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

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

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Full-width content sections - removed (unused) */

/* Enhanced table responsive for wide content - removed (unused) */

/* Responsive adjustments */
@media (max-width: 768px) {
    .hero-section {
        padding: 1rem 0;
    }
    
    .display-4 {
        font-size: 2rem;
    }
    
    .lead {
        font-size: 1rem;
    }
    
    .segments-section-full-width .container-fluid {
        padding: 1rem 0.5rem;
    }
}

/* Responsive adjustments for tables */
@media (max-width: 1200px) {
    .table-responsive-wide .table {
        min-width: 1000px;
    }
}

@media (max-width: 768px) {
    .table-responsive-wide .table {
        min-width: 800px;
    }
}

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.125em;
}

.btn:focus,
.form-control:focus,
.form-select:focus {
    box-shadow: 0 0 0 0.25rem rgba(33, 150, 243, 0.25);
}

/* Common table styling */
.table {
    background-color: var(--white);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.table thead th {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    color: var(--text-color);
}

.table tbody tr:hover {
    background-color: rgba(33, 150, 243, 0.05);
}

.dropdown-menu {
    border: none;
    box-shadow: var(--shadow-medium);
    border-radius: var(--radius-md);
}

.dropdown-item:hover {
    background-color: var(--background-lighter);
    color: var(--text-color);
}

.modal-content {
    border-radius: var(--radius-lg);
    border: none;
    box-shadow: var(--shadow-modal);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    background-color: var(--background-light);
}

.modal-title {
    color: var(--text-color);
    font-weight: 600;
}

.badge {
    font-weight: 500;
}

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

.badge-secondary {
    background-color: var(--text-muted);
}

.text-primary {
    color: var(--primary-color) !important;
}

.text-muted {
    color: var(--text-muted) !important;
}

a {
    color: var(--primary-color);
    text-decoration: none;
}

a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.hidden {
    display: none !important;
}

.w-40 {
    width: 40px;
}

.w-200-250 {
    width: 200px;
    min-width: 200px;
    max-width: 250px;
}

.text-center {
    text-align: center;
}

.py-5 {
    padding-top: 3rem !important;
    padding-bottom: 3rem !important;
}

.mb-1 {
    margin-bottom: 0.25rem !important;
}

.mb-3 {
    margin-bottom: 1rem !important;
}

.me-1 {
    margin-right: 0.25rem !important;
}

.me-2 {
    margin-right: 0.5rem !important;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state-icon {
    font-size: 2rem;
    color: var(--text-muted);
}

.empty-state-icon.muted {
    opacity: 0.5;
}

.content-scrollable {
    max-height: 200px;
    overflow-y: auto;
}

.content-scrollable.plaintext {
    font-family: 'Courier New', monospace;
    background-color: #f8f9fa;
    padding: 0.5rem;
    border-radius: 0.25rem;
    border: 1px solid #e9ecef;
}

.filter-section {
    background-color: var(--white);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-light);
}

/* Common table responsive styling */
.table-responsive {
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-light);
}

/* Common table header styling */
.table th {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
}

/* Common table cell styling */
.table td {
    vertical-align: middle;
}

/* Common button small styling */
.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* Common loading state */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Common edit form styling */
.edit-form {
    background-color: #f8f9fa;
    border-radius: var(--radius-md);
    padding: 30px;
    margin-bottom: 20px;
}

/* Common form section styling */
.form-section {
    margin-bottom: 25px;
}

.form-section h5 {
    color: #495057;
    border-bottom: 2px solid #dee2e6;
    padding-bottom: 8px;
    margin-bottom: 20px;
}

/* Common language field styling */
.language-field-group {
    margin-bottom: 20px;
}

.language-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 5px;
    display: block;
}

.language-field {
    margin-bottom: 15px;
}

.language-field:last-child {
    margin-bottom: 0;
}

/* Common language badge styling */
.language-badge {
    display: inline-block;
    padding: 2px 8px;
    background-color: #007bff;
    color: white;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-right: 10px;
}

/* Common URL link styling */
.url-link {
    color: #0d6efd;
    text-decoration: none;
}

.url-link:hover {
    text-decoration: underline;
}

/* Common description text styling */
.description-text {
    max-width: 200px;
    word-wrap: break-word;
}

/* Common log type badge styling */
.log-type-badge {
    font-size: 0.8em;
    padding: 0.25em 0.5em;
}

/* Common log details styling */
.log-details {
    max-width: 300px;
    word-wrap: break-word;
}

/* Common stats cards styling */
.stats-cards {
    margin-bottom: 1rem;
}

.stats-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1rem;
}

.stats-card.success {
    background: linear-gradient(135deg, #1976D2 0%, #42A5F5 100%);
}

.stats-card.warning {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.stats-card.info {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

/* Common segment styling */
.segment-header {
    background-color: #e9ecef;
    font-weight: 600;
    font-size: 0.9rem;
    white-space: normal;
    word-wrap: break-word;
    max-width: 250px;
    min-width: 200px;
}

.segment-content {
    font-size: 0.85rem;
    line-height: 1.4;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.segment-number {
    font-weight: 600;
    color: #495057;
    background-color: #e9ecef;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    display: inline-block;
    margin-bottom: 4px;
}

/* Common agreement title styling - removed (unused) */

/* Common empty cell styling */
.empty-cell {
    background-color: #f8f9fa;
    color: #6c757d;
    font-style: italic;
    text-align: center;
}

/* Common back button styling */
.back-button {
    margin-bottom: 20px;
}

/* Common button group styling */
.btn-group {
    margin-top: 20px;
}

.btn-group .btn {
    margin-right: 10px;
}

/* Common HTML editor styling */
.html-editor {
    min-height: 200px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
}

/* Chat-specific styles - Removed to avoid conflicts with template-specific styles */

#threadEntities .card {
    margin-bottom: 1rem;
}

#threadEntities .text-truncate {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#threadEntities h6 {
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

#threadEntities .small {
    color: var(--text-muted);
}

.create-section {
    background-color: var(--white);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-light);
}

.selected-entities-section {
    margin: 0;
}

.selected-count {
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

.admin-debug-container {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-top: 1rem;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.admin-debug-container h6 {
    color: #856404;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.toggle-button {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.toggle-button:hover {
    background-color: var(--background-lighter);
    color: var(--text-color);
}

.toggle-button.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.readonly-display {
    background-color: var(--background-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.75rem;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: var(--text-color);
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 200px;
    overflow-y: auto;
}

.segment-content-html {
    line-height: 1.4;
    font-size: 0.85rem;
    max-height: none;
    overflow: visible;
}

.segment-content-html p {
    margin-bottom: 0.5rem;
}

.segment-content-html ul, .segment-content-html ol {
    margin-bottom: 0.5rem;
    padding-left: 1.5rem;
}

.segment-content-html li {
    margin-bottom: 0.25rem;
}

.segment-content-html table {
    border-collapse: collapse;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
}

.segment-content-html table td, .segment-content-html table th {
    border: 1px solid #dee2e6;
    padding: 0.25rem 0.5rem;
}

.segment-content-html strong, .segment-content-html b {
    font-weight: 600;
}

.segment-content-html em, .segment-content-html i {
    font-style: italic;
}

.segment-content-html blockquote {
    border-left: 3px solid #dee2e6;
    padding-left: 1rem;
    margin: 0.5rem 0;
    font-style: italic;
}

.segment-content-plaintext {
    font-size: 0.85em;
    line-height: 1.3;
    font-family: 'Courier New', monospace;
    background-color: #f8f9fa;
    padding: 0.5rem;
    border-radius: 0.25rem;
    border: 1px solid #e9ecef;
    max-height: none;
    overflow: visible;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.segment-content-plaintext:hover {
    background-color: #e9ecef;
}

@media (prefers-color-scheme: dark) {
    body {
        background: #1a1a1a;
        color: #ffffff;
    }
    
    .card {
        background-color: #2d2d2d;
        color: #ffffff;
    }
    
    .form-control {
        background-color: #2d2d2d;
        border-color: #404040;
        color: #ffffff;
    }
    
    .form-control:focus {
        background-color: #2d2d2d !important;
        border-color: var(--primary-color);
        color: #ffffff !important;
    }
    
    /* Fix autofill text color in dark mode */
    .form-control:-webkit-autofill,
    .form-control:-webkit-autofill:hover,
    .form-control:-webkit-autofill:focus,
    .form-control:-webkit-autofill:active {
        -webkit-box-shadow: 0 0 0 30px #2d2d2d inset !important;
        -webkit-text-fill-color: #ffffff !important;
        box-shadow: 0 0 0 30px #2d2d2d inset !important;
        color: #ffffff !important;
    }
    
    .form-select {
        background-color: #2d2d2d;
        border-color: #404040;
        color: #ffffff;
    }
    
    .form-select:focus {
        background-color: #2d2d2d;
        border-color: var(--primary-color);
        color: #ffffff;
    }
    
    textarea.form-control {
        background-color: #2d2d2d;
        border-color: #404040;
        color: #ffffff;
    }
    
    textarea.form-control:focus {
        background-color: #2d2d2d;
        border-color: var(--primary-color);
        color: #ffffff;
    }
    
    .table {
        background-color: #2d2d2d !important;
        color: #ffffff !important;
    }
    
    .table tbody {
        background-color: #2d2d2d !important;
    }
    
    .table tbody tr {
        background-color: #2d2d2d !important;
        border-color: #404040 !important;
    }
    
    .table thead th {
        background-color: #1a1a1a !important;
        border-bottom-color: #404040 !important;
        color: #e5e7eb !important;
    }
    
    .table tbody tr:hover {
        background-color: rgba(33, 150, 243, 0.15) !important;
    }
    
    .table td {
        background-color: #2d2d2d !important;
        border-color: #404040 !important;
        color: #e5e7eb !important;
    }
    
    .table a {
        color: #60a5fa !important;
    }
    
    .table a:hover {
        color: #93c5fd !important;
    }
    
    /* Badge styles in dark mode */
    .table .badge.bg-light {
        background-color: #404040 !important;
        color: #e5e7eb !important;
        border-color: #525252 !important;
    }
    
    .table .badge.bg-secondary {
        background-color: #6b7280 !important;
        color: #ffffff !important;
    }
    
    .table .text-muted {
        color: #9ca3af !important;
    }
    
    /* Buttons in tables - dark mode */
    .table .btn-outline-primary {
        border-color: #3b82f6 !important;
        color: #60a5fa !important;
    }
    
    .table .btn-outline-primary:hover {
        background-color: #3b82f6 !important;
        border-color: #3b82f6 !important;
        color: #ffffff !important;
    }
    
    /* Card header in dark mode */
    .card-header {
        background-color: #1a1a1a !important;
        border-bottom-color: #404040 !important;
        color: #e5e7eb !important;
    }
    
    .card-header h6 {
        color: #e5e7eb !important;
    }
    
    .card-header .text-muted {
        color: #9ca3af !important;
    }
    
    /* Empty state in dark mode */
    .empty-state {
        color: #9ca3af !important;
    }
    
    .empty-state h4 {
        color: #e5e7eb !important;
    }
    
    .empty-state-icon {
        color: #6b7280 !important;
    }
    
    .modal-content {
        background-color: #2d2d2d;
        color: #ffffff;
    }
    
    /* Multiselect dark mode styles */
    .filter-input {
        background-color: #2d2d2d !important;
        border-color: #404040 !important;
        color: #ffffff !important;
    }
    
    .filter-input:focus {
        background-color: #2d2d2d !important;
        border-color: var(--primary-color) !important;
        color: #ffffff !important;
    }
    
    .filter-input::placeholder {
        color: #9ca3af !important;
    }
    
    .filter-input:disabled {
        background-color: #1a1a1a !important;
        color: #6b7280 !important;
    }
    
    .checkbox-group {
        background-color: #2d2d2d !important;
        border-color: #404040 !important;
        color: #ffffff !important;
    }
    
    .checkbox-group.readonly {
        background-color: #1a1a1a !important;
    }
    
    .checkbox-item {
        border-bottom-color: #404040 !important;
    }
    
    .checkbox-item:hover {
        background-color: #404040 !important;
    }
    
    .checkbox-name {
        color: #e5e7eb !important;
    }
    
    .checkbox-description {
        color: #9ca3af !important;
    }
    
    .multiselect-label {
        color: #e5e7eb !important;
    }
    
    .readonly-display {
        background-color: #2d2d2d !important;
        border-color: #404040 !important;
        color: #ffffff !important;
    }
    
    .readonly-display .selected-item {
        background-color: #404040 !important;
        border-color: #525252 !important;
        color: #e5e7eb !important;
    }
    
    .multiselect-container.required {
        background-color: #3d1a1a !important;
        border-color: #dc3545 !important;
    }
    
    .multiselect-container.required .multiselect-label {
        color: #f87171 !important;
    }
    
    /* Scrollbar dark mode */
    ::-webkit-scrollbar-track {
        background: #1a1a1a;
    }
    
    ::-webkit-scrollbar-thumb {
        background: #525252;
    }
    
    ::-webkit-scrollbar-thumb:hover {
        background: #6b6b6b;
    }
    
    /* Additional dark mode elements */
    .content-scrollable.plaintext {
        background-color: #2d2d2d !important;
        border-color: #404040 !important;
        color: #ffffff !important;
    }
    
    .segment-content-plaintext {
        background-color: #2d2d2d !important;
        border-color: #404040 !important;
        color: #ffffff !important;
    }
    
    .segment-content-plaintext:hover {
        background-color: #404040 !important;
    }
    
    .admin-debug-content pre {
        background-color: #1a1a1a !important;
        border-color: #404040 !important;
        color: #ffffff !important;
    }
    
    .admin-debug-content strong {
        color: #e5e7eb !important;
    }
} 

.nowrap {
    white-space: nowrap;
}

/* Admin Debug Panel Styles */
.admin-debug-panel {
    margin: 0;
}

.admin-debug-panel .btn {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
}

.admin-debug-content .card {
    border: 1px solid #dee2e6;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.admin-debug-content strong {
    color: #495057;
    font-weight: 600;
}

.admin-debug-content pre {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 0.25rem;
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
}
