/* Ontology Explorer Styles */

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    margin: 0;
    padding: 20px;
    background: #f5f5f5;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

h1 {
    color: #333;
    margin-bottom: 10px;
}

.subtitle {
    color: #666;
    margin-top: 0;
    margin-bottom: 20px;
}

.source-url {
    font-size: 11px;
    color: #888;
    margin-top: -15px;
}

.source-url a {
    color: #0066cc;
}

/* Header row */
.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#dark-mode-btn {
    background: none;
    border: 1px solid #cbd5e0;
    color: #4a5568;
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

#dark-mode-btn:hover {
    background: #edf2f7;
    border-color: #a0aec0;
}

/* Drag & Drop Overlay */
#drop-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(66, 153, 225, 0.95);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

.drop-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: white;
    font-size: 24px;
    gap: 10px;
}

.drop-message .drop-icon {
    font-size: 64px;
}

.drop-message small {
    font-size: 14px;
    opacity: 0.8;
}

/* Controls */
.controls {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
}

.load-ontology-row {
    display: flex;
    width: 100%;
    gap: 15px;
    align-items: center;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-group label {
    font-weight: 500;
    color: #555;
    white-space: nowrap;
}

.control-group input[type="text"],
.control-group select {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.control-group button,
.controls button {
    padding: 6px 12px;
    background: #4299e1;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    box-shadow: none;
}

.control-group button:hover,
.controls button:hover {
    background: #3182ce;
}

/* View Mode Selector */
.view-mode-selector {
    display: flex;
    gap: 2px;
    background: #eee;
    padding: 2px;
    border-radius: 4px;
}

.view-mode-selector button {
    background: transparent;
    color: #555;
    padding: 4px 10px;
    font-size: 13px;
}

.view-mode-selector button:hover {
    background: #ddd;
}

.view-mode-selector button.active {
    background: #4299e1;
    color: white;
}

/* Label mode selector */
.label-mode-selector {
    display: flex;
    gap: 2px;
    background: #eee;
    padding: 2px;
    border-radius: 4px;
}

.label-mode-selector .label-mode-btn {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding: 4px 10px;
    font-size: 11px;
    border: none;
    background: transparent !important;
    border-radius: 4px;
    cursor: pointer;
    color: #555 !important;
    box-shadow: none;
    outline: none;
}

.label-mode-selector .label-mode-btn:hover {
    background: #ddd !important;
}

.label-mode-selector .label-mode-btn.active {
    background: #4299e1 !important;
    color: white !important;
}

/* Visualisation Container */
.viz-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
}

#graph {
    width: 100%;
    height: 800px;
    display: block;
}

.loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 18px;
    color: #666;
}

/* Nodes */
.node {
    cursor: pointer;
    transition: opacity 0.2s;
}

