:root {
    --primary-color: #4361ee;
    --secondary-color: #3f37c9;
    --accent-color: #4895ef;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --success-color: #4cc9f0;
    --warning-color: #f72585;
    --danger-color: #e63946;
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #adb5bd;
    --gray-600: #6c757d;
    --gray-700: #495057;
    --gray-800: #343a40;
    --gray-900: #212529;
}
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

/* Base styles */
body {
    background-color: #f5f7fa;
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    color: var(--gray-800);
    overflow-x: hidden;
    overflow-y: auto;
}

/* Navbar styling */
.navbar {
    background-color: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    padding: 0.75rem 1.5rem;
    height: 60px;
    z-index: 1050;
    position: relative;
}

.navbar-brand {
    display: flex;
    align-items: center;
    font-weight: 700;
    color: var(--primary-color);
}

.brand-icon {
    font-size: 1.5rem;
    margin-right: 0.5rem;
    color: var(--primary-color);
}

.brand-text {
    font-size: 1.5rem;
    letter-spacing: -0.5px;
}

.app-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--gray-700);
}

.nav-link {
    color: var(--gray-700);
    font-size: 1.1rem;
}

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

/* Main container */
.container-fluid {
    padding: 1rem;
    max-width: 100%;
    height: 100%;
}

.workspace-row {
    height: calc(100vh - 60px);
    display: flex;
}

/* Panel cards */
.card {
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border: none;
    border-radius: 10px;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: visible;
}

.card-header {
    background-color: white;
    border-bottom: 1px solid var(--gray-200);
    padding: 1rem 1.25rem;
    border-radius: 10px 10px 0 0 !important;
}


.card-header h5 {
    margin: 0;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--gray-800);
}

.header-actions .btn {
    border-radius: 6px;
    font-weight: 500;
}

.card-body {
    flex: 1;
    position: relative;
    overflow: visible;
}

/* Document List Panel */

#left-panel {
    min-height: calc(35vh + 90vh + 60px); /* top + bottom panels + navbar */
}
#right-panel {
    height: 100%;
    padding: 0 10px;
}

#left-panel .card,
#left-panel .card-body {
    height: 100%;
}

#document-list {
    height: 100%;
    overflow-y: auto !important;
    border: 1px solid var(--gray-200);
    background-color: #fff;
    border-radius: 0 0 10px 10px;
    position: relative;
    z-index: 5;
    pointer-events: auto !important;
}

#document-list::-webkit-scrollbar {
    width: 8px;
}

#document-list::-webkit-scrollbar-track {
    background: #f1f1f1;
}

#document-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.doc-header {
    font-weight: 600;
    padding: 12px 15px;
    color: var(--gray-800);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 10;
    transition: background-color 0.2s ease;
}

.list-group-item {
    padding: 10px 15px 10px 20px;
    border-bottom: 1px solid var(--gray-200);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    position: relative;
    z-index: 5;
    pointer-events: auto !important;
}

.list-group-item:hover {
    background-color: var(--gray-100);
    transform: translateX(2px);
}

.list-group-item.selected {
    background-color: #e3f2fd;
    font-weight: 600;
    border-left-width: 4px;
}

/* Workspace Panel */
#document-workspace {
    position: relative;
    height: 100%;
    border: 1px solid var(--gray-200);
    padding: 10px;
    background-color: #fff;
    overflow: auto !important;
    border-radius: 0 0 10px 10px;
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

#document-workspace::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

#document-workspace::-webkit-scrollbar-track {
    background: #f1f1f1;
}

#document-workspace::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

/* Document Windows */
.document-window {
    position: absolute;
    border: none;
    border-radius: 10px;
    background: white;
    width: 300px;
    max-width: 90%;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    overflow: hidden;
    z-index: 10;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    will-change: transform; /* Optimizes for animations */
    cursor: grab;
    touch-action: none;
    pointer-events: auto !important;
}

