/* Import Bitcoin Data Labs CSS variables */
:root {
    --primary: #E8916B;
    --secondary: #2A3342;
    --accent-cool: #8BBEDC;
    --accent-warm: #F4C2A1;
    --bg-primary: #FDFBF9;
    --bg-secondary: #F5F1EE;
    --text-primary: #2A3342;
    --text-secondary: #5F6C7E;
    --surface: #FFFFFF;
    --border: #E5E1DC;
    --bitcoin-orange: #f7931a;
}

/* 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: 10px;
    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);
}

#node-info {
    padding: 16px;
    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: 16px;
    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: 12px;
    color: var(--secondary);
    font-size: 16px;
}

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

.info-label {
    font-weight: 500;
    color: var(--text-secondary);
}

.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 prominent - cleaned up version */
#toggle-layout {
    background: linear-gradient(135deg, var(--bitcoin-orange), #ff9500);
    color: white;
    font-size: 1.1em;
    font-weight: 600;
    padding: 14px 24px;
    border: none;
    min-width: 160px;
    box-shadow: 0 4px 16px rgba(247, 147, 26, 0.25);
}

#toggle-layout:hover {
    background: linear-gradient(135deg, #ff9500, var(--bitcoin-orange));
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(247, 147, 26, 0.35);
}

#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; }
}


.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);
}

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

.header h1 {
    margin: 0;
    font-size: 18px;
    color: var(--secondary);
    font-weight: 500;
}

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

#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;
}

/* 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);
    }
    
    .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;
    }
}