body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #1a1a1a;
    color: #e0e0e0;
}

/* Top Bar */
#top-bar {
    background-color: #252525;
    color: #e0e0e0;
    padding: 8px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
    position: sticky;
    top: 0;
    z-index: 1000;
    height: 60px; /* Fixed height for compactness */
    box-sizing: border-box;
}

.config-item {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.config-item label {
    font-size: 0.75rem;
    margin-bottom: 2px;
    color: #aaaaaa;
}

select, input {
    padding: 6px;
    border-radius: 4px;
    border: 1px solid #444;
    background-color: #333;
    color: #fff;
    font-size: 0.9rem;
    min-width: 180px;
}

select:focus, input:focus {
    outline: none;
    border-color: #3498db;
}

.controls {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    height: 100%;
    padding-bottom: 4px; /* Align with inputs */
}

button {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
    height: 32px;
    display: flex;
    align-items: center;
}

#btn-start {
    background-color: #27ae60;
    color: white;
}

#btn-start:hover:not(:disabled) {
    background-color: #2ecc71;
}

#btn-start:disabled {
    background-color: #2c3e50;
    opacity: 0.5;
    cursor: not-allowed;
}

#btn-stop {
    background-color: #c0392b;
    color: white;
}

#btn-stop:hover:not(:disabled) {
    background-color: #e74c3c;
}

#btn-stop:disabled {
    background-color: #2c3e50;
    opacity: 0.5;
    cursor: not-allowed;
}

.status-container {
    margin-left: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-right: 10px;
}

.status-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: #7f8c8d;
    box-shadow: 0 0 5px rgba(0,0,0,0.5);
    transition: background-color 0.3s;
}

.status-dot.connected {
    background-color: #2ecc71;
    box-shadow: 0 0 10px #2ecc71;
}

.status-dot.disconnected {
    background-color: #e74c3c;
    box-shadow: 0 0 8px #e74c3c;
}

/* Main Container */
#main-container {
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

#empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 50px;
    color: #666;
    font-size: 1.2rem;
}

/* Crosspoint Box */
.xp-box {
    background: #2d2d2d;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    padding: 15px;
    border-left: 4px solid #3498db;
    transition: transform 0.2s;
    height: 280px; /* Fixed height for all boxes */
    display: flex;
    flex-direction: column;
}

.xp-box:hover {
    transform: translateY(-2px);
    background: #333;
}

.xp-source-label {
    font-size: 1.1rem;
    font-weight: bold;
    color: #ecf0f1;
    margin-bottom: 4px;
    border-bottom: 1px solid #444;
    padding-bottom: 8px;
}

.xp-source-id {
    font-size: 0.75rem;
    color: #95a5a6;
    margin-bottom: 12px;
}

.xp-destinations {
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto; /* Enable scroll if content overflows */
    flex: 1; /* Take remaining space in the box */
    padding-right: 4px; /* Space for scrollbar */
}

/* Custom Scrollbar for Dark Mode */
.xp-destinations::-webkit-scrollbar {
    width: 6px;
}

.xp-destinations::-webkit-scrollbar-track {
    background: #1a1a1a;
    border-radius: 3px;
}

.xp-destinations::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 3px;
}

.xp-destinations::-webkit-scrollbar-thumb:hover {
    background: #666;
}

.dest-item {
    background-color: #383838;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid #444;
}

.dest-label {
    font-weight: 500;
    color: #bdc3c7;
}

.dest-id {
    font-size: 0.7rem;
    color: #7f8c8d;
    font-family: monospace;
}
