/* Custom styles for ChatCOF */
:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #0dcaf0;
}

/* Global styles */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bs-dark);
    color: var(--bs-light);
}

/* Navbar customization */
.navbar-brand {
    font-weight: bold;
    font-size: 1.5rem;
    margin-right: 3rem !important;
}

.navbar-brand i {
    animation: spin 2s linear infinite;
}

/* Ensure proper spacing between brand and navigation items */
.navbar .container {
    justify-content: space-between;
}

.navbar-nav:last-child {
    margin-left: auto;
}

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

/* Card enhancements */
.card {
    border: none;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

/* Feature card styling for consistent heights */
.feature-card {
    min-height: 280px;
}

.feature-card .card-body {
    height: 100%;
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.card-header {
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

/* Molecule editor styling */
#kekuleMoleculeEditor {
    background-color: #fff;
    border-radius: 0.375rem;
    overflow: hidden;
}

/* Progress bar styling */
.progress {
    height: 8px;
    background-color: rgba(255,255,255,0.1);
}

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

/* Badge styling */
.badge {
    font-size: 0.8em;
    padding: 0.35em 0.65em;
}

/* Button enhancements */
.btn {
    border-radius: 0.375rem;
    transition: all 0.2s ease-in-out;
}

/* Alert styling for dark theme - Red flashing box */
.alert.alert-danger {
    background-color: #dc3545 !important;
    border: 3px solid #ff1e2e !important;
    color: #ffffff !important;
    animation: flash-red 1s ease-in-out infinite !important;
    box-shadow: 0 0 20px rgba(220, 53, 69, 0.8) !important;
    padding: 1rem !important;
}

.alert.alert-danger strong {
    color: #ffffff !important;
}

.alert.alert-danger i {
    color: #ffffff !important;
}

.alert.alert-danger h5 {
    color: #ffffff !important;
}

.alert.alert-danger small {
    color: #ffdddd !important;
}

@keyframes flash-red {
    0% {
        background-color: #dc3545 !important;
        border-color: #ff1e2e !important;
        box-shadow: 0 0 20px rgba(220, 53, 69, 0.8) !important;
    }
    50% {
        background-color: #ff1e2e !important;
        border-color: #ff4d4d !important;
        box-shadow: 0 0 40px rgba(255, 30, 46, 0.9) !important;
    }
    100% {
        background-color: #dc3545 !important;
        border-color: #ff1e2e !important;
        box-shadow: 0 0 20px rgba(220, 53, 69, 0.8) !important;
    }
}

/* Enhanced table styling for Framework Properties - Dark theme */
.table-bordered {
    border: 2px solid #dee2e6 !important;
    border-radius: 0.5rem;
    overflow: hidden;
}

.table-bordered thead th {
    border-bottom: 2px solid #dee2e6 !important;
    border-right: 2px solid #dee2e6 !important;
    font-weight: 600;
    color: #ffffff !important;
    background-color: rgba(255,255,255,0.05);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.table-bordered tbody td {
    border-bottom: 1px solid #dee2e6 !important;
    border-right: 1px solid #dee2e6 !important;
    padding: 0.75rem;
    vertical-align: middle;
    color: #ffffff !important;
    background-color: rgba(255,255,255,0.02);
}

.table-bordered tbody tr:nth-child(even) {
    background-color: rgba(255,255,255,0.05);
}

.table-bordered tbody tr:hover {
    background-color: rgba(255,255,255,0.08);
}

/* Force borders on all table elements */
.table-bordered th,
.table-bordered td {
    border: 2px solid #dee2e6 !important;
}

/* Specific styling for Assembly Conditions table */
.table-bordered.table-hover {
    border-collapse: separate !important;
    border-spacing: 0 !important;
    border: 2px solid #dee2e6 !important;
}

.table-bordered.table-hover th {
    border: 2px solid #dee2e6 !important;
}

.table-bordered.table-hover td {
    border: 2px solid #dee2e6 !important;
}

/* Override Bootstrap's default table border styles */
.table-bordered > :not(caption) > * > * {
    border-width: 2px !important;
    border-color: #dee2e6 !important;
}

.table-row-hover {
    transition: all 0.3s ease;
}

.table-row-hover:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Custom badge styling for framework properties */
.badge.fs-6 {
    font-size: 0.9rem !important;
    font-weight: 500;
    border-radius: 0.375rem;
    text-shadow: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Property column styling - Dark theme optimized */
.table tbody td:first-child {
    font-weight: 600;
    background: rgba(255, 255, 255, 0.05) !important;
    color: #ffffff !important;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

/* Value column styling - Dark theme optimized */
.table tbody td:nth-child(2) {
    background: rgba(255, 255, 255, 0.02) !important;
    color: #ffffff !important;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

/* Description column styling - Dark theme optimized */
.table tbody td:last-child {
    background: rgba(255, 255, 255, 0.02) !important;
    color: #adb5bd !important;
    font-style: italic;
}

/* Responsive table enhancements - Dark theme */
.table-responsive {
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

/* Ensure all table text is visible */
.table th, .table td {
    color: #ffffff !important;
}

.table th {
    background-color: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.1);
    font-weight: 600;
}

/* Badge styling in tables */
.table .badge {
    color: #000000 !important;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1.1rem;
}

/* Table styling - Enhanced dark theme */
.table-dark {
    --bs-table-bg: rgba(255,255,255,0.05);
    --bs-table-color: #ffffff;
}

.table td {
    border-color: rgba(255,255,255,0.1);
    color: #ffffff !important;
}

.table td strong {
    color: #ffffff !important;
    font-weight: 600;
}

.table td code {
    background-color: rgba(255,255,255,0.1);
    color: #ffc107;
    padding: 0.2em 0.4em;
    border-radius: 0.25rem;
}

/* Loading spinner */
.spinner-border {
    width: 3rem;
    height: 3rem;
}

/* Topology visualization containers */
.topology-container {
    position: relative;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    border-radius: 0.375rem;
    overflow: hidden;
}

.topology-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    pointer-events: none;
}

/* Analysis results styling */
.analysis-score {
    font-size: 2rem;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.score-excellent {
    color: var(--success-color);
}

.score-good {
    color: var(--warning-color);
}

.score-poor {
    color: var(--danger-color);
}

/* Functional group badges */
.functional-group-badge {
    display: inline-block;
    margin: 0.2rem;
    padding: 0.3rem 0.6rem;
    background: linear-gradient(45deg, var(--info-color), var(--primary-color));
    border-radius: 1rem;
    font-size: 0.85rem;
    font-weight: 500;
}

/* Topology score bars */
.topology-score-bar {
    height: 10px;
    background: linear-gradient(90deg, var(--primary-color), var(--success-color));
    border-radius: 5px;
    transition: width 0.8s ease-in-out;
}

/* Molecule property grid */
.property-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.property-item {
    background: rgba(255,255,255,0.05);
    padding: 1rem;
    border-radius: 0.375rem;
    text-align: center;
}

.property-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.property-label {
    font-size: 0.9rem;
    color: var(--bs-secondary);
    margin-top: 0.5rem;
}

/* Responsive design */
@media (max-width: 768px) {
    .display-4 {
        font-size: 2rem;
    }
    
    .lead {
        font-size: 1rem;
    }
    
    #kekuleMoleculeEditor {
        height: 300px;
    }
    
    .property-grid {
        grid-template-columns: 1fr;
    }
}

/* Animation for cards */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeInUp 0.6s ease-out;
}

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

::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.1);
}

::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.5);
}

