/* Clean, Modern Dark Blue Theme - Based on Opus */
:root {
    --bg: #0a0e1a;
    --bg-secondary: #0d1117;
    --surface: #15213b;
    --surface-hover: #1e2a47;
    --border: #334866;
    --text: #ffffff;
    --text-dim: #94a3b8;
    --text-muted: #6b7280;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --secondary: #9146ff;
    --secondary-hover: #772ce8;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --radius: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    margin: 0;
    padding: 1rem;
    font-size: clamp(14px, 1.8vh, 18px);
}

.container {
    max-width: min(1400px, 75vw);
    margin: 0 auto;
    width: 100%;
}

/* Header */
.header {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 2rem;
    padding: 0;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    max-width: min(1400px, 75vw);
    margin: 0 auto;
    width: 100%;
}

/* Header Logo Styles */
.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo {
    width: 96px;
    height: 96px;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    flex-shrink: 0;
}

/* Section Icons */
.section-icon {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    flex-shrink: 0;
    opacity: 0.9;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.header h1 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: clamp(1.2rem, 3.5vh, 2rem);
    font-weight: 600;
    margin: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Cards & Sections */
.card, 
.settings-section, 
.config-section, 
.triggers-section,
.status-section,
.streamers-section,
.activity-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-header,
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.card-title,
.section-header h2,
.settings-section h2,
.config-section h2,
.triggers-section h2 {
    font-size: clamp(1rem, 2.5vh, 1.5rem);
    font-weight: 600;
}

/* Status Grid */
.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(200px, 45vw), 1fr));
    gap: 1rem;
/*  margin-bottom: 2rem; */
}

.status-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
 /*  margin-bottom: 2rem; */
}

.status-grid-5 {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
/*  margin-bottom: 2rem; */
}

@media (max-width: 768px) {
    .status-grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    .status-grid-5 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 480px) {
    .status-grid-4 {
        grid-template-columns: 1fr;
    }
    .status-grid-5 {
        grid-template-columns: repeat(2, 1fr);
    }
}

.status-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.35rem 0.65rem;
    text-align: center;
}

.status-card h3 {
    font-size: 0.75rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Override h3 color for highlighted status cards */
.status-card.highlight-success h3 {
    color: var(--success);
}

.status-card.highlight-danger h3 {
    color: var(--danger);
}

.status-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.status-header h3 {
    margin: 0;
}

.status-value {
    font-size: 1rem;
    font-weight: bold;
    color: var(--primary);
    margin-bottom: 0.1rem;
}

.status-label {
    font-size: 0.66rem;
    color: var(--text-dim);
    margin-top: 0.15rem;
}

/* Status Content */
.status-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    margin-bottom: 0;
    position: relative;
}

.status-content.centered {
    text-align: center;
    gap: 0.15rem;
}

.status-card .status-text {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.status-card .status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    align-self: flex-start;
    flex-shrink: 0;
    margin-top: 0.5rem;
}

.status-card .status-indicator.connected {
    background: var(--success);
    animation: pulse 2s infinite;
}

.status-card .status-indicator.disconnected {
    background: var(--danger);
}

.status-info {
    text-align: center;
    width: 100%;
}

.status-info p {
    margin-bottom: 0.5rem;
    font-size: clamp(0.75rem, 1.8vh, 1rem);
}

.status-actions {
    margin-top: 0.5rem;
}

.activity-stats {
    text-align: center;
}

.activity-stats p {
    margin-bottom: 0.75rem;
    font-size: clamp(0.75rem, 1.8vh, 1rem);
}

/* Streamer List - Modern CSS Grid Layout */
.streamer-item, .streamer-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1rem;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    container-type: inline-size; /* Modern CSS Container Queries */
    border-inline-start: 3px solid var(--border); /* Modern CSS Logical Properties - visible by default */
}

.streamer-item:hover, .streamer-card:hover {
    background: var(--surface-hover);
    transform: translateY(-2px);
    border-inline-start-color: var(--primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.streamer-card.disabled {
    opacity: 0.7;
    border-style: dashed;
}

.streamer-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
    gap: 1rem;
}

.streamer-name-section {
    flex: 1;
}

.status-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
}

