/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #3498db;
    --secondary-color: #2ecc71;
    --danger-color: #e74c3c;
    --dark-bg: #2c3e50;
    --light-bg: #ecf0f1;
    --border-color: #bdc3c7;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --hover-color: #34495e;
    --sidebar-width: 200px;
    --toolbar-height: 60px;
    --statusbar-height: 45px;
    --ad-banner-height: 90px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    overflow: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--light-bg);
}

/* Header */
.header {
    height: var(--toolbar-height);
    background-color: var(--dark-bg);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
}

.app-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

/* Main Content Area */
.main-content {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Left Sidebar */
.left-sidebar {
    width: var(--sidebar-width);
    background-color: white;
    border-right: 1px solid var(--border-color);
    overflow: hidden;
    box-shadow: 2px 0 4px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
}

/* Sidebar Tabs */
.sidebar-tabs {
    display: flex;
    background-color: var(--light-bg);
    border-bottom: 2px solid var(--border-color);
}

.sidebar-tab {
    flex: 1;
    padding: 12px 15px;
    background-color: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.sidebar-tab:hover {
    background-color: rgba(52, 152, 219, 0.1);
    color: var(--text-primary);
}

.sidebar-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background-color: white;
}

/* Tab Content */
.sidebar-tab-content {
    flex: 1;
    overflow-y: auto;
    position: relative;
}

.tab-panel {
    display: none;
    height: 100%;
}

.tab-panel.active {
    display: block;
}

.tool-palette {
    padding: 15px;
}

.tool-palette h3 {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 10px;
    text-transform: uppercase;
    font-weight: 600;
}

.tool-btn {
    width: 100%;
    padding: 12px;
    margin-bottom: 8px;
    background-color: white;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text-primary);
    transition: all 0.2s;
}

.tool-btn span:first-child {
    font-size: 20px;
}

.tool-btn:hover {
    background-color: var(--light-bg);
    border-color: var(--primary-color);
}

.tool-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.tool-separator {
    height: 1px;
    background-color: var(--border-color);
    margin: 15px 0;
}

/* Canvas Container */
.canvas-container {
    flex: 1;
    position: relative;
    background-color: #f8f9fa;
    background-image: 
        linear-gradient(rgba(0,0,0,.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,0,0,.05) 1px, transparent 1px);
    background-size: 20px 20px;
    overflow: hidden;
}

.graph-canvas {
    width: 100%;
    height: 100%;
    cursor: default;
}

.graph-canvas.adding-node {
    cursor: crosshair;
}

.graph-canvas.adding-edge {
    cursor: pointer;
}

.graph-canvas.panning {
    cursor: grab;
}

.graph-canvas.panning:active {
    cursor: grabbing;
}

/* Right Sidebar */
.right-sidebar {
    width: 300px;
    background-color: white;
    border-left: 1px solid var(--border-color);
    overflow-y: auto;
    box-shadow: -2px 0 4px rgba(0,0,0,0.05);
    transition: transform 0.3s;
}

.right-sidebar.hidden {
    transform: translateX(100%);
    width: 0;
}

/* Status Bar - TWO LINE LAYOUT */
.status-bar {
    height: var(--statusbar-height);
    background-color: var(--dark-bg);
    color: #ecf0f1;
    display: flex;
    flex-direction: column;  /* CHANGED: Stack lines vertically */
    justify-content: space-around;  /* CHANGED: Distribute space between lines */
    padding: 4px 20px;  /* CHANGED: Reduced vertical padding */
    font-size: 12px;
    box-shadow: 0 -2px 4px rgba(0,0,0,0.1);
}

/* Status Line Container */
.status-line {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

/* Line 1: Selection and Details */
.status-line-selection {
    font-weight: 500;
    color: #ecf0f1;
}

/* Line 2: Stats */
.status-line-stats {
    color: #bdc3c7;
}

.status-bar .separator {
    color: var(--border-color);
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-overlay.hidden {
    display: none;
}

.spinner {
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    padding: 20px;
    z-index: 2000;
    pointer-events: none;
}

.modal-content {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    min-width: 400px;
    max-width: 600px;
    pointer-events: auto;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--danger-color);
}

.modal-body {
    padding: 20px;
}

.export-option {
    width: 100%;
    padding: 15px;
    margin-bottom: 10px;
    background-color: white;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    transition: all 0.2s;
}

.export-option:hover {
    background-color: var(--light-bg);
    border-color: var(--primary-color);
}

.export-option span {
    font-size: 24px;
}

.modal-btn {
    width: 100%;
    padding: 12px;
    margin-top: 10px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background-color 0.2s;
}

.modal-btn:hover {
    background-color: #2980b9;
}

.modal-btn:disabled {
    background-color: var(--border-color);
    cursor: not-allowed;
}

.property-item {
    margin-bottom: 15px;
}

.property-label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
}

.property-input {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
}

