* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --bg-color: #ecf0f1;
    --panel-bg: #ffffff;
    --border-color: #bdc3c7;
    --text-color: #2c3e50;
    --text-muted: #7f8c8d;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 1.5rem 2rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.subtitle {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Removed - controls now in sidebar */

.control-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 150px;
}

.control-section h3 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.control-section select,
.control-section input[type="range"] {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.9rem;
    background: white;
}

.control-section select:focus,
.control-section input:focus {
    outline: none;
    border-color: var(--secondary-color);
}

.time-slider-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.time-slider-container label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.time-slider-container input[type="range"] {
    flex: 1;
    min-width: 150px;
}

.date-navigation {
    display: flex;
    gap: 0.5rem;
}

.nav-button {
    flex: 1;
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

.primary-button {
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.primary-button:hover {
    background: #2980b9;
}

.primary-button.loading {
    background: #95a5a6;
    cursor: not-allowed;
    position: relative;
    animation: loading-pulse 1.5s infinite;
}

.primary-button.loading:hover {
    background: #95a5a6;
}

.primary-button:disabled {
    background: #95a5a6;
    cursor: not-allowed;
}

@keyframes loading-pulse {
    0% { opacity: 0.8; }
    50% { opacity: 1; }
    100% { opacity: 0.8; }
}

.secondary-button {
    background: white;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    padding: 0.6rem 1.2rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.secondary-button:hover {
    border-color: var(--secondary-color);
    color: var(--secondary-color);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.actions {
    flex-direction: row;
    align-items: flex-end;
    gap: 0.5rem;
}

.main-content {
    display: flex;
    flex: 1; /* Take all available space */
    overflow: hidden;
}

/* Fixed width sidebar with all controls */
.sidebar-panel {
    width: 320px;
    min-width: 320px;
    max-width: 320px;
    background: var(--panel-bg);
    border-right: 1px solid var(--border-color);
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.sidebar-panel::-webkit-scrollbar {
    width: 6px;
}

.sidebar-panel::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-panel::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.sidebar-header {
    text-align: center;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 5px;
}

.sidebar-header h1 {
    font-size: 18px;
    margin: 0 0 5px 0;
    color: #1a252f;  /* Darker than primary-color for better contrast */
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.sidebar-header .subtitle {
    font-size: 11px;
    color: #34495e;  /* Darker than text-muted for better readability */
    margin: 0;
    font-weight: 500;
}

.info-panel h3 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
    color: var(--primary-color);
    border-bottom: 2px solid var(--secondary-color);
    padding-bottom: 0.5rem;
}

.info-panel h4 {
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Enhanced Network Summary Styling - Improved visibility and layout */
.summary-section {
    background: transparent;
    border: none;
    margin-bottom: 1.5rem;
    padding: 0;
    overflow: visible; /* Prevent scrolling */
}

.summary-section h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--primary-color);
    border: none; /* Borderless as requested */
    padding: 0;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1); /* Subtle shadow for better visibility */
}

#network-summary {
    background: rgba(255, 255, 255, 0.95);
    border: none; /* Borderless */
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 1rem; /* Larger font for better visibility */
    line-height: 1.6;
    color: #2c3e50; /* Darker text for better contrast */
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1); /* Subtle shadow for depth */
    max-height: none; /* No height restriction to prevent scrolling */
    overflow: visible; /* Ensure no scrolling */
    white-space: nowrap; /* Keep text on one line when possible */
}

#network-summary p {
    margin: 0;
    font-size: 1rem;
    color: #2c3e50;
    font-weight: 500;
}

#network-summary strong {
    color: var(--primary-color);
    font-weight: 600;
}

.summary-section p {
    font-size: 1rem; /* Increased from 0.9rem */
    line-height: 1.6; /* Slightly tighter for compactness */
    color: #2c3e50; /* Darker for better visibility */
    font-weight: 500;
    margin: 0;
}

.legend-group {
    margin-bottom: 1rem;
}

.legend-items {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
}

.role-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-weight: bold;
    font-size: 0.75rem;
    color: white;
}

.role-badge.staff {
    background: #2c3e50;
}

.role-badge.member {
    background: #34495e;
}

.role-badge.guest {
    background: #7f8c8d;
}

.role-badge.unknown {
    background: #bdc3c7;
}

.room-color-box {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.edge-line {
    width: 30px;
    height: 3px;
    display: inline-block;
}

.edge-line.verbal {
    background: var(--secondary-color);
}

.edge-line.nonverbal {
    background: var(--text-muted);
}

.node-details {
    background: #f8f9fa;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 1rem;
}

#node-details-content {
    font-size: 0.85rem;
    line-height: 1.8;
}

#node-details-content dt {
    font-weight: 600;
    color: var(--primary-color);
    margin-top: 0.5rem;
}

#node-details-content dd {
    margin-left: 1rem;
}

.edge-details {
    background: #f8f9fa;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 1rem;
    margin-top: 1rem;
    position: relative;
}

.edge-details h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.close-button {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    line-height: 1;
}

.close-button:hover {
    color: var(--primary-color);
}

#edge-details-content {
    font-size: 0.75rem;
    line-height: 1.4;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.75rem;
    max-height: 400px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.visualization-container {
    flex: 1;
    position: relative;
    background: white;
    min-width: 0; /* Allow flex item to shrink below content size */
    height: 100%;
}

#cy {
    width: 100%;
    height: 100%;
}

.graph-controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.icon-button {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s;
}

.icon-button:hover {
    background: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
}

/* Responsive */
@media (max-width: 1200px) {
    .info-panel {
        width: 250px;
    }
}

@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }

    .sidebar-panel {
        width: 100%;
        max-width: none;
        min-width: auto;
        max-height: 300px;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .visualization-container {
        height: calc(100% - 300px);
    }
}

/* Layout Controls */
.layout-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 15px;
}

.layout-controls label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 12px;
    color: var(--text-muted);
}

.layout-controls input[type="range"] {
    width: 100%;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
}

.layout-controls input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--secondary-color);
    border-radius: 50%;
    cursor: pointer;
}

.layout-controls input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--secondary-color);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.layout-controls span {
    font-weight: 600;
    color: var(--text-color);
}

.layout-button-group {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.layout-button-group button {
    flex: 1;
    font-size: 11px;
    padding: 6px 8px;
}
