/**
 * GraphArena Graph Visualization Styles
 * These styles are used for both Cytoscape.js and D3.js graph visualizations
 */

/* Container styles */
#cy, #graph-container {
    width: 100%;
    height: 70vh;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 20px;
    background-color: rgba(27, 39, 53, 0.4);
}

#cy {
    display: block; /* Make Cytoscape container visible by default */
}

#graph-container {
    display: none; /* Hide force-directed graph by default */
}

#cy.active, #graph-container.active {
    display: block;
}

#graph-container {
    position: relative;
    overflow: visible;
}

#graph-container svg {
    overflow: visible;
}

/* Controls container */
.controls {
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(39, 43, 48, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* View toggle buttons */
.view-toggle {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
}

.view-toggle label {
    margin-right: 10px;
    font-weight: bold;
}

.view-toggle-btn {
    background: rgba(33, 37, 41, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 5px 15px;
    margin-right: 5px;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.7);
    transition: all 0.2s ease;
}

.view-toggle-btn:first-of-type {
    border-radius: 3px 0 0 3px;
}

.view-toggle-btn:last-of-type {
    border-radius: 0 3px 3px 0;
}

.view-toggle-btn.active {
    background: rgba(73, 90, 255, 0.7);
    border-color: rgba(73, 90, 255, 0.9);
    color: white;
    box-shadow: 0 0 10px rgba(73, 90, 255, 0.3);
}

/* D3 Force-directed graph styles */
.links line {
    stroke: rgba(255, 255, 255, 0.3);
    stroke-opacity: 0.6;
}

.nodes circle {
    stroke: #fff;
    stroke-width: 1.5px;
    cursor: pointer;
}

.node-label {
    font-family: Arial, sans-serif;
    font-size: 12px;
    fill: rgba(255, 255, 255, 0.8);
    pointer-events: none;
    text-shadow: 0px 0px 2px #000;
}

.node-label.highlight {
    font-weight: bold;
    fill: #fff;
}

.link-highlight {
    stroke: #FFC371 !important;
    stroke-opacity: 1 !important;
    stroke-width: 2px !important;
}

.node-highlight {
    stroke: #FFC371 !important;
    stroke-width: 2px !important;
}

/* Tool description */
.tool-description {
    margin-top: 20px;
}

/* Input controls */
.input-row {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.input-row label {
    margin-right: 10px;
    font-weight: bold;
}

.input-row input {
    margin-right: 10px;
    padding: 5px 10px 5px 30px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    background-color: rgba(33, 37, 41, 0.7);
    color: #f1f1f1;
    position: relative;
}

.input-group {
    position: relative;
    margin-right: 10px;
}

.input-icon {
    position: absolute;
    left: 8px;
    top: 7px;
    color: rgba(255, 255, 255, 0.5);
    z-index: 10;
}

/* Mode indicator */
.mode-indicator {
    margin-left: 10px;
    padding: 5px 10px;
    border-radius: 3px;
    background-color: rgba(33, 37, 41, 0.7);
    font-size: 0.85rem;
}

.mode-indicator.active {
    background-color: #28a745;
    color: white;
}

/* Tooltip */
.tooltip {
    position: absolute;
    background: rgba(39, 43, 48, 0.9);
    padding: 5px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    color: #f1f1f1;
    font-size: 0.8rem;
    pointer-events: none;
    z-index: 1000;
    display: none;
}

/* Graph list for loading saved graphs */
.graph-list {
    max-height: 250px;
    overflow-y: auto;
}

.graph-item {
    padding: 8px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.graph-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

/* Modal styles */
.modal-body {
    max-height: 400px;
    overflow-y: auto;
}

/* Form controls */
.form-control, .form-select {
    background-color: rgba(33, 37, 41, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #f1f1f1;
}

.form-control:focus, .form-select:focus {
    background-color: rgba(33, 37, 41, 0.8);
    border-color: rgba(97, 132, 240, 0.5);
    color: #f1f1f1;
    box-shadow: 0 0 0 0.25rem rgba(97, 132, 240, 0.25);
}

/* Demo graph styles (for index page) */
#demo-graph {
    width: 100%;
    height: 400px;
    position: relative;
    margin: 0 auto;
    z-index: 2;
}

#demo-graph svg {
    overflow: visible;
}

.demo-links line {
    stroke: rgba(255, 255, 255, 0.3);
    stroke-opacity: 0.7;
    transition: stroke 0.3s ease, stroke-opacity 0.3s ease;
}

.demo-nodes circle {
    stroke: #fff;
    stroke-width: 1.5px;
    cursor: grab;
    transition: stroke-width 0.3s ease, fill 0.3s ease;
}

.demo-nodes circle:hover {
    stroke-width: 2.5px;
    stroke: rgba(255, 255, 255, 0.9);
}

.demo-nodes circle:active {
    cursor: grabbing;
}

.demo-node-label {
    font-family: Arial, sans-serif;
    font-size: 10px;
    fill: rgba(255, 255, 255, 0.9);
    pointer-events: none;
    text-shadow: 0px 0px 2px #000;
    transition: font-size 0.3s ease;
}

.demo-node-label.main-label {
    font-size: 0; /* Hide the GraphArena label since it's already in the h1 */
}

/* Enhanced Bootstrap modal styles for dark theme */
.modal {
    z-index: 1050 !important;
    padding: 0 !important;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    outline: 0;
    pointer-events: auto !important;
}

.modal-backdrop {
    z-index: 1040 !important;
    background-color: rgba(0, 0, 0, 0.5);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none !important;
}

.modal-content {
    background-color: #1B2735;
    color: #f1f1f1;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    position: relative;
    display: flex;
    flex-direction: column;
    pointer-events: auto !important;
    outline: 0;
    max-height: calc(100vh - 3.5rem);
}

.modal-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    pointer-events: auto !important;
}

.modal-body {
    position: relative;
    flex: 1 1 auto;
    padding: 1rem;
    overflow-y: auto;
    max-height: calc(100vh - 10rem);
    pointer-events: auto !important;
}

.modal-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0.75rem;
    gap: 0.5rem;
    pointer-events: auto !important;
}

.modal .btn-close {
    color: #fff;
    filter: invert(1) brightness(1.5);
    opacity: 0.8;
    transition: opacity 0.2s;
    pointer-events: auto !important;
}

.modal .btn-close:hover {
    opacity: 1;
}

.modal-dialog {
    margin: 1.75rem auto;
    pointer-events: auto !important;
    position: relative;
    width: auto;
    max-width: 500px;
}

/* Ensure modals display above everything else when shown */
.modal.show {
    display: block !important;
    background-color: transparent;
    pointer-events: auto !important;
}

/* Fix modal animation */
.modal.fade .modal-dialog {
    transform: translateY(-10px);
    opacity: 0;
    transition: transform 0.3s ease-out, opacity 0.3s ease;
}

.modal.show .modal-dialog {
    opacity: 1;
    transform: translateY(0);
    transition: transform 0.3s ease-out, opacity 0.3s ease;
}

/* Override browser focus styles for better visibility */
.modal input:focus, .modal textarea:focus, .modal button:focus {
    outline: 2px solid #4776E6 !important;
    box-shadow: 0 0 0 2px rgba(71, 118, 230, 0.25) !important;
}

/* Make sure modal content is clickable */
.modal-content * {
    pointer-events: auto !important;
}

/* Fix body scroll when modal is open */
body.modal-open {
    overflow: hidden;
    padding-right: 0px !important; /* Bootstrap adds this, but it causes shift */
}

/* Fix for modal inputs */
.modal input, 
.modal textarea, 
.modal select, 
.modal button,
.modal .form-check-input,
.modal .form-check-label {
    pointer-events: auto !important;
    position: relative;
    z-index: 1060 !important;
}

/* Loading indicator for graph list */
.graph-list .loading {
    text-align: center;
    padding: 1rem;
    color: #aaa;
}

/* Improve graph item styling */
.graph-list .graph-item {
    padding: 0.75rem;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    transition: background-color 0.2s;
}

.graph-list .graph-item:hover {
    background-color: rgba(71, 118, 230, 0.2);
    cursor: pointer;
} 