.path-info {
    margin: 20px 0;
    padding: 15px;
    background-color: var(--light-bg);
    border-radius: 6px;
}

.path-info div {
    margin-bottom: 8px;
    font-size: 14px;
}

.path-info span {
    font-weight: 600;
    color: var(--primary-color);
}

/* Position path modal in top-right corner */
#path-modal {
    align-items: flex-start;
    justify-content: flex-end;
}

#path-modal .modal-content {
    margin-top: 80px;
    margin-right: 20px;
    min-width: 350px;
    max-width: 350px;
}

/* SVG Styles */
.node {
    cursor: pointer;
    transition: all 0.2s ease;
}

.node circle {
    stroke: #fff;
    stroke-width: 2px;
    transition: all 0.2s ease;
}

.node:hover circle {
    stroke-width: 3px;
    filter: drop-shadow(0 0 3px rgba(52, 152, 219, 0.5));
}

.node.selected circle {
    stroke: #f39c12;
    stroke-width: 5px;
    filter: drop-shadow(0 0 8px rgba(243, 156, 18, 0.8));
    animation: selection-pulse 0.3s ease;
}

@keyframes selection-pulse {
    0% { stroke-width: 2px; }
    50% { stroke-width: 7px; }
    100% { stroke-width: 5px; }
}

.node.highlighted circle {
    stroke: #e74c3c;
    stroke-width: 4px;
}

.node.path-highlight circle {
    stroke: #2ecc71;
    stroke-width: 4px;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { stroke-width: 4px; }
    50% { stroke-width: 6px; }
}

.node text {
    font-size: 12px;
    font-family: inherit;
    pointer-events: none;
    user-select: none;
}

/* Edge styles */
.edge {
    transition: all 0.2s ease;
}

.edge path:first-child {
    transition: all 0.2s ease;
}

.edge:hover path:first-child {
    stroke-width: 3px !important;
    filter: drop-shadow(0 0 2px rgba(52, 152, 219, 0.6));
}

/* Edge selection - CONSOLIDATED RULES */
.edge.selected path:first-child {
    stroke: #f39c12 !important;
    stroke-width: 3px !important;
    filter: drop-shadow(0 0 4px rgba(243, 156, 18, 0.6)) !important;
    animation: edge-selection-pulse 0.3s ease;
}

@keyframes edge-selection-pulse {
    0% { stroke-width: 2px !important; }
    50% { stroke-width: 4px !important; }
    100% { stroke-width: 3px !important; }
}

.edge.selected .edge-label {
    /* Keep label styling normal - no changes */
}

.edge.highlighted path:first-child {
    stroke-width: 4px;
    filter: drop-shadow(0 0 3px rgba(231, 76, 60, 0.8));
}

.edge.path-highlight path:first-child {
    stroke-width: 4px;
    stroke: #2ecc71 !important;
    animation: dash 1s linear infinite;
}

@keyframes dash {
    to {
        stroke-dashoffset: -20;
    }
}

.edge {
    fill: none;
    stroke-width: 2px;
    cursor: pointer;
}

.edge.highlighted {
    stroke-width: 4px;
    filter: drop-shadow(0 0 3px rgba(231, 76, 60, 0.8));
}

.edge.path-highlight {
    stroke-width: 4px;
    stroke: #2ecc71 !important;
    animation: dash 1s linear infinite;
}

.edge-arrow {
    fill: currentColor;
}

/* Edge Labels */
.edge-label {
    font-size: 10px;
    fill: #7f8c8d;
    font-weight: 600;
    pointer-events: none;
    user-select: none;
}