.streamer-status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.streamer-status-indicator .status-text {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-dim);
    order: 1;
    margin: 0;
    padding: 0;
}

.streamer-status-indicator .status-dot {
    order: 2;
    margin: 0;
    padding: 0;
}

.streamer-status-indicator .status-dot.live ~ .status-text {
    color: var(--success);
}

.status_badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}

.status_badge.enabled {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
    border: 1px solid var(--success);
}

.status_badge.disabled {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
    border: 1px solid var(--warning);
}

.streamer-status .streamer-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.streamer-status .streamer-info h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0;
}

.streamer-info {
    flex: 1;
}

.streamer-info h4 {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.streamer-info p {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 0.15rem;
    line-height: 1.3;
}

.streamer-channel {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.75rem;
    color: var(--primary) !important;
    margin-bottom: 0.25rem;
}

.streamer-name {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.live, .status-dot.online {
    background: var(--success);
    animation: pulse 10s infinite;
}

.status-dot.offline {
    background: var(--text-dim);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Twitch-style stat boxes */
.streamer-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.stat-box {
    background: linear-gradient(135deg, #9146ff, #772ce8);
    border-radius: 6px;
    padding: 0.25rem 0.5rem;
    display: flex;
    flex: 0.9;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
    height: 36px;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(145, 70, 255, 0.3);
}

.stat-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 1px;
}

.stat-value {
    font-size: 0.75rem;
    font-weight: 700;
    color: #ffffff;
}

.trigger-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
}

.trigger-tag {
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary);
    border: 1px solid var(--primary);
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.trigger-more {
    background: rgba(148, 163, 184, 0.2);
    color: var(--text-dim);
    border: 1px solid var(--text-dim);
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    font-size: 0.625rem;
    font-weight: 500;
}

.no-triggers {
    margin-bottom: 0.5rem;
}

.no-triggers .text-dim {
    font-size: 0.75rem;
    color: var(--text-dim);
    font-style: italic;
}

.streamer-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: space-between;
    margin-top: 0.75rem;
    flex-shrink: 0;
}

.streamer-actions .action-btn {
    flex: 1;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 6px;
}

.action-btn.status-toggle.enabled {
    background: #22c55e !important;
    color: #ffffff !important;
    border: 1px solid #22c55e !important;
    box-shadow: 0 2px 4px rgba(34, 197, 94, 0.3);
}

.action-btn.status-toggle.disabled {
    background: #f59e0b !important;
    color: #ffffff !important;  
    border: 1px solid #f59e0b !important;
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.3);
}

/* Modern 3-Column Streamer Grid Layout */
.streamers-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    container-type: inline-size;
}

.streamer-card {
    width: 100%;
    max-width: none;
}

/* CSS Container Queries for responsive streamer cards */
@container (max-width: 400px) {
    .streamers-list .streamer-card {
        font-size: 0.9em;
        padding: 0.75rem;
    }
}

