:root {
    --bg-color: #0f172a;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --accent-color: #38bdf8;
    --success-color: #4ade80;
    --error-color: #f87171;
    --offline-color: #64748b;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    background-image:
        radial-gradient(at 0% 0%, rgba(56, 189, 248, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(168, 85, 247, 0.15) 0px, transparent 50%);
}

.app-container {
    max-width: 95%;
    margin: 0 auto;
    padding: 2rem;
}

/* Header */
.glass-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

h1 {
    font-weight: 600;
    font-size: 1.5rem;
    letter-spacing: -0.025em;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--success-color);
    box-shadow: 0 0 8px var(--success-color);
    animation: pulse 2s infinite;
}

/* Search */
.search-container {
    padding: 1.5rem 1.5rem 0 1.5rem;
}

#search-input {
    max-width: 250px;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    transition: all 0.2s;
}

#search-input::placeholder {
    color: var(--text-secondary);
}

#search-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.1);
}

/* Table Panel */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    table-layout: fixed;
}

th {
    padding: 1.25rem 1.0rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    font-weight: 600;
    border-bottom: 1px solid var(--glass-border);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Column Widths */
/* Location - auto width */
th:nth-child(1),
td:nth-child(1) {
    width: auto;
}

/* Status - fixed for 4 status dots */
th:nth-child(2),
td:nth-child(2) {
    width: 110px;
    align-items: center;
}

/* Current Song - artist and title */
th:nth-child(3),
td:nth-child(3) {
    width: auto;
    max-width: 400px;
}

/* Duration - ~11 characters */
th:nth-child(4),
td:nth-child(4) {
    width: 110px;
    align-items: center;
}

/* Next Song - artist and title */
th:nth-child(5),
td:nth-child(5) {
    width: auto;
    max-width: 400px;
}

/* Last Update - ~11 characters */
th:nth-child(6),
td:nth-child(6) {
    width: 140px;
}

td {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: background-color 0.2s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

tr:last-child td {
    border-bottom: none;
}

tbody tr:hover td {
    background-color: rgba(255, 255, 255, 0.02);
}

/* Status Indicators */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-online {
    background-color: var(--success-color);
    box-shadow: 0 0 6px rgba(74, 222, 128, 0.4);
}

.status-offline {
    background-color: var(--offline-color);
}

.status-audio-active {
    background-color: var(--success-color);
    box-shadow: 0 0 6px rgba(74, 222, 128, 0.4);
}

.status-audio-inactive {
    background-color: var(--offline-color);
}

.status-reboot {
    background-color: #fb923c;
    box-shadow: 0 0 6px rgba(251, 146, 60, 0.4);
}

.status-reboot-inactive {
    background-color: var(--offline-color);
}

.notifier-dot {
    cursor: pointer;
    transition: all 0.2s;
}

.notifier-dot:hover {
    transform: scale(1.5);
}

.notifier-on {
    background-color: var(--success-color);
    box-shadow: 0 0 6px rgba(74, 222, 128, 0.4);
}

.notifier-off {
    background-color: var(--offline-color);
}

.duration-text {
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.timestamp {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }

    100% {
        opacity: 1;
    }
}

/* Expandable Rows */
.details-row {
    background-color: rgba(0, 0, 0, 0.2);
}

.details-row td {
    padding: 0;
    border-bottom: 1px solid var(--glass-border);
}

.details-content {
    height: 0;
    overflow: hidden;
    transition: height 0.3s ease-out;
}

.details-content.expanded {
    height: 500px;
    /* Fixed height for iframe */
}

.iframe-wrapper {
    height: 100%;
    padding: 1rem;
}

iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 8px;
    background: #fff;
    /* Ensure iframe content has background if transparent */
}

.location-link {
    color: var(--accent-color);
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: text-decoration 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.location-link::after {
    content: '▼';
    font-size: 0.7em;
    transition: transform 0.3s;
}

.location-link.active::after {
    transform: rotate(180deg);
}

.location-link:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
    .app-container {
        padding: 1rem;
    }

    th,
    td {
        padding: 1rem;
    }

    .glass-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .search-container {
        padding: 1rem 1rem 0 1rem;
    }

    #search-input {
        max-width: 100%;
    }

    .details-content.expanded {
        height: 400px;
    }
}