/* Custom styles for TES Bot */

/* CSS Custom Properties for consistent theming */
:root {
    /* Colors */
    --primary-color: #4CAF50;
    --primary-hover: #45a049;
    --secondary-color: #81C784;
    --secondary-hover: #66BB6A;
    --text-color: #2c3e50;
    --text-muted: #6c757d;
    --border-color: #e0e0e0;
    --background-light: #f8fffe;
    --background-lighter: #e8f5e8;
    --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%, #5cb85c 100%);
    --secondary-gradient: linear-gradient(135deg, var(--secondary-color) 0%, #A5D6A7 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(76, 175, 80, 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(129, 199, 132, 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(76, 175, 80, 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: #2e7d32;
    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 */
.segments-section-full-width {
    background-color: var(--white);
    margin: 0;
    padding: 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.segments-section-full-width .container-fluid {
    padding: 2rem 1rem;
}

/* Enhanced table responsive for wide content */
.table-responsive-wide {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-light);
    background: white;
    margin-bottom: 1rem;
}

.table-responsive-wide .table {
    margin-bottom: 0;
    min-width: 1200px; /* Ensure minimum width for all columns */
}

.table-responsive-wide .table th {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    white-space: nowrap;
    padding: 12px 8px;
}

.table-responsive-wide .table td {
    vertical-align: top;
    padding: 12px 8px;
    border-bottom: 1px solid #dee2e6;
    white-space: normal;
    word-wrap: break-word;
}

/* 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(76, 175, 80, 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(76, 175, 80, 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, #11998e 0%, #38ef7d 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 */
.agreement-title {
    font-weight: 600;
    color: #495057;
    font-size: 0.9rem;
    text-align: center;
    padding: 8px;
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}

/* 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-top: 1rem;
}

.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;
        border-color: var(--primary-color);
    }
    
    .table {
        background-color: #2d2d2d;
        color: #ffffff;
    }
    
    .modal-content {
        background-color: #2d2d2d;
        color: #ffffff;
    }
} 

.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;
}