.document-window:hover {
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.document-window.dragging {
    opacity: 0.95;
    box-shadow: 0 12px 30px rgba(0,0,0,0.2);
    cursor: grabbing;
    transform: scale(1.01); /* Slightly smaller scale for smoother feel */
}

.document-header {
    padding: 12px 15px;
    border-bottom: 1px solid var(--gray-200);
    cursor: move;
    font-weight: 600;
    position: relative;
    user-select: none;
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    border-radius: 10px 10px 0 0;
    transition: none; /* Remove transitions during drag */
}

.document-header-title {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 70px;
}

.document-header-buttons {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
}

.document-content {
    padding: 15px;
    height: 300px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--gray-800);
    background-color: #fff;
    border-radius: 0 0 10px 10px;
}

.document-content::-webkit-scrollbar {
    width: 6px;
}

.document-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.document-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.minimize-btn, .close-btn {
    background: none;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-left: 5px;
    color: var(--gray-600);
    transition: all 0.2s ease;
    z-index: 15;
    pointer-events: auto !important;
}

.minimize-btn:hover, .close-btn:hover {
    background-color: rgba(0,0,0,0.08);
    color: var(--gray-800);
}

.minimize-btn {
    font-size: 16px;
}

.close-btn {
    font-size: 18px;
}

.close-btn:hover {
    background-color: rgba(220, 53, 69, 0.1);
    color: var(--danger-color);
}

/* Draggable Items */
[draggable=true] {
    cursor: move;
    user-select: none;
    pointer-events: auto !important;
}

/* Action Buttons */
.btn {
    border-radius: 6px;
    font-weight: 500;
    padding: 6px 12px;
    transition: all 0.2s ease;
}

#clear-all {
    background-color: var(--gray-100);
    color: var(--gray-700);
    border-color: var(--gray-300);
}

#clear-all:hover {
    background-color: var(--danger-color);
    color: white;
    border-color: var(--danger-color);
}

#organize-btn {
    background-color: var(--gray-100);
    color: var(--primary-color);
    border-color: var(--gray-300);
}

#organize-btn:hover {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background-color: var(--gray-100);
    color: var(--gray-700);
    border: none;
}

.btn-icon:hover {
    background-color: var(--gray-200);
    color: var(--gray-900);
}

/* Minimized documents bar */
#minimized-docs-bar {
    position: fixed;
    bottom: 30px;
    left: 0;
    right: 0;
    background-color: #fff;
    border-top: 1px solid var(--gray-200);
    display: flex;
    padding: 8px;
    z-index: 1000;
    overflow-x: auto;
    box-shadow: 0 -4px 10px rgba(0,0,0,0.05);
}

#minimized-docs-bar::-webkit-scrollbar {
    height: 6px;
}

#minimized-docs-bar::-webkit-scrollbar-track {
    background: #f1f1f1;
}

#minimized-docs-bar::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.minimized-doc {
    padding: 8px 12px;
    margin-right: 8px;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
    font-size: 0.85rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
}

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

/* Footer */
.footer {
    background-color: white;
    padding: 0.5rem 1.5rem;
    text-align: center;
    color: var(--gray-600);
    font-size: 0.9rem;
    border-top: 1px solid var(--gray-200);
    height: 30px;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 900;
}

/* Mobile warning */
#mobile-warning {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    color: white;
    text-align: center;
    padding: 50px 20px;
}

#mobile-warning h2 {
    color: var(--warning-color);
    margin-bottom: 20px;
}

#mobile-warning p {
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto 20px;
}

/* Modal styles */
.modal-content {
    border-radius: 10px;
    border: none;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.modal-header {
    background-color: var(--primary-color);
    color: white;
    border-radius: 10px 10px 0 0;
    border-bottom: none;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid var(--gray-200);
    padding: 1rem 1.5rem;
}

/* Animation for refresh button */
@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.rotate-animation {
    animation: rotate 1s ease;
}

/* Show warning on mobile devices */
@media (max-width: 991px) {
    #mobile-warning {
        display: block;
    }
}

/* Fix for draggable elements */
.ui-draggable-dragging {
    z-index: 1000 !important;
}

/* Additional fixes for scrolling and dragging */
#left-panel .card-body {
    overflow-y: auto;
}
#left-panel, #left-panel .card {
    height: 100% !important; 
}
#right-panel .card-body {
    overflow: hidden !important;
}