/* Responsive breakpoints for 3-column grid */
@media (max-width: 1200px) {
    .streamers-list {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    .streamers-list {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

/* Trigger List */
.trigger-item {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    border: 1px solid var(--border);
    transition: all 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.trigger-item:hover {
    border-color: var(--primary);
    transform: translateX(2px);
}

.trigger-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.trigger-keyword, .trigger-command {
    font-family: monospace;
    background: var(--primary);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

.trigger-response {
    color: var(--text);
    font-style: italic;
    margin: 0 0.5rem;
}

.trigger-weight {
    background: var(--warning);
    color: var(--bg);
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.response-weight {
    background: var(--primary);
    color: white;
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    font-size: 0.625rem;
    font-weight: 500;
    margin-left: 0.25rem;
}

.trigger-actions {
    display: flex;
    gap: 0.5rem;
}

/* Activity Log */
.activity-log, .activity-feed {
    background: var(--bg);
    border-radius: var(--radius);
    max-height: 300px;
    overflow-y: auto;
    padding: 1rem;
    border: 1px solid var(--border);
}

.activity-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-time {
    color: var(--primary);
    font-weight: 500;
    margin-right: 1rem;
    min-width: 60px;
}

.activity-message {
    color: var(--text);
}

.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--text-dim);
}

.empty-state p {
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

/* Buttons */
.btn, 
.btn-primary, 
.btn-secondary, 
.btn-danger, 
.btn-success, 
.btn-warning, 
.btn-small,
.btn-sm {
    padding: 0.625rem 1.25rem;
    border: 2px solid transparent;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
    text-align: center;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    min-height: 38px;
    font-family: inherit;
}

.btn:focus,
.btn-primary:focus,
.btn-secondary:focus,
.btn-danger:focus,
.btn-success:focus,
.btn-warning:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.btn:disabled,
.btn-primary:disabled,
.btn-secondary:disabled,
.btn-danger:disabled,
.btn-success:disabled,
.btn-warning:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
    background: var(--secondary);
    color: white;
    border-color: var(--secondary);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--secondary-hover);
    border-color: var(--secondary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(145, 70, 255, 0.4);
}

/* Ensure btn-small + color classes work together */
.btn-small.btn-primary,
.btn-sm.btn-primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-small.btn-primary:hover:not(:disabled),
.btn-sm.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}

.btn-small.btn-secondary,
.btn-sm.btn-secondary {
    background: var(--secondary);
    color: white;
    border-color: var(--secondary);
}

.btn-small.btn-secondary:hover:not(:disabled),
.btn-sm.btn-secondary:hover:not(:disabled) {
    background: var(--secondary-hover);
    border-color: var(--secondary-hover);
}

.btn-danger {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
    border-color: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.4);
}

.btn-success {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

.btn-success:hover:not(:disabled) {
    background: #059669;
    border-color: #059669;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.4);
}

/* Cascading Filter Styles */
.btn-dimmed {
    opacity: 0.5;
}

select.filter-dropdown-subtle,
select.filter-dropdown-active {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

select.filter-dropdown-subtle {
    background: var(--bg) !important;
    border: 1px solid var(--border) !important;
    color: var(--text) !important;
    opacity: 0.7;
}

select.filter-dropdown-active {
    background: var(--bg) !important;
    border: 2px solid var(--primary) !important;
    color: var(--text) !important;
    box-shadow: 0 0 0 3px rgba(145, 70, 255, 0.1) !important;
}

select.filter-dropdown-subtle:disabled,
select.filter-dropdown-active:disabled {
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border) !important;
    color: var(--text-muted) !important;
    opacity: 0.5;
    cursor: not-allowed;
}

/* Ensure option elements are also dark */
select.filter-dropdown-subtle option,
select.filter-dropdown-active option {
    background: var(--bg) !important;
    color: var(--text) !important;
}

.btn-warning {
    background: var(--warning);
    color: var(--bg);
    border-color: var(--warning);
}

.btn-warning:hover:not(:disabled) {
    background: #d97706;
    border-color: #d97706;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(245, 158, 11, 0.4);
}

.btn-small, .btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    min-height: 32px;
}

/* Override for standalone small buttons */
.btn-small:not(.btn-primary):not(.btn-secondary):not(.btn-danger):not(.btn-success):not(.btn-warning), 
.btn-sm:not(.btn-primary):not(.btn-secondary):not(.btn-danger):not(.btn-success):not(.btn-warning) {
    background: var(--surface-hover);
    color: var(--text);
    border-color: var(--border);
}

.btn-small:not(.btn-primary):not(.btn-secondary):not(.btn-danger):not(.btn-success):not(.btn-warning):hover:not(:disabled), 
.btn-sm:not(.btn-primary):not(.btn-secondary):not(.btn-danger):not(.btn-success):not(.btn-warning):hover:not(:disabled) {
    background: var(--surface);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

/* Forms */
.form-group {
    margin-bottom: 0.5rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    color: var(--text);
}

.form-group small {
    display: block;
    font-size: 0.75rem;
    color: var(--text-dim);
    text-align: right;
    margin-right: 1rem;
    margin-top: 0.25rem;
}

.form-group input,
.form-group select,
.form-group textarea,
.form-input, 
.form-select {
    width: 100%;
    padding: 0.5rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.875rem;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.form-input:focus, 
.form-select:focus {
    outline: none;
    border-color: var(--primary);
}

.form-row { 
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
/*  margin-bottom: 2rem; */
}

.checkbox-group {
    display: flex;
    align-items: center;
    margin: 1rem 0;

}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    margin-bottom: 0;
}

.checkbox-group input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border);
    border-radius: 4px;
    display: inline-block;
    position: relative;
    background: var(--bg);
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.checkbox-group input[type="checkbox"]:checked + .checkmark {
    background: var(--primary);
    border-color: var(--primary);
}

.checkbox-group input[type="checkbox"]:checked + .checkmark::after {
    content: '✓';
    position: absolute;
    top: 1px;
    left: 4px;
    color: white;
    font-size: 14px;
    font-weight: bold;
}

.checkbox-group label:hover .checkmark {
    border-color: var(--primary);
}

/* Settings Form */
.settings-form, .config-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Streamer Configuration Form - 2 Column Layout */
.config-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.config-form .form-group.checkbox-group,
.config-form .form-actions {
    grid-column: 1 / -1;
}

/* Responsive - single column on mobile */
@media (max-width: 768px) {
    .config-form {
        grid-template-columns: 1fr;
    }
}

.settings-form .status-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 1rem 0;
    padding: 0.75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

/* Trigger Forms */
.add-trigger-form {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.add-trigger-form h3 {
    margin-bottom: 1rem;
    color: var(--text);
}

.trigger-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.existing-triggers {
    margin-top: 2rem;
}

.existing-triggers h3 {
    margin-bottom: 1rem;
    color: var(--text);
}

.triggers-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    background: var(--bg);
}

/* Multiple Response Options */
.response-options-list {
    margin-bottom: 1rem;
    min-height: 60px;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.5rem;
    background: var(--surface);
}

.response-option-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    background: var(--bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.response-option-item:last-child {
    margin-bottom: 0;
}

.response-text-input {
    flex: 1;
    min-width: 200px;
}

.response-weight-input {
    width: 80px;
}

.empty-response-options {
    text-align: center;
    padding: 1rem;
    color: var(--text-dim);
    font-style: italic;
}

.add-response-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-top: 0.5rem;
}

.add-response-input {
    flex: 1;
    min-width: 200px;
}

.add-weight-input {
    width: 100px;
}

.response-help {
    color: var(--text-dim);
    font-size: 0.75rem;
    margin-top: 0.5rem;
}

/* Modal - Modern with backdrop-filter */
.modal-overlay {
    position: fixed;
    inset: 0; /* Modern shorthand for top/right/bottom/left: 0 */
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px); /* Modern backdrop blur */
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    overflow-y: auto;
}

/* Modern modal with better styling */
.modal {
    background: var(--surface);
    border-radius: calc(var(--radius) * 2); /* Larger border radius */
    border: 1px solid var(--border);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5); /* Modern shadow */
    max-width: min(600px, 90vw); /* Modern responsive sizing */
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1); /* Modern easing */
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-dim);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
}

