:root {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-tertiary: #3a3a3a;
    --bg-card: #252525;
    --border-color: #404040;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --text-muted: #808080;
    --accent-primary: #007acc;
    --accent-hover: #005a99;
    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
    --info: #17a2b8;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    margin-bottom: 2rem;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header h1 {
    color: var(--text-primary);
    font-size: 1.5rem;
}

.mobile-dashboard-icon {
    display: none;
    font-size: 1.5rem;
    text-decoration: none;
    padding: 8px;
    border-radius: 6px;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.mobile-dashboard-icon:hover {
    background-color: var(--accent-primary);
    transform: scale(1.05);
}

.nav-links {
    display: flex;
    gap: 1rem;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.nav-links a:hover,
.nav-links a.active {
    background-color: var(--accent-primary);
    color: var(--text-primary);
}

/* Cards */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.settings-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.settings-card h2 {
    color: var(--text-primary);
    margin-bottom: 15px;
    font-size: 1.2rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.card-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.card-header-flex h2 {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

/* Forms */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    color: var(--text-secondary);
    margin-bottom: 5px;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 10px;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(0, 122, 204, 0.2);
}

.form-control::placeholder {
    color: var(--text-muted);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    text-align: center;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-primary {
    background-color: var(--accent-primary);
    color: var(--text-primary);
}

.btn-primary:hover {
    background-color: var(--accent-hover);
}

.btn-secondary {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--bg-secondary);
}

.btn-success {
    background-color: var(--success);
    color: white;
}

.btn-success:hover {
    background-color: #218838;
}

.btn-danger {
    background-color: var(--danger);
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
}

.btn-warning {
    background-color: var(--warning);
    color: #212529;
}

.btn-warning:hover {
    background-color: #e0a800;
}

.btn-small {
    padding: 6px 10px;
    font-size: 12px;
}

/* Status indicators */
.status-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.indicator.online {
    background-color: var(--success);
    box-shadow: 0 0 6px rgba(40, 167, 69, 0.6);
}

.indicator.offline {
    background-color: var(--danger);
    box-shadow: 0 0 6px rgba(220, 53, 69, 0.6);
}

.indicator.connecting {
    background-color: var(--warning);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Tables */
.table-container {
    overflow-x: auto;
    margin-top: 10px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--bg-tertiary);
    border-radius: 6px;
    overflow: hidden;
}

.data-table th,
.data-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-weight: 600;
}

.data-table td {
    color: var(--text-secondary);
}

.data-table tr:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.active-row {
    background-color: rgba(0, 122, 204, 0.1);
}

/* Status badges */
.status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.active {
    background-color: rgba(40, 167, 69, 0.2);
    color: var(--success);
}

.status-badge.inactive {
    background-color: rgba(108, 117, 125, 0.2);
    color: var(--text-muted);
}

/* Action buttons */
.action-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

.connection-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Log display */
.log-container {
    max-height: 400px;
    overflow-y: auto;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 15px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.4;
}

.log-entry {
    padding: 2px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
}

.log-entry:last-child {
    border-bottom: none;
}

/* Stats display */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.stat-item {
    background-color: var(--bg-tertiary);
    padding: 15px;
    border-radius: 6px;
    text-align: center;
    border: 1px solid var(--border-color);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--accent-primary);
    display: block;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 5px;
}

/* Source items */
.source-item {
    display: flex;
    align-items: center;
    padding: 10px;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.source-item:hover {
    background-color: var(--bg-secondary);
}

.source-item.disabled {
    opacity: 0.6;
}

.source-content {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.source-icon {
    font-size: 1.2rem;
}

.source-details {
    flex: 1;
}

.source-name {
    display: block;
    color: var(--text-primary);
    font-weight: 500;
}

.source-status {
    display: block;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Error states */
.error-message {
    color: var(--danger);
    background-color: rgba(220, 53, 69, 0.1);
    border: 1px solid rgba(220, 53, 69, 0.3);
    border-radius: 4px;
    padding: 10px;
    margin: 10px 0;
}

.loading-message {
    color: var(--text-muted);
    text-align: center;
    padding: 20px;
    font-style: italic;
}

.no-items {
    color: var(--text-muted);
    text-align: center;
    padding: 20px;
    font-style: italic;
}

/* Audio Mixer */
.audio-source-item {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 10px;
}

.audio-source-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.audio-source-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.audio-source-name {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 14px;
}

.audio-source-volume {
    color: var(--text-muted);
    font-size: 12px;
}

.audio-controls {
    margin-top: 10px;
}

.volume-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--bg-secondary);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
}

.volume-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
    border: none;
}

.volume-slider:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .settings-grid {
        grid-template-columns: 1fr;
    }
    
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .header-left {
        width: 100%;
        justify-content: space-between;
    }
    
    /* Show mobile dashboard icon only on mobile */
    .mobile-dashboard-icon {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
        order: 2;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .connection-buttons {
        justify-content: center;
    }
}

/* Utility classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.d-flex { display: flex; }
.justify-center { justify-content: center; }
.align-center { align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    transform: scale(1.1);
    accent-color: var(--accent-blue);
}

.checkbox-group label {
    margin-bottom: 0;
    cursor: pointer;
    font-size: 14px;
}

.help-text {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    font-style: italic;
}

.action-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.navigation {
    text-align: center;
    margin-bottom: 24px;
}

.nav-btn {
    background: linear-gradient(135deg, var(--bg-accent) 0%, var(--bg-hover) 100%);
    color: var(--text-primary);
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    margin: 0 8px;
}

.nav-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(47, 52, 65, 0.4);
}

/* Status indicators */
.status-indicator.connected {
    background: rgba(82, 196, 26, 0.1);
    color: var(--accent-green);
    border-color: rgba(82, 196, 26, 0.3);
}

.status-indicator.disconnected {
    background: rgba(255, 77, 79, 0.1);
    color: var(--accent-red);
    border-color: rgba(255, 77, 79, 0.3);
}

.status-indicator.info {
    background: rgba(77, 158, 240, 0.1);
    color: var(--accent-blue);
    border-color: rgba(77, 158, 240, 0.3);
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 16px;
        margin: 8px;
    }
    
    h1 {
        font-size: 1.8em;
    }
    
    .controls {
        grid-template-columns: 1fr;
    }
    
    .settings-grid {
        grid-template-columns: 1fr;
    }
    
    .connection-controls {
        flex-direction: column;
    }
    
    .connection-controls .btn {
        min-width: unset;
    }
}

/* Enhanced focus styles for accessibility */
.btn:focus-visible,
select:focus-visible,
input:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

/* Smooth transitions for all interactive elements */
.btn,
.control-group,
select,
input,
.stream-status-indicator,
.settings-section {
    transition: all 0.3s ease;
}

/* Subtle animations */
@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(8px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

.control-group,
.settings-section {
    animation: fadeIn 0.4s ease forwards;
}

.control-group:nth-child(1), .settings-section:nth-child(1) { animation-delay: 0.05s; }
.control-group:nth-child(2), .settings-section:nth-child(2) { animation-delay: 0.1s; }
.control-group:nth-child(3), .settings-section:nth-child(3) { animation-delay: 0.15s; }
.control-group:nth-child(4), .settings-section:nth-child(4) { animation-delay: 0.2s; }