.open-all-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(255, 255, 255, 0.3);
    color: var(--gray-800);
    width: 28px;
    height: 28px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    border: none;
}

.open-all-btn:hover {
    background-color: rgba(255, 255, 255, 0.5);
}

/* Styling for visualization modal */
#clusteringVisualizationModal .modal-dialog {
    max-width: 90%;
}

#clusteringVisualizationModal .nav-tabs {
    border-bottom: 1px solid var(--gray-300);
}

#clusteringVisualizationModal .nav-link {
    color: var(--gray-700);
    border: none;
    padding: 10px 15px;
    border-radius: 0;
    margin-right: 5px;
    font-weight: 500;
}

#clusteringVisualizationModal .nav-link.active {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    background-color: transparent;
}

#clusteringVisualizationModal .tab-content {
    padding: 20px 0;
}

/* Styling for the form elements in modal footer */
#clusteringVisualizationModal .form-group {
    display: flex;
    align-items: center;
}

#clusteringVisualizationModal .form-group label {
    margin-right: 10px;
    margin-bottom: 0;
    font-weight: 500;
}

#clusteringVisualizationModal .form-select {
    width: auto;
    display: inline-block;
}

/* Styling for visualization containers */
#tfidf-heatmap, #kmeans-scatter, #hierarchical-dendrogram, #entities-network {
    width: 100%;
    height: 500px;
    background-color: var(--gray-100);
    border-radius: 8px;
    overflow: hidden;
}
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.spinner-container {
    background-color: white;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

#loading-message {
    margin-top: 15px;
    font-weight: 500;
    color: var(--gray-800);
}
/* Add to your styles.css */
.header-actions .btn-group {
    display: inline-flex;
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.cluster-header {
    position: relative;
    padding: 10px 15px;
    font-weight: 500;
    border-radius: 4px 4px 0 0;
    margin-top: 10px;
}

.highlight {
    background-color: #fff3cd !important;
    border-left: 4px solid #ffc107 !important;
    transform: scale(1.02);
    transition: all 0.2s ease;
}

.mds-svg {
    width: 100%;
    height: 100%;
    background-color: #fafafa;
}

.point {
    transition: r 0.2s, stroke-width 0.2s;
}

.tooltip {
    pointer-events: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.highlight {
    background-color: rgba(255, 193, 7, 0.2) !important;
    font-weight: bold;
}
/* Improved responsive behavior */
@media (min-width: 1400px) {
    /* For extra large screens */
    #mds-panel .card-body {
        height: 45vh !important;
    }
    
    #right-panel .card-body {
        height: 55vh !important;
    }
    
    .document-window {
        width: 400px !important;
    }
}

@media (max-width: 1200px) {
    /* For medium-large screens */
    .col-md-2 {
        flex: 0 0 25%;
        max-width: 25%;
    }
    
    .col-md-10 {
        flex: 0 0 75%;
        max-width: 75%;
    }
}

@media (max-width: 992px) {
    /* For medium screens */
    #mds-panel .card-body {
        height: 35vh !important;
    }
    
    #right-panel .card-body {
        height: 45vh !important;
    }
}

/* Add to your styles.css */
#mds-plot {
    position: relative;
    width: 100%;
    height: 100%;
    background-color: #fafafa;
    border-radius: 8px;
}

.card-body {
    padding: 15px !important; /* Override the padding: 0 in your current CSS */
}

/* Increase the overall height */
#mds-panel .card-body {
    height: 40vh !important; /* Increase from 35vh */
}

/* Increase workspace height */
#right-panel .card-body {
    height: 50vh !important; /* Increase from 45vh */
    padding: 15px !important;
}

/* Improve document windows */
.document-window {
    width: 350px !important; /* Increase from 300px */
    max-width: 90%;
    max-height: 80%;
}

.document-content {
    height: 350px !important; /* Increase from 300px */
}

#left-panel, #left-panel .card {
    height: 100% !important;
}

#left-panel .card-body {
    height: 100% !important;
    overflow-y: auto !important;
}

#right-panel .card,
#mds-panel .card {
    height: 100%;
}