.close-btn:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* Messages */
.message {
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    margin: 1rem 0;
    border: 1px solid;
    font-size: 0.875rem;
    font-weight: 500;
}

.message.success {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--success);
    color: var(--success);
}

.message.error {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--danger);
    color: var(--danger);
}

.message.warning {
    background: rgba(245, 158, 11, 0.1);
    border-color: var(--warning);
    color: var(--warning);
}

.message.info {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--primary);
    color: var(--primary);
}

/* System Status */
.system-status, .system-info-grid {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 2rem;
}

.status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.status-row:last-child {
    border-bottom: none;
}

.status-row span:first-child {
    font-weight: 500;
    color: var(--text);
}

.status-row span:last-child {
    color: var(--text-dim);
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.875rem;
}

/* Maintenance Actions */
.maintenance-actions {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 2rem;
    margin-top: 1rem;
}

.action-group-left {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: flex-start;
}

.action-group-right {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.action-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.danger-zone {
    margin-top: 2rem;
    padding: 1.5rem;
    background: rgba(239, 68, 68, 0.05);
    border: 1px solid var(--danger);
    border-radius: var(--radius);
}

.danger-zone h3 {
    color: var(--danger);
    margin-bottom: 1rem;
    font-size: 1rem;
}

/* Admin Users */
.admin-users-list {
    margin-bottom: 2rem;
}

.admin-user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
}