.node.ontology { fill: #e53e3e; }
.node.class { fill: #3182ce; }
.node.objectProperty { fill: #38a169; }
.node.datatypeProperty { fill: #dd6b20; }
.node.individual { fill: #805ad5; }
.node.concept { fill: #d69e2e; }
.node.property { fill: #00b5d8; }

.node.dimmed { opacity: 0.15; }
.node.highlighted-issue { 
    stroke: #e53e3e; 
    stroke-width: 3px;
}

.node.search-highlight {
    stroke: #e53e3e;
    stroke-width: 4px;
}

/* Links */
.link {
    stroke: #999;
    stroke-opacity: 0.6;
    fill: none;
}

.link.subClassOf { stroke: #4299e1; stroke-width: 2px; }
.link.domain { stroke: #48bb78; stroke-width: 1.5px; }
.link.range { stroke: #ed8936; stroke-width: 1.5px; }
.link.instanceOf { stroke: #9f7aea; stroke-dasharray: 4,2; }
.link.definedIn { stroke: #e53e3e; stroke-dasharray: 4,2; stroke-opacity: 0.4; }
.link.inverseOf { stroke: #ed64a6; stroke-width: 2px; stroke-dasharray: 6,3; }

.link.dimmed { opacity: 0.1; }

/* Link Labels */
.link-label {
    font-size: 9px;
    fill: #666;
    pointer-events: none;
    text-anchor: middle;
}

.link-label.subClassOf { fill: #4299e1; }
.link-label.domain { fill: #48bb78; }
.link-label.range { fill: #ed8936; }
.link-label.instanceOf { fill: #9f7aea; }
.link-label.definedIn { fill: #e53e3e; }
.link-label.inverseOf { fill: #ed64a6; }

.link-label.hidden { display: none; }
.link-label.dimmed { opacity: 0.2; }

/* Node Labels */
.node-label {
    font-size: 10px;
    fill: #333;
    pointer-events: none;
}

.node-label.hidden {
    display: none;
}

/* Tree View */
.tree-link {
    fill: none;
    stroke: #ccc;
    stroke-width: 1.5px;
}

.tree-label {
    font-size: 11px;
    fill: #333;
}

/* Legend */
.legend {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255,255,255,0.95);
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    font-size: 12px;
    max-width: 200px;
}

.legend-title {
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
}

.legend-section {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.legend-line {
    width: 20px;
    height: 3px;
    border-radius: 1px;
}

.legend-line.dashed {
    border-top: 2px dashed currentColor;
    height: 0;
    background: none;
}

.legend-shape {
    font-size: 16px;
    width: 20px;
    display: inline-block;
    text-align: center;
}

.legend-toggle {
    cursor: pointer;
}

.legend-toggle:hover {
    background: rgba(0,0,0,0.05);
    border-radius: 4px;
}

.legend-toggle input[type="checkbox"] {
    margin-right: 6px;
}

.zoom-hint {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #eee;
    color: #888;
    font-size: 11px;
}

/* Palette selector */
.palette-selector {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.palette-btn {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding: 4px 10px;
    font-size: 11px;
    border: none;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    color: #666;
    box-shadow: none;
    outline: none;
}

.palette-btn:hover {
    background: #ddd;
}

.palette-btn.active {
    background: #4299e1;
    color: white;
}

/* Tooltip */
.tooltip {
    position: fixed;
    background: rgba(0,0,0,0.9);
    color: white;
    padding: 12px 15px;
    border-radius: 6px;
    font-size: 13px;
    max-width: 350px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 1000;
}

.tooltip.visible {
    opacity: 1;
}

.tooltip h3 {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: #fff;
}

.tooltip p {
    margin: 4px 0;
}

.tooltip .label {
    color: #aaa;
}

.tooltip .uri {
    font-size: 11px;
    color: #888;
    word-break: break-all;
    margin-top: 8px;
}

.tooltip .click-hint {
    font-size: 10px;
    color: #4299e1;
    margin-top: 6px;
}

.tooltip code {
    background: rgba(255,255,255,0.15);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    font-size: 12px;
}

/* Stats */
.stats {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stats h3 {
    margin: 0 0 15px 0;
    color: #333;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
}

.stat-item {
    text-align: center;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
}

.stat-label {
    font-size: 11px;
    color: #666;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 24px;
    font-weight: 600;
    color: #333;
}

/* Quality Panel */
.quality-panel {
    background: white;
    border-radius: 8px;
    margin-top: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

.quality-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
}

.quality-header h3 {
    margin: 0;
    color: #333;
}

.close-btn {
    background: none !important;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.close-btn:hover {
    color: #333;
    background: none !important;
}

.quality-content {
    padding: 15px 20px;
}

.quality-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    margin-bottom: 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.quality-item:hover {
    background: #f0f0f0;
}

.quality-item.success {
    background: #f0fff4;
    border-left: 3px solid #48bb78;
}

.quality-item.warning {
    background: #fffaf0;
    border-left: 3px solid #ed8936;
}

.quality-item.error {
    background: #fff5f5;
    border-left: 3px solid #e53e3e;
}

.quality-icon {
    font-size: 16px;
    margin-right: 10px;
}

.quality-label {
    flex-grow: 1;
    font-size: 14px;
}

.quality-info {
    color: #666;
    cursor: help;
    font-size: 14px;
    margin-left: 6px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.quality-info:hover {
    opacity: 1;
    color: #0066cc;
}

.quality-count {
    font-weight: 600;
    font-size: 14px;
    min-width: 30px;
    text-align: right;
}

.quality-details {
    display: none;
    padding: 10px 15px;
    background: #f8f9fa;
    margin: -4px 0 8px 0;
    border-radius: 0 0 6px 6px;
}

.quality-details.visible {
    display: block;
}

.quality-details ul {
    margin: 0;
    padding-left: 20px;
    max-height: 200px;
    overflow-y: auto;
}

.quality-details li {
    padding: 4px 0;
    font-size: 13px;
    cursor: pointer;
}

.quality-details li:hover {
    color: #4299e1;
}

.quality-details small {
    color: #888;
}

.quality-actions {
    padding: 15px 20px;
    background: #f8f9fa;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
}

.quality-actions button {
    padding: 8px 16px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

.quality-actions button:hover {
    background: #5a67d8;
}

/* Force Settings Panel */
.force-panel {
    background: white;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

.force-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
}

.force-header h4 {
    margin: 0;
    color: #333;
}

.force-controls {
    padding: 15px 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.force-control {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.force-control label {
    font-weight: 500;
    font-size: 13px;
    color: #333;
}

.force-control input[type="range"] {
    width: 100%;
}

.force-hint {
    font-size: 11px;
    color: #888;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-label input {
    margin: 0;
}

/* Export Panel */
.export-panel {
    background: white;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

.export-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
}

.export-header h4 {
    margin: 0;
    color: #333;
}

.export-controls {
    padding: 15px 20px;
    display: flex;
    gap: 30px;
}

.export-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.export-group h5 {
    margin: 0 0 5px 0;
    color: #555;
    font-size: 13px;
}

.export-group button {
    padding: 8px 16px;
}

.export-hint {
    font-size: 11px;
    color: #888;
    margin: 5px 0 0 0;
}

/* Error Message */
.error {
    background: #fff5f5;
    color: #c53030;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #e53e3e;
}

/* Tour button */
#tour-btn {
    background: #805ad5;
}

#tour-btn:hover {
    background: #6b46c1;
}

/* Shepherd.js Tour Customisation */
.shepherd-theme-custom {
    max-width: 400px;
}

.shepherd-theme-custom .shepherd-content {
    border-radius: 8px;
    padding: 0;
}

.shepherd-theme-custom .shepherd-header {
    background: #3182ce;
    padding: 12px 15px;
    border-radius: 8px 8px 0 0;
}

.shepherd-theme-custom .shepherd-title {
    color: white;
    font-size: 16px;
}

.shepherd-theme-custom .shepherd-cancel-icon {
    color: white;
}

.shepherd-theme-custom .shepherd-text {
    padding: 15px;
    font-size: 14px;
    line-height: 1.5;
}

.shepherd-theme-custom .shepherd-text h3 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 16px;
}

.shepherd-theme-custom .shepherd-text p {
    margin: 0;
    color: #555;
}

.shepherd-theme-custom .shepherd-footer {
    padding: 10px 15px;
    border-top: 1px solid #eee;
}

.shepherd-theme-custom .shepherd-button {
    background: #3182ce;
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    font-size: 13px;
}

.shepherd-theme-custom .shepherd-button:hover {
    background: #2c5282;
}

.shepherd-theme-custom .shepherd-button.shepherd-button-secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.shepherd-theme-custom .shepherd-button.shepherd-button-secondary:hover {
    background: #cbd5e0;
}

/* ==================== DARK MODE ==================== */
.dark-mode {
    background: #1a202c;
    color: #e2e8f0;
}

.dark-mode .container h1 {
    color: #e2e8f0;
}

.dark-mode .subtitle {
    color: #a0aec0;
}

.dark-mode #dark-mode-btn {
    border-color: #4a5568;
    color: #e2e8f0;
}

.dark-mode #dark-mode-btn:hover {
    background: #4a5568;
    border-color: #718096;
}

.dark-mode #drop-overlay {
    background: rgba(49, 130, 206, 0.95);
}

.dark-mode .controls,
.dark-mode .viz-container,
.dark-mode .stats,
.dark-mode .quality-panel,
.dark-mode .force-panel,
.dark-mode .export-panel {
    background: #2d3748;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.dark-mode .control-group label {
    color: #a0aec0;
}

.dark-mode .control-group input[type="text"],
.dark-mode .control-group select,
.dark-mode textarea {
    background: #4a5568;
    border-color: #4a5568;
    color: #e2e8f0;
}

.dark-mode .control-group input[type="text"]::placeholder,
.dark-mode textarea::placeholder {
    color: #a0aec0;
}

.dark-mode .view-mode-selector,
.dark-mode .label-mode-selector {
    background: #4a5568;
}

.dark-mode .view-mode-selector button:not(.active),
.dark-mode .label-mode-selector .label-mode-btn:not(.active) {
    color: #a0aec0 !important;
}

.dark-mode .view-mode-selector button:hover,
.dark-mode .label-mode-selector .label-mode-btn:hover {
    background: #718096 !important;
}

.dark-mode .legend {
    background: rgba(45, 55, 72, 0.95);
    color: #e2e8f0;
}

.dark-mode .legend-title {
    color: #e2e8f0;
}

.dark-mode .legend-section {
    border-top-color: #4a5568;
}

.dark-mode .palette-selector {
    border-bottom-color: #4a5568;
}

.dark-mode .palette-btn {
    color: #a0aec0;
}

.dark-mode .palette-btn:hover {
    background: #4a5568;
}

.dark-mode .palette-btn.active {
    background: #4299e1;
    color: white;
}

.dark-mode .zoom-hint {
    color: #718096;
    border-top-color: #4a5568;
}

.dark-mode .tooltip {
    background: rgba(26, 32, 44, 0.95);
}

.dark-mode .stats h3,
.dark-mode .quality-header h3,
.dark-mode .force-header h4,
.dark-mode .export-header h4 {
    color: #e2e8f0;
}

.dark-mode .stat-item {
    background: #4a5568;
}

.dark-mode .stat-label {
    color: #a0aec0;
}

.dark-mode .stat-value {
    color: #e2e8f0;
}

.dark-mode .quality-header,
.dark-mode .force-header,
.dark-mode .export-header,
.dark-mode .quality-actions {
    background: #4a5568;
    border-color: #2d3748;
}

.dark-mode .quality-item {
    background: #4a5568;
}

.dark-mode .quality-item.success {
    background: rgba(72, 187, 120, 0.2);
}

.dark-mode .quality-item.warning {
    background: rgba(237, 137, 54, 0.2);
}

.dark-mode .quality-item.error {
    background: rgba(229, 62, 62, 0.2);
}

.dark-mode .quality-details {
    background: #4a5568;
}

.dark-mode .quality-details small {
    color: #a0aec0;
}

.dark-mode .force-control label,
.dark-mode .export-group h5 {
    color: #e2e8f0;
}

.dark-mode .force-hint,
.dark-mode .export-hint {
    color: #718096;
}

.dark-mode .close-btn {
    color: #a0aec0;
}

.dark-mode .close-btn:hover {
    color: #e2e8f0;
}

.dark-mode .error {
    background: rgba(229, 62, 62, 0.2);
    color: #fc8181;
}

.dark-mode .node-label {
    fill: #e2e8f0;
}

.dark-mode .tree-link {
    stroke: #4a5568;
}

.dark-mode .tree-label {
    fill: #e2e8f0;
}

.dark-mode #graph {
    background: #2d3748;
}

.dark-mode .legend-toggle:hover {
    background: rgba(255,255,255,0.1);
}


/* ==================== FULLSCREEN VIZ MODE ==================== */

body {
    overflow: hidden;
    padding: 0;
    margin: 0;
    height: 100vh;
}

.container {
    max-width: none;
    padding: 0;
    margin: 0;
    height: 100vh;
    position: relative;
}

/* Viz fills the entire viewport */
.viz-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 0;
    box-shadow: none;
    z-index: 1;
}

#graph {
    width: 100%;
    height: 100%;
}

/* Floating header */
.header-row {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 100;
    background: rgba(255,255,255,0.9);
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.header-row h1 {
    font-size: 20px;
    margin: 0;
    margin-right: 20px;
}

.subtitle, .source-url {
    display: none;
}

/* Floating controls */
.controls {
    position: fixed;
    top: 80px;
    left: 20px;
    z-index: 100;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    max-width: 600px;
}

#load-ontology-panel {
    top: 80px;
    padding: 15px 20px;
}

#load-ontology-panel .load-ontology-row {
    flex-wrap: wrap;
}

#load-ontology-panel .control-group:first-child {
    flex: 1 1 auto;
    min-width: 200px;
}

#load-ontology-panel .control-group:first-child input {
    flex: 1;
    min-width: 150px;
    max-width: 100%;
    width: auto !important;
}

#ontology-controls {
    top: 150px;
}

/* Fix Paste Content button wrapping */
#toggle-paste-btn {
    white-space: nowrap;
}

/* Make paste panel float properly */
#paste-panel {
    position: fixed;
    top: 290px;
    left: 20px;
    z-index: 150;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    max-width: 600px;
    width: calc(100vw - 60px);
    max-height: 50vh;
}

#paste-panel textarea {
    max-height: 30vh;
}

/* Floating panels */
.force-panel,
.export-panel {
    position: fixed;
    top: 220px;
    left: 20px;
    z-index: 100;
    max-width: 500px;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.quality-panel {
    position: fixed;
    top: 80px;
    right: 240px;
    z-index: 100;
    max-width: 400px;
    max-height: 80vh;
    overflow-y: auto;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    margin-top: 0;
}

/* Stats hidden by default in fullscreen */
.stats {
    display: none;
}

/* Legend adjustments */
.legend {
    z-index: 100;
}

/* Dark mode adjustments for floating elements */
.dark-mode .header-row {
    background: rgba(45, 55, 72, 0.9);
}

.dark-mode .controls {
    background: rgba(45, 55, 72, 0.9);
}

.dark-mode .force-panel,
.dark-mode .export-panel,
.dark-mode .quality-panel {
    background: rgba(45, 55, 72, 0.95);
}

.dark-mode #paste-panel {
    background: rgba(45, 55, 72, 0.95);
}

.dark-mode .viz-container {
    background: #1a202c;
}