.edge.highlighted .edge-label {
    fill: #e74c3c;
    font-weight: 700;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--light-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Feature 6: Drag and Drop Styles */
.canvas-container.drag-over {
    background-color: rgba(52, 152, 219, 0.1);
    border: 3px dashed var(--primary-color);
}

.canvas-container::after {
    content: 'Drop JSON file here to open';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    color: var(--primary-color);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.canvas-container.drag-over::after {
    opacity: 1;
}

/* Feature 8: Color Palette Styles */
.color-palette {
    display: flex;
    gap: 8px;
    margin: 10px 0;
    flex-wrap: wrap;
}

.color-swatch {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.color-swatch:hover {
    border-color: var(--text-primary);
    transform: scale(1.1);
}

.color-swatch.active {
    border-color: var(--primary-color);
    border-width: 3px;
    transform: scale(1.15);
}

/* Connect by Click Mode Cursor */
.graph-canvas.connecting {
    cursor: crosshair !important;
}

.graph-canvas.connecting .node {
    cursor: crosshair !important;
}

/* Force Control Slider */
.force-control {
    padding: 15px;
    background-color: var(--light-bg);
    border-radius: 6px;
    margin: 10px 15px;
}

.force-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.force-label span:first-child {
    display: flex;
    align-items: center;
    gap: 6px;
}

.force-value {
    color: var(--primary-color);
    font-size: 16px;
}

.force-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, #95a5a6, var(--primary-color));
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.force-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s;
}

.force-slider::-webkit-slider-thumb:hover {
    background: var(--hover-color);
    transform: scale(1.1);
}

.force-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s;
}

.force-slider::-moz-range-thumb:hover {
    background: var(--hover-color);
    transform: scale(1.1);
}

.force-hints {
    display: flex;
    justify-content: space-between;
    margin-top: 5px;
    font-size: 11px;
    color: var(--text-secondary);
}
/* Path Results Styles */
.path-results-container {
    margin-top: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.path-results-summary {
    padding: 12px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 14px;
}

.path-result-item {
    padding: 12px;
    margin-bottom: 10px;
    background-color: var(--light-bg);
    border: 2px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.path-result-item:hover {
    background-color: #e0e4e8;
    border-color: var(--primary-color);
}

.path-result-item.active {
    background-color: rgba(52, 152, 219, 0.1);
    border-color: var(--primary-color);
    border-width: 3px;
}

.path-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 14px;
}

.path-shortest-badge {
    background-color: var(--secondary-color);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.path-result-details {
    font-size: 13px;
    color: var(--text-primary);
}

.path-result-details > div {
    margin-bottom: 6px;
}

.path-route {
    margin-top: 8px;
    padding: 8px;
    background-color: white;
    border-radius: 4px;
    font-family: monospace;
    font-size: 12px;
    word-break: break-word;
}

/* Distance-based Dimming Styles */
.node.dimmed {
    opacity: 0.15;
    pointer-events: none;
}

.node.dimmed circle {
    stroke-width: 1px;
}

.node.dimmed text {
    opacity: 0.1;
}

.edge.dimmed {
    opacity: 0.15;
    pointer-events: none;
}

.edge.dimmed path {
    stroke-width: 1px !important;
}

.edge.dimmed .edge-label {
    opacity: 0.1;
}

/* Ensure highlighted/selected nodes are NOT dimmed */
.node.highlighted.dimmed,
.node.selected.dimmed {
    opacity: 1;
    pointer-events: all;
}

.node.highlighted.dimmed circle,
.node.selected.dimmed circle {
    stroke-width: 4px;
}

.edge.highlighted.dimmed,
.edge.selected.dimmed {
    opacity: 1;
    pointer-events: all;
}
/* Google AdSense Banner */
.ad-banner-container {
    height: var(--ad-banner-height);
    background-color: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    border-top: 1px solid var(--border-color);
    overflow: hidden;
    flex-shrink: 0;
}

.ad-banner {
    max-width: 728px;
    width: 100%;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Responsive: hide ad on small screens */
@media (max-width: 768px) {
    .ad-banner-container {
        display: none;
    }
}

/* Ensure ad doesn't overflow on medium screens */
@media (max-width: 1024px) and (min-width: 769px) {
    .ad-banner {
        max-width: 468px;
    }
    
    .ad-banner ins.adsbygoogle {
        width: 468px !important;
        height: 60px !important;
    }
}

/* Privacy Banner Styles */
.privacy-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    z-index: 9999;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    animation: slideDown 0.4s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.privacy-banner.hidden {
    display: none;
}

.privacy-banner-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 30px;
    max-width: 1400px;
    margin: 0 auto;
}

.privacy-banner-text {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    line-height: 1.5;
}

.privacy-icon {
    font-size: 24px;
}

.privacy-banner-dismiss {
    padding: 8px 20px;
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
    white-space: nowrap;
}

.privacy-banner-dismiss:hover {
    background-color: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.6);
    transform: translateY(-1px);
}

.privacy-banner-dismiss:active {
    transform: translateY(0);
}

/* Status Bar Privacy Link */
.status-privacy {
    cursor: pointer;
    transition: all 0.2s;
    padding: 4px 8px;
    border-radius: 4px;
}

.status-privacy:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #2ecc71;
}

/* Privacy Info Modal Styles */
#privacy-modal .modal-content {
    max-width: 600px;
}

.privacy-info-section {
    margin-bottom: 20px;
    padding: 15px;
    background-color: var(--light-bg);
    border-radius: 6px;
    border-left: 4px solid var(--primary-color);
}

.privacy-info-section h4 {
    margin: 0 0 10px 0;
    color: var(--primary-color);
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.privacy-info-section p {
    margin: 0;
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 14px;
}

.privacy-info-footer {
    background-color: rgba(46, 204, 113, 0.1);
    border-left-color: var(--secondary-color);
    text-align: center;
}

.privacy-info-footer p {
    color: var(--secondary-color);
    font-weight: 600;
}

/* Adjust main content when banner is visible */
body.privacy-banner-visible .header {
    margin-top: 60px;
}

body.privacy-banner-visible .main-content {
    height: calc(100vh - var(--toolbar-height) - var(--statusbar-height) - 60px);
}