.user-info {
    flex: 1;
}

.change-password-form {
    margin-top: 1rem;
    padding: 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.inline-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.inline-form .form-actions {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

/* Quick Actions */
.quick-actions {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-top: 2rem;
}

.action-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.tab {
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab:hover {
    background: var(--surface-hover);
}

.tab.active {
    border-bottom-color: var(--primary);
    color: var(--primary);
}

/* Responsive */
@media (max-width: 968px) {
    .form-row {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .header {
        flex-direction: column;
        gap: 1rem;
    }
    
    .header-logo {
        width: 24px;
        height: 24px;
    }
    
    .section-icon {
        width: 20px;
        height: 20px;
    }
    
    .status-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .maintenance-actions {
        flex-direction: column;
        gap: 1rem;
    }
    
    .action-group-left,
    .action-group-right {
        justify-content: center;
    }
}

/* Modern Utility Classes */
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-dim { color: var(--text-dim); }

/* Modern spacing using logical properties */
.mt-1 { margin-block-start: 0.5rem; }
.mt-2 { margin-block-start: 1rem; }
.mb-1 { margin-block-end: 0.5rem; }
.mb-2 { margin-block-end: 1rem; }
.ml-1 { margin-inline-start: 0.5rem; }
.mr-1 { margin-inline-end: 0.5rem; }

/* Modern layout utilities */
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.flex { display: flex; }
.flex-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.grid { display: grid; }
.place-center { place-items: center; }
.aspect-square { aspect-ratio: 1; }

/* Streamer Details Modal Grid */
.streamer-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    max-width: 100%;
}

.detail-box {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem;
    border-inline-start: 3px solid var(--primary);
    transition: all 0.2s ease;
    min-height: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.detail-box:hover {
    border-inline-start-color: var(--secondary);
    background: var(--surface-hover);
}

.detail-box.status-box:hover {
    border-inline-start-color: var(--success);
}

.detail-box.full-width {
    grid-column: 1 / -1;
}

.detail-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.detail-value {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text);
    word-break: break-word;
}

.detail-value.user-list {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.85rem;
    background: var(--surface);
    padding: 0.5rem;
    border-radius: calc(var(--radius) / 2);
    border: 1px solid var(--border);
}

.status-indicator-text {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}

.status-indicator-text.live {
    color: var(--success);
}

.status-indicator-text.offline {
    color: var(--text-dim);
}

/* Collapsible Sections */
.settings-section.collapsed .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 1rem;
    margin: -1.5rem -1.5rem 1rem -1.5rem;
    background: var(--surface-hover);
    border-radius: var(--radius);
    transition: all 0.2s ease;
}

.settings-section.collapsed .section-header:hover {
    background: var(--bg);
}

.toggle-btn {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toggle-btn:hover {
    background: var(--primary-hover);
    transform: scale(1.1);
}

.toggle-btn.open {
    background: var(--secondary);
}

.collapsible-content {
    margin-top: 1rem;
}

/* Info Items for System Info */
.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

.info-item:last-child {
    border-bottom: none;
}

.info-label {
    font-size: 0.875rem;
    color: var(--text-dim);
    font-weight: 500;
}

.info-value {
    font-size: 0.875rem;
    color: var(--text);
    font-weight: 600;
}
.system-note {
    color: var(--text-dim);
    font-size: 0.875rem;
    text-align: end;
    margin-right: 1rem;
}

/* Activity Tabs */
.activity-tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.tab-button {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    font-weight: 500;
}

.tab-button:hover {
    color: var(--text);
    background: var(--bg);
}

.tab-button.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: var(--bg);
}

/* Docker Logs */
.logs-feed {
    max-height: 400px;
}

.logs-controls {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.refresh-logs-btn, .clear-logs-btn {
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s ease;
}

.refresh-logs-btn:hover, .clear-logs-btn:hover {
    background: var(--bg);
    border-color: var(--primary);
}

.logs-container {
    max-height: 300px;
    overflow-y: auto;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.75rem;
}

.log-item {
    display: flex;
    align-items: flex-start;
    padding: 0.25rem 0;
    border-bottom: 1px solid var(--border);
    gap: 0.5rem;
}

.log-item:last-child {
    border-bottom: none;
}

.log-timestamp {
    color: var(--text-dim);
    white-space: nowrap;
    min-width: 120px;
    font-size: 0.7rem;
}

.log-level {
    font-weight: 600;
    min-width: 50px;
    text-align: center;
    padding: 0.125rem 0.25rem;
    border-radius: 3px;
    font-size: 0.7rem;
}

.log-item .log-level {
    background: var(--bg);
    color: var(--text);
}

.log-error .log-level {
    background: var(--error);
    color: white;
}

.log-warn .log-level {
    background: var(--warning);
    color: white;
}

.log-message {
    flex: 1;
    word-break: break-word;
    line-height: 1.3;
}

/* X-cloak for Alpine.js */
[x-cloak] {
    display: none !important;
}

/* ============================================
   D20 TRACKER STYLES
   ============================================ */

.d20-section .card {
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.d20-section .card h3 {
    margin: 0 0 0.75rem 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.d20-controls {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.d20-controls .form-group {
    flex: 0 1 auto;
}

.d20-controls .form-group label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-dim);
}

.d20-controls .form-input,
.d20-controls .form-select {
    min-width: 150px;
}

.d20-controls .checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all 0.2s;
}

.d20-controls .checkbox-label:hover {
    border-color: var(--primary);
    background: var(--surface-hover);
}

.d20-controls .checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.d20-controls .checkbox-label span {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
}

.d20-chart-wrapper {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.d20-y-axis {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 15rem;
    padding: 0.75rem 0;
    min-width: 2rem;
}

.y-axis-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-dim);
    text-align: right;
    padding-right: 0.4rem;
    line-height: 1;
}

.d20-chart-content {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.d20-distribution {
    display: flex;
    gap: 0.5rem;
    justify-content: space-between;
    align-items: flex-end;
    height: 15rem;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius);
    overflow-x: auto;
}

.d20-x-axis {
    display: flex;
    gap: 0.5rem;
    justify-content: space-between;
    padding: 0.5rem 0.75rem 0 0.75rem;
}

.x-axis-label {
    flex: 1;
    max-width: 3rem;
    font-size: 0.9rem;
    font-weight: 750;
    color: var(--secondary);
    text-align: center;
}

.d20-bar-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    flex: 1;
    align-self: stretch;
    gap: 0.35rem;
    position: relative;
}

.d20-bar {
    width: 100%;
    max-width: 3rem;
    background: var(--primary);
    border-radius: 0.25rem 0.25rem 0 0;
    transition: all 0.3s ease;
    min-height: 0.5rem; /* Minimum visual bar */
    box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.2);
    position: relative;
    overflow: hidden; /* Hide text that doesn't fit in very short bars */
}

