/* Override or define local variables extending Bitcoin Data Labs CSS */
:root {
    --primary-dark: #d67e54;
    --border: #E5E1DC;
}

/* Base styles for all pages */
body {
    margin: 0;
    padding: 120px 0 0 0;
    /* Account for fixed header */
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

/* INDEX PAGE STYLES */
.main-content {
    min-height: calc(100vh - 180px);
    padding-bottom: 40px;
}

.visualization-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.visualization-card {
    background: var(--surface);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(42, 51, 66, 0.05);
    padding: 24px;
    transition: all 0.2s ease;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    border: 1px solid var(--border);
}

.visualization-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(42, 51, 66, 0.08);
    border-color: var(--primary);
}

.card-title {
    font-size: 1.3em;
    margin-bottom: 12px;
    color: var(--secondary);
    font-weight: 500;
}

.card-description {
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.6;
}

.card-meta {
    color: var(--primary);
    font-size: 0.9em;
    font-weight: 500;
}

.page-header {
    text-align: center;
    padding: 40px 20px;
    background: var(--bg-primary);
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.page-header h1 {
    margin: 0;
    color: var(--secondary);
    font-weight: 500;
    font-size: 2rem;
}

.page-header p {
    color: var(--text-secondary);
    margin: 12px 0 0;
    font-size: 1.1rem;
}

/* VISUALIZATION PAGE STYLES */
/* Override Bitcoin Data Labs styles for visualization pages */
body.visualization-page {
    margin: 0 !important;
    padding: 120px 0 0 0 !important;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    background-color: var(--bg-secondary) !important;
}

/* Hide conflicting Bitcoin Data Labs elements on visualization pages */
body.visualization-page .hero-section,
body.visualization-page .section {
    display: none !important;
}

/* Make sure header elements are visible */
body.visualization-page .top-bar,
body.visualization-page .app-header {
    display: block !important;
    visibility: visible !important;
}

/* Back button for visualization pages */
.back-button {
    position: fixed;
    top: 130px;
    /* Adjusted to account for header */
    left: 20px;
    z-index: 1000;
    padding: 10px 15px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(42, 51, 66, 0.08);
}

.back-button:hover {
    background: var(--bg-primary);
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(42, 51, 66, 0.12);
}

.back-button i {
    color: var(--primary);
    margin-right: 6px;
}

/* Container and layout styles */
#container {
    display: flex;
    height: calc(100vh - 120px);
    /* Subtract header height */
}

#graph-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    background-color: var(--bg-primary);
    border-right: 1px solid var(--border);
}

#sidebar {
    width: 300px;
    padding: 20px;
    background-color: var(--surface);
    box-shadow: -2px 0 8px rgba(42, 51, 66, 0.08);
    overflow-y: auto;
}

#search-container {
    margin-bottom: 20px;
}

#search-input {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 14px;
    background-color: var(--surface);
    color: var(--text-primary);
    transition: border-color 0.2s ease;
}

#search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(232, 145, 107, 0.1);
}

.search-wrapper {
    position: relative;
    width: 100%;
}

.search-info {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    cursor: help;
}

.search-info i:hover {
    color: var(--primary);
}

.search-tooltip {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 12px;
    color: var(--text-primary);
    box-shadow: 0 4px 12px rgba(42, 51, 66, 0.15);
    width: 250px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
}

.search-info:hover .search-tooltip,
.search-info i:focus+.search-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#node-info {
    padding: 15px;
    background-color: var(--bg-primary);
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid var(--primary);
    box-shadow: 0 2px 4px rgba(42, 51, 66, 0.05);
}

#edge-info {
    padding: 15px;
    background-color: var(--bg-primary);
    border-radius: 8px;
    border-left: 4px solid var(--accent-cool);
    box-shadow: 0 2px 4px rgba(42, 51, 66, 0.05);
}

.info-title {
    font-weight: 500;
    margin-bottom: 10px;
    color: var(--secondary);
    font-size: 16px;
}

.info-content {
    margin-bottom: 5px;
    font-size: 14px;
    color: var(--text-primary);
}

.tooltip {
    position: absolute;
    top: 0;
    left: 0;
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    font-size: 12px;
    pointer-events: none;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(42, 51, 66, 0.15);
    max-width: 300px;
    display: none;
    color: var(--text-primary);
}

.controls {
    position: absolute;
    bottom: 20px;
    left: 20px;
    z-index: 100;
    display: flex;
    gap: 12px;
}

.control-btn {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(42, 51, 66, 0.08);
    transition: all 0.2s ease;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
}

.control-btn:hover {
    background-color: var(--bg-primary);
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(42, 51, 66, 0.12);
}

.control-btn i {
    margin-right: 6px;
    color: var(--primary);
}

/* Make layout button match Load Dataset button style */
#toggle-layout {
    background: var(--primary);
    color: white;
    font-size: 14px;
    font-weight: 500;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    min-width: 160px;
    box-shadow: 0 2px 8px rgba(232, 145, 107, 0.3);
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

#toggle-layout:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(232, 145, 107, 0.3);
}

#toggle-layout i {
    color: white;
    margin-right: 8px;
}

/* Subtle hint text for layout button */
.layout-hint {
    position: absolute;
    bottom: 80px;
    left: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 12px;
    color: var(--text-secondary);
    box-shadow: 0 2px 8px rgba(42, 51, 66, 0.08);
    z-index: 99;
    opacity: 0.8;
    animation: fadeInOut 4s ease-in-out infinite;
    max-width: 200px;
}

.layout-hint::before {
    content: "💡";
    margin-right: 4px;
}

@keyframes fadeInOut {

    0%,
    100% {
        opacity: 0.8;
    }

    50% {
        opacity: 0.4;
    }
}

/* Network Summary Box */
.network-summary {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 1500;
    transition: all 0.3s ease;
}

.network-summary:hover {
    transform: translateY(-1px);
}

.summary-title {
    color: var(--secondary);
    font-weight: 600;
    font-size: 18px;
    margin: 0 0 6px 0;
    line-height: 1.2;
    display: flex;
    align-items: center;
    gap: 8px;
}

.summary-title i {
    color: var(--primary);
    font-size: 20px;
}

.summary-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 400;
    margin: 0;
    line-height: 1.4;
}

.summary-subtitle span {
    color: var(--primary);
    font-weight: 600;
}

.legend {
    position: absolute;
    top: 20px;
    right: 20px;
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 4px 12px rgba(42, 51, 66, 0.08);
    z-index: 100;
}

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

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    margin-right: 10px;
    border: 1px solid var(--border);
}

.legend-text {
    font-size: 12px;
    color: var(--text-primary);
}

#stats {
    margin-top: 20px;
    padding: 20px;
    background-color: var(--bg-primary);
    border-radius: 8px;
    font-size: 15px;
    border: 1px solid var(--border);
    box-shadow: 0 2px 4px rgba(42, 51, 66, 0.05);
    line-height: 1.6;
}

.stats-title {
    font-weight: 600;
    margin-bottom: 18px;
    color: var(--secondary);
    font-size: 1.25em;
}

.stats-section {
    margin-bottom: 18px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 14px;
}

.stats-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.stats-subtitle {
    font-weight: 600;
    font-size: 1.05em;
    color: var(--primary);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#stats div {
    margin-bottom: 8px;
    font-size: 1em;
    color: var(--text-primary);
}

#stats .stats-title {
    font-size: 1.25em;
    margin-bottom: 18px;
}

/* Dataset Switcher Component */
.dataset-switcher {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
}

.dataset-tooltip {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(253, 251, 249, 0.95);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 11px;
    line-height: 1.4;
    box-shadow: 0 2px 8px rgba(42, 51, 66, 0.15);
    z-index: 1000;
    display: none;
    white-space: nowrap;
    pointer-events: none;
}

.dataset-switcher label {
    display: block;
    font-weight: 500;
    color: var(--secondary);
    margin-bottom: 8px;
    font-size: 14px;
}

.dataset-switcher label i {
    color: var(--primary);
    margin-right: 6px;
}

.dataset-switcher label i.fa-info-circle {
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12px;
}