/* Footer styling */
footer {
    margin-top: auto;
}

/* Tooltip styling */
.tooltip {
    font-size: 0.875rem;
}

/* Alert styling */
.alert {
    border: none;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

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

.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* List group styling */
.list-group-item {
    background-color: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.1);
}

.list-group-item:hover {
    background-color: rgba(255,255,255,0.1);
}

/* Accordion styling */
.accordion-button {
    background-color: rgba(255,255,255,0.05);
    color: var(--bs-light);
    border: none;
}

.accordion-button:not(.collapsed) {
    color: var(--bs-light);
    background-color: rgba(var(--bs-primary-rgb), 0.1);
}

.accordion-button:focus {
    box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.25);
}

.accordion-body {
    background-color: rgba(255,255,255,0.02);
}

/* Loading states */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-spinner {
    text-align: center;
    color: white;
}

/* Utility classes */
.text-gradient {
    background: linear-gradient(45deg, var(--primary-color), var(--info-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.shadow-custom {
    box-shadow: 0 4px 6px rgba(0,0,0,0.1), 0 1px 3px rgba(0,0,0,0.08);
}

/* Print styles */
@media print {
    .navbar,
    .btn,
    footer {
        display: none !important;
    }
    
    .card {
        border: 1px solid #ddd;
        box-shadow: none;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
}