/* Highest count bar(s) - purple color */
.d20-bar.max-count {
    background: var(--secondary) !important;
    box-shadow: 0 2px 8px rgba(145, 70, 255, 0.4) !important;
}

/* NAT 20 and NAT 1 override max-count */
.d20-bar.nat-20 {
    background: var(--success) !important;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4) !important;
}

.d20-bar.nat-1 {
    background: var(--danger) !important;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4) !important;
}

/* Shared properties for all bar text elements */
.d20-bar-count-inline,
.d20-bar-count-outside,
.d20-bar-percent-inline,
.d20-bar-percent-outside {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-weight: 600;
    white-space: nowrap;
    pointer-events: none;
}

/* Count-specific positioning and styling */
.d20-bar-count-inline {
    top: 15%;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0 1px 3px rgba(0,0,0,0.7);
}

.d20-bar-count-outside {
    bottom: 35%;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0 1px 3px rgba(0,0,0,0.7);
    z-index: 10;
}

/* Percentage-specific positioning and styling */
.d20-bar-percent-inline {
    bottom: 0.5rem;
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.85);
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    z-index: 10;
}

.d20-bar-percent-outside {
    bottom: 25%;
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.85);
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    z-index: 10;
}

.d20-bar-container:hover .d20-bar {
    filter: brightness(1.2);
    transform: translateY(-2px);
    border: 2px solid var(--secondary);
    box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.2), 0 0 0.5rem rgba(145, 70, 255, 0.5);
}