.dataset-switcher label i.fa-info-circle:hover,
.dataset-switcher label i.fa-info-circle:focus {
    color: var(--primary);
}

.dataset-switcher select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background-color: var(--surface);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    margin-bottom: 10px;
    transition: border-color 0.2s ease;
}

.dataset-switcher select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(232, 145, 107, 0.1);
}

.dataset-switcher button {
    width: 100%;
    padding: 10px 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.dataset-switcher button:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(232, 145, 107, 0.3);
}

.dataset-switcher button i {
    font-size: 13px;
}

/* Filters Section */
#filters {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
}

.filters-title {
    font-weight: 500;
    color: var(--secondary);
    margin-bottom: 16px;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.filters-title i {
    color: var(--primary);
}

.filter-section {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.filter-section:last-of-type {
    border-bottom: none;
}

.filter-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--secondary);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-label i {
    color: var(--primary);
    font-size: 12px;
}

.filter-control {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    padding: 4px 0;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary);
}

.checkbox-label:hover {
    color: var(--secondary);
}

/* Segmented Control Styling */
.segmented-control {
    display: flex;
    flex-direction: row;
    background-color: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2px;
    gap: 0;
}

.segmented-control input[type="radio"] {
    display: none;
}

.segmented-control label {
    flex: 1;
    text-align: center;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.segmented-control label:hover {
    color: var(--text-primary);
}

.segmented-control input[type="radio"]:checked+label {
    background-color: var(--primary);
    color: white;
    box-shadow: 0 2px 4px rgba(232, 145, 107, 0.2);
}

/* Range slider styling */
input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--border);
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    margin: 8px 0;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: 2px solid var(--surface);
    box-shadow: 0 2px 4px rgba(42, 51, 66, 0.2);
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: 2px solid var(--surface);
    box-shadow: 0 2px 4px rgba(42, 51, 66, 0.2);
}

input[type="range"]::-webkit-slider-thumb:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
}

input[type="range"]::-moz-range-thumb:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
}

.filter-value {
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    color: var(--primary);
    margin-top: 4px;
}

.filter-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.filter-btn {
    flex: 1;
    padding: 10px 14px;
    border: none;
    border-radius: 6px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.filter-btn {
    background: var(--primary);
    color: white;
}

.filter-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(232, 145, 107, 0.3);
}

.filter-btn.secondary {
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.filter-btn.secondary:hover {
    background: var(--bg-primary);
    border-color: var(--primary);
}

.filter-results {
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.filter-results span {
    font-weight: 500;
    color: var(--primary);
}

/* Mobile responsiveness */
@media screen and (max-width: 768px) {

    body,
    body.visualization-page {
        padding-top: 120px !important;
        /* More space for mobile header */
    }

    .visualization-grid {
        grid-template-columns: 1fr;
        padding: 10px;
    }

    .page-header {
        padding: 20px 10px;
    }

    .page-header h1 {
        font-size: 1.5rem;
    }

    #container {
        height: calc(100vh - 120px);
        flex-direction: column;
    }

    #sidebar {
        width: 100%;
        height: 200px;
        order: 2;
        box-shadow: 0 -2px 8px rgba(42, 51, 66, 0.08);
    }

    #graph-container {
        order: 1;
        height: calc(100vh - 320px);
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    /* Responsive summary title */
    .network-summary {
        top: 10px;
        left: 10px;
    }

    .summary-title {
        font-size: 16px;
    }

    .summary-subtitle {
        font-size: 12px;
    }

    .controls {
        bottom: 10px;
        left: 10px;
        gap: 8px;
    }

    .control-btn {
        padding: 8px 10px;
        font-size: 12px;
    }

    .legend {
        top: 10px;
        right: 10px;
        padding: 8px;
    }

    .back-button {
        top: 130px;
        left: 10px;
        padding: 8px 12px;
        font-size: 14px;
    }
}

@media screen and (max-width: 480px) {
    .controls {
        flex-wrap: wrap;
    }

    .control-btn {
        padding: 6px 8px;
        font-size: 11px;
    }

    .legend {
        font-size: 10px;
    }
}