/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Filter styles */
.filter-container {
    background-color: #fff;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.filter-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
    margin-bottom: 10px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 150px;
}

.filter-group label {
    font-size: 0.9em;
    color: #666;
}

.filter-group select {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    font-size: 0.9em;
}

.record-count {
    color: #666;
    font-size: 0.9em;
    text-align: right;
}

/* Header styles */
header {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

header h1 {
    margin-bottom: 15px;
    color: #2c3e50;
}

.controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Button styles */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    background-color: #3498db;
    color: white;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn:hover {
    background-color: #2980b9;
}

.btn-danger {
    background-color: #e74c3c;
}

.btn-danger:hover {
    background-color: #c0392b;
}

.btn-success {
    background-color: #27ae60;
}

.btn-success:hover {
    background-color: #219a52;
}

/* Auto-refresh toggle */
.auto-refresh {
    display: flex;
    align-items: center;
    gap: 5px;
}

.last-update {
    color: #666;
    font-size: 0.9em;
}

/* Status table styles */
.status-container {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.status-table {
    width: 100%;
    border-collapse: collapse;
}

.status-table th,
.status-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.status-table th {
    background-color: #f8f9fa;
    font-weight: 600;
}

.status-table tr:hover {
    background-color: #f8f9fa;
}

/* Type badges */
.type-badge {
    display: inline-block;
    font-size: 0.8em;
    padding: 1px 4px;
    margin-right: 4px;
    border-radius: 3px;
    background-color: #333;
    color: white;
    font-weight: bold;
}

/* Status indicators */
.status {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.status-running {
    background-color: #27ae60;
    color: white;
}

.status-stopped {
    background-color: #95a5a6;
    color: white;
}

.status-crashed {
    background-color: #e74c3c;
    color: white;
}

/* Mini-list for recent songs */
.mini-list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.85em;
}

.mini-list li {
    padding: 3px 0;
    border-bottom: 1px solid #eee;
}

.mini-list li:last-child {
    border-bottom: none;
}

.mini-list .song-time {
    color: #666;
    font-size: 0.9em;
}

/* Source and sender status indicators */
.detail-status {
    display: inline-block;
    padding: 3px 6px;
    border-radius: 3px;
    font-size: 0.85em;
    font-weight: 500;
}

.status-ok {
    background-color: #d4edda;
    color: #155724;
}

.status-warning {
    background-color: #fff3cd;
    color: #856404;
}

.status-error {
    background-color: #f8d7da;
    color: #721c24;
}

/* Responsive adjustments for new columns */
@media (max-width: 992px) {
    .status-table th:nth-child(4),
    .status-table td:nth-child(4) {
        max-width: 150px;
    }
    
    .mini-list {
        font-size: 0.8em;
    }
}

@media (max-width: 768px) {
    .status-table th:nth-child(5),
    .status-table td:nth-child(5),
    .status-table th:nth-child(6),
    .status-table td:nth-child(6) {
        display: none;
    }
}

/* Error container */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.toast {
    padding: 12px 24px;
    margin-bottom: 10px;
    border-radius: 4px;
    color: white;
    opacity: 0;
    transform: translateX(100%);
    animation: slideIn 0.3s ease forwards;
}

.toast.success {
    background-color: #4caf50;
}

.toast.error {
    background-color: #f44336;
}

.toast.show {
    display: block;
}

.toast.hide {
    animation: slideOut 0.3s ease forwards;
}

@keyframes slideIn {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOut {
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

.error-container {
    margin-bottom: 20px;
    padding: 12px;
    border-radius: 4px;
    background-color: #fee;
    color: #e74c3c;
    display: none;
}

.error-container.visible {
    display: block;
}

/* Footer styles */
footer {
    margin-top: 20px;
    text-align: center;
    color: #666;
    font-size: 0.9em;
}

/* Command menu styles */
.command-menu {
    position: absolute;
    background: white;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    padding: 8px 0;
    z-index: 1000;
    min-width: 150px;
    display: none;
}

.command-menu.visible {
    display: block;
    animation: fadeIn 0.2s ease-out;
}

.command-menu-item {
    padding: 8px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #333;
    transition: background-color 0.2s;
}

.command-menu-item:hover {
    background-color: #f5f5f5;
}

.command-menu-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
    color: #999;
}

.command-menu-item.disabled i {
    opacity: 0.5;
}

.command-menu-item i {
    font-size: 16px;
    width: 16px;
    text-align: center;
    display: inline-block;
    margin-right: 8px;
}

/* Clickable name styles */
.clickable-name {
    cursor: pointer;
    position: relative;
}

.clickable-name:hover {
    color: #2980b9;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Action buttons container - for backward compatibility */
.actions {
    display: none;
}

/* Sortable table styles */
.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 25px !important;
}

.sortable:hover {
    background-color: #edf2f7;
}

.sort-indicator {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
}

.sortable[data-sort-dir="asc"] .sort-indicator {
    border-bottom: 5px solid #666;
    border-top: none;
}

.sortable[data-sort-dir="desc"] .sort-indicator {
    border-top: 5px solid #666;
    border-bottom: none;
}

.sortable:not([data-sort-dir]) .sort-indicator {
    border-bottom: 5px solid #ccc;
    opacity: 0.5;
}

.sortable:hover .sort-indicator {
    opacity: 1;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .status-table {
        display: block;
        overflow-x: auto;
    }

    .controls {
        flex-wrap: wrap;
    }
}

/* Loading indicator */
.loading {
    opacity: 0.5;
    pointer-events: none;
}

/* Animation for data updates */
@keyframes highlight {
    0% { background-color: #fff; }
    50% { background-color: #e3f2fd; }
    100% { background-color: #fff; }
}

.highlight {
    animation: highlight 1s ease-in-out;
}