/* Shared hover transform for all text elements */
.d20-bar-container:hover .d20-bar-count-inline,
.d20-bar-container:hover .d20-bar-count-outside,
.d20-bar-container:hover .d20-bar-percent-inline,
.d20-bar-container:hover .d20-bar-percent-outside {
    transform: translateX(-50%) scale(1.5);
}

/* Position adjustments on hover */
.d20-bar-container:hover .d20-bar-count-inline {
    top: 10%;
}

.d20-bar-container:hover .d20-bar-count-outside {
    bottom: 35%;
}

.d20-bar-container:hover .d20-bar-percent-outside {
    bottom: 25%;
}

.embed-url-container {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.embed-url-container input {
    flex: 1;
}

.highlight-success {
    color: var(--success);
    font-weight: 600;
}

.highlight-danger {
    color: var(--danger);
    font-weight: 600;
}

.d20-section .status-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.d20-section .status-grid-5 {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.d20-section .status-card {
    padding: 0.35rem 0.65rem;
}

.d20-section .status-card h3 {
    font-size: 0.75rem;
}

.d20-section .status-content {
    gap: 0.15rem;
    margin-bottom: 0;
}

.d20-section .status-value {
    font-size: 1rem;
}

.d20-section .status-label {
    font-size: 0.7rem;
}

.d20-chat-buttons {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

/* D20 Tracker Table Styles */
.d20-section .table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.d20-section .table th,
.d20-section .table td {
    padding: 0.65rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.d20-section .table th {
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-dim);
    background: rgba(255, 255, 255, 0.03);
}

.d20-section .table td {
    font-size: 0.9rem;
    color: var(--text);
}

.d20-section .table tbody tr {
    transition: background 0.2s ease;
}

.d20-section .table tbody tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

.d20-section .table th:first-child,
.d20-section .table td:first-child {
    padding-left: 1.5rem;
    width: 80px;
}

.d20-section .table th:nth-child(2),
.d20-section .table td:nth-child(2) {
    min-width: 150px;
}

.d20-section .table th:nth-child(3),
.d20-section .table td:nth-child(3),
.d20-section .table th:nth-child(4),
.d20-section .table td:nth-child(4),
.d20-section .table th:nth-child(5),
.d20-section .table td:nth-child(5),
.d20-section .table th:nth-child(6),
.d20-section .table td:nth-child(6) {
    text-align: center;
    width: 120px;
}

.d20-section .table th:nth-child(7),
.d20-section .table td:nth-child(7) {
    text-align: center;
    width: 70px;
}

.d20-section .table td button {
    padding: 0.3rem 0.5rem;
    font-size: 0.85rem;
}

.table-scroll-container {
    max-height: 320px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 4px;
}

.table-scroll-container .table {
    margin-bottom: 0;
    border: none;
}

.table-scroll-container thead {
    position: sticky;
    top: 0;
    background: var(--surface);
    z-index: 10;
}

/* D20 Stats Percentage Display */
.stat-percent {
    font-size: 0.8em;
    opacity: 0.7;
    margin-left: 0.25rem;
}
/* Ensure highlight colors work inside D20 section tables */
.d20-section .table td.highlight-success,
.d20-section .table td .highlight-success {
    color: var(--success) !important;
}

.d20-section .table td.highlight-danger,
.d20-section .table td .highlight-danger {
    color: var(--danger) !important;
}

/* Command Output Display Box */
.command-output-container {
    margin-top: 0.5rem;
}

.command-output-text {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.9rem;
    font-family: 'Courier New', monospace;
    resize: vertical;
    min-height: 60px;
}

.command-output-text:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg);
}

.command-output-text::placeholder {
    color: var(--text-dim);
    font-style: italic;
}

.command-output-hint {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
