/* ============================================
   API STATUS PAGE STYLES
   System diagnostics and monitoring
   ============================================ */

/* Controls Panel */
.controls-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 16px 24px;
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    flex-wrap: wrap;
}

.controls-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.controls-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.last-updated {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.auto-refresh-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--border-medium);
    border-radius: 24px;
    transition: all var(--transition-base);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
}

.toggle-switch:hover .toggle-slider {
    background: var(--text-tertiary);
}

.toggle-switch input:checked+.toggle-slider {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--accent-cyan) 100%);
    box-shadow: 0 0 12px rgba(0, 120, 212, 0.3);
}

.toggle-switch input:checked+.toggle-slider::before {
    transform: translateX(20px);
    box-shadow: var(--shadow-md);
}

.toggle-switch input:focus+.toggle-slider {
    box-shadow: 0 0 0 3px rgba(0, 120, 212, 0.2);
}

/* Status Section */
.status-section {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    position: relative;
    overflow: hidden;
}

.status-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-blue) 0%, var(--accent-cyan) 50%, var(--accent-purple) 100%);
}

.status-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.status-section .section-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Health Grid */
.health-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.health-card {
    background: linear-gradient(135deg, var(--bg-light) 0%, var(--bg-white) 100%);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.health-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--border-medium);
    transition: background var(--transition-base);
}

.health-card:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.health-card.healthy {
    border-color: var(--success-green);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.06) 0%, var(--bg-white) 100%);
}

.health-card.healthy::before {
    background: linear-gradient(90deg, var(--success-green), #34D399);
}

.health-card.warning {
    border-color: var(--warning-orange);
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.06) 0%, var(--bg-white) 100%);
}

.health-card.warning::before {
    background: linear-gradient(90deg, var(--warning-orange), #FBBF24);
}

.health-card.error {
    border-color: var(--error-red);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.06) 0%, var(--bg-white) 100%);
    animation: pulse-error 2s ease-in-out infinite;
}

.health-card.error::before {
    background: linear-gradient(90deg, var(--error-red), #F87171);
}

@keyframes pulse-error {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }

    50% {
        box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
    }
}

.health-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}

.health-icon {
    font-size: 1.75rem;
    line-height: 1;
}

.health-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.health-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1rem;
}

.health-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    width: fit-content;
}

.health-status-badge.healthy {
    background: var(--success-light);
    color: #065f46;
}

.health-status-badge.warning {
    background: var(--warning-light);
    color: #92400e;
}

.health-status-badge.error {
    background: var(--error-light);
    color: #991b1b;
}

.health-status-badge.checking {
    background: var(--bg-gray);
    color: var(--text-secondary);
}

.health-status-badge::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.health-status-badge.healthy::before {
    animation: none;
}

.health-details {
    display: flex;
    gap: 20px;
}

.health-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.health-stat .stat-label {
    font-size: 0.6875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.health-stat .stat-value {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.metric-card {
    background: linear-gradient(135deg, var(--bg-light) 0%, var(--bg-white) 100%);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: all var(--transition-fast);
}

.metric-card:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-sm);
}

.metric-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.metric-icon {
    font-size: 1.25rem;
    line-height: 1;
}

.metric-title {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.metric-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: 8px;
}

.metric-value.success {
    color: var(--success-green);
}

.metric-value.warning {
    color: var(--warning-orange);
}

.metric-value.error {
    color: var(--error-red);
}

.metric-details {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

/* Progress Bar */
.progress-bar {
    height: 8px;
    background: var(--bg-gray);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width var(--transition-base), background-color var(--transition-base);
}

.progress-fill.success {
    background: var(--success-green);
}

.progress-fill.warning {
    background: var(--warning-orange);
}

.progress-fill.error {
    background: var(--error-red);
}

/* Initial state for progress bars */
.progress-fill {
    width: 0%;
}

/* Data Table */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.data-table th,
.data-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

.data-table th {
    background: var(--bg-light);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    font-weight: 600;
}

.data-table tbody tr:hover {
    background: rgba(0, 120, 212, 0.03);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.endpoint-name {
    font-family: 'Cascadia Code', 'Consolas', 'Monaco', monospace;
    font-size: 0.8125rem;
    color: var(--text-primary);
    word-break: break-word;
}

.latency-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
}

.latency-badge.fast {
    background: var(--success-light);
    color: #065f46;
}

.latency-badge.normal {
    background: rgba(59, 130, 246, 0.1);
    color: #1e40af;
}

.latency-badge.slow {
    background: var(--warning-light);
    color: #92400e;
}

.latency-badge.very-slow {
    background: var(--error-light);
    color: #991b1b;
}

.time-ago {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.empty-table-message {
    text-align: center;
    padding: 40px 20px !important;
    color: var(--text-muted);
}

.empty-table-message .empty-icon {
    display: block;
    font-size: 2rem;
    margin-bottom: 8px;
    opacity: 0.5;
}

/* Endpoint Filter */
.endpoint-filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.endpoint-filter-group label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.endpoint-filter-group select {
    padding: 6px 12px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    color: var(--text-primary);
    background: var(--bg-white);
    cursor: pointer;
    transition: all var(--transition-base);
}

.endpoint-filter-group select:hover {
    border-color: var(--primary-blue);
}

.endpoint-filter-group select:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(0, 120, 212, 0.1);
}

/* Endpoint Summary */
.endpoint-summary {
    padding: 16px;
    background: var(--bg-light);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
}

.endpoint-summary-stats {
    display: flex;
    gap: 24px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.summary-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.summary-stat .stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-blue);
}

.summary-stat .stat-label {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.endpoint-category-breakdown {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.category-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: 100px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.category-chip strong {
    color: var(--text-primary);
}

/* Cosmos Details */
.cosmos-details,
.cache-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.cosmos-loading,
.cache-loading {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    grid-column: 1 / -1;
}

.cosmos-container-card,
.cache-entry-card {
    background: var(--bg-light);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 16px;
}

.cosmos-container-card h4,
.cache-entry-card h4 {
    margin: 0 0 12px 0;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.cosmos-stats,
.cache-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
}

.cosmos-stat,
.cache-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cosmos-stat-label,
.cache-stat-label {
    font-size: 0.6875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cosmos-stat-value,
.cache-stat-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Action Button Variants */
.action-btn.primary {
    background: var(--primary-blue);
    color: white;
    border-color: var(--primary-blue);
}

.action-btn.primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.action-btn.danger {
    color: var(--error-red);
    border-color: var(--error-red);
    background: white;
}

.action-btn.danger:hover {
    background: var(--error-red);
    color: white;
}

/* Toast Notifications
   Note: Core toast styles are in main.css
   No overrides needed for this page */

/* Button loading state */
.action-btn.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.action-btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-top: -8px;
    margin-left: -8px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.action-btn.primary.loading {
    color: transparent;
    background: var(--primary-blue);
}

.action-btn.primary.loading::after {
    border-color: rgba(255, 255, 255, 0.3);
    border-top-color: white;
}

/* @keyframes spin - defined in main.css */

/* ============================================
   QUALTRICS API LIMITS SECTION
   ============================================ */

.limits-loading,
.limits-error-container {
    padding: 40px;
    text-align: center;
    color: var(--text-secondary);
}

.limits-error {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--error-red);
}

.limits-error .error-icon {
    font-size: 1.5rem;
}

.limits-container {
    padding: 0;
}

.limits-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.limit-card {
    background: var(--bg-light);
    border-radius: var(--radius-md);
    padding: 16px;
    border: 1px solid var(--border-light);
}

.limit-card.full-width {
    grid-column: 1 / -1;
}

.limit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.limit-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9375rem;
}

.limit-badge {
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
}

.limit-badge.success {
    background: var(--success-bg);
    color: var(--success-green);
}

.limit-badge.warning {
    background: var(--warning-bg);
    color: var(--warning-text);
}

.limit-badge.danger {
    background: var(--error-bg);
    color: var(--error-red);
}

.limit-details {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
}

.limit-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.limit-stat .stat-label {
    font-size: 0.6875rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.limit-stat .stat-value {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
}

.limit-reset {
    margin-top: 8px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: center;
}

.limits-raw {
    background: var(--bg-white);
    padding: 12px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    font-size: 0.75rem;
    font-family: 'Consolas', 'Monaco', monospace;
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border-light);
    white-space: pre-wrap;
    word-break: break-word;
}

.limits-metadata {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border-light);
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: right;
}

/* ============================================
   QUALTRICS HEALTH SECTION
   ============================================ */

.qualtrics-health-container {
    padding: 0;
}

.qualtrics-health-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.health-metric-card {
    background: var(--bg-light);
    border-radius: var(--radius-md);
    padding: 16px;
    border: 1px solid var(--border-light);
}

.health-metric-card.full-width {
    grid-column: 1 / -1;
}

.health-metric-card .metric-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-light);
}

.health-metric-card .metric-icon {
    font-size: 1.25rem;
}

.health-metric-card .metric-title {
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.health-metric-card .status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.success {
    background: var(--success-green-bg);
    color: var(--success-green);
}

.status-badge.warning {
    background: var(--warning-yellow-bg);
    color: var(--warning-yellow-dark);
}

.status-badge.moderate {
    background: #fff3cd;
    color: #856404;
}

.status-badge.error {
    background: var(--error-red-bg);
    color: var(--error-red);
}

/* Rate Limit Gauge */
.rate-limit-gauge {
    height: 8px;
    background: var(--bg-white);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
    border: 1px solid var(--border-light);
}

.gauge-fill {
    height: 100%;
    transition: width 0.3s ease;
}

.gauge-fill.success {
    background: var(--success-green);
}

.gauge-fill.warning {
    background: var(--warning-yellow);
}

.gauge-fill.moderate {
    background: #ffc107;
}

.gauge-fill.error {
    background: var(--error-red);
}

.rate-limit-stats {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.rate-limit-stats .stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.rate-limit-stats .label {
    font-size: 0.6875rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.rate-limit-stats .value {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.stat-item {
    text-align: center;
    padding: 8px;
    background: var(--bg-white);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
}

.stat-item.error {
    border-color: var(--error-red);
    background: var(--error-red-bg);
}

.stat-item .stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    display: block;
}

.stat-item.error .stat-value {
    color: var(--error-red);
}

.stat-item .stat-label {
    font-size: 0.6875rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Category Bars */
.category-bars {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.category-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.category-name {
    width: 110px;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.category-bar-container {
    flex: 1;
    height: 6px;
    background: var(--bg-white);
    border-radius: 3px;
    overflow: hidden;
    border: 1px solid var(--border-light);
}

.category-bar-fill {
    height: 100%;
    background: var(--primary-blue);
    transition: width 0.3s ease;
}

.category-count {
    width: 50px;
    text-align: right;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Endpoint Table */
.endpoint-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.endpoint-table th {
    text-align: left;
    padding: 8px 12px;
    background: var(--bg-white);
    border-bottom: 2px solid var(--border-light);
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.6875rem;
    letter-spacing: 0.5px;
}

.endpoint-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
}

.endpoint-table tr:hover {
    background: var(--bg-white);
}

.endpoint-table .endpoint-name {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.75rem;
    color: var(--primary-blue);
    word-break: break-all;
}

.category-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.6875rem;
    font-weight: 500;
}

.category-tag.surveys {
    background: #e3f2fd;
    color: #1565c0;
}

.category-tag.distributions {
    background: #f3e5f5;
    color: #7b1fa2;
}

.category-tag.responses {
    background: #e8f5e9;
    color: #2e7d32;
}

.category-tag.directories {
    background: #fff3e0;
    color: #ef6c00;
}

.category-tag.users {
    background: #e0f7fa;
    color: #00838f;
}

.category-tag.other {
    background: #f5f5f5;
    color: #616161;
}

.health-footer {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border-light);
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: right;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .controls-panel {
        flex-direction: column;
        align-items: stretch;
    }

    .controls-left,
    .controls-right {
        justify-content: center;
    }

    .health-grid,
    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .health-details {
        flex-direction: column;
        gap: 12px;
    }

    .metric-value {
        font-size: 1.5rem;
    }

    .limits-grid {
        grid-template-columns: 1fr;
    }

    .limit-details {
        flex-direction: column;
        gap: 8px;
    }

    .limit-stat {
        flex-direction: row;
        justify-content: space-between;
    }

    .qualtrics-health-grid {
        grid-template-columns: 1fr;
    }

    .endpoint-table {
        font-size: 0.75rem;
    }

    .endpoint-table th,
    .endpoint-table td {
        padding: 6px 8px;
    }
}

/* ============================================
   ALERTS BANNER
   ============================================ */

.alerts-banner {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 24px;
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    background: var(--warning-light);
    border: 2px solid var(--warning-orange);
    animation: alertPulse 2s ease-in-out infinite;
}

.alerts-banner.critical {
    background: var(--error-light);
    border-color: var(--error-red);
}

.alerts-banner.hidden {
    display: none;
}

@keyframes alertPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.85;
    }
}

.alerts-icon {
    font-size: 2rem;
    line-height: 1;
}

.alerts-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.alerts-title {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 1rem;
}

.alerts-count {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.alerts-details {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.alert-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
}

.alert-icon {
    font-size: 0.875rem;
}

.alert-message {
    color: var(--text-primary);
}

/* ============================================
   BACKGROUND SERVICE SECTION
   ============================================ */

.service-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

/* Last Run Results card has fewer stats, make it smaller */
#lastRunResultsCard .service-details {
    grid-template-columns: 1fr;
}

.service-card {
    background: linear-gradient(135deg, var(--bg-light) 0%, var(--bg-white) 100%);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: all var(--transition-fast);
}

.service-card.healthy {
    border-color: var(--success-green);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.05) 0%, var(--bg-white) 100%);
}

.service-card.warning {
    border-color: var(--warning-orange);
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.05) 0%, var(--bg-white) 100%);
}

.service-card.error {
    border-color: var(--error-red);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.05) 0%, var(--bg-white) 100%);
}

.service-card.pending {
    border-color: var(--text-tertiary);
    background: linear-gradient(135deg, rgba(156, 163, 175, 0.05) 0%, var(--bg-white) 100%);
}

.service-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}

.service-icon {
    font-size: 1.75rem;
    line-height: 1;
}

.service-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.service-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1rem;
}

.service-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    width: fit-content;
}

.service-status-badge.healthy {
    background: var(--success-light);
    color: #065f46;
}

.service-status-badge.warning {
    background: var(--warning-light);
    color: #92400e;
}

.service-status-badge.error {
    background: var(--error-light);
    color: #991b1b;
}

.service-status-badge.pending {
    background: var(--bg-gray);
    color: var(--text-secondary);
}

.service-status-badge.checking {
    background: var(--bg-gray);
    color: var(--text-secondary);
}

.service-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.service-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tracked-surveys-card {
    max-height: 280px;
    overflow: hidden;
}

.tracked-surveys-list {
    max-height: 200px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tracked-survey-item {
    display: grid;
    grid-template-columns: 1fr 2fr auto;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-white);
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    border: 1px solid var(--border-light);
    align-items: center;
}

.survey-id {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.75rem;
    color: var(--primary-blue);
}

.survey-name {
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.survey-updated {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.no-surveys,
.loading-text {
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    padding: 20px;
}

/* ============================================
   SYNC HISTORY SECTION
   ============================================ */

.sync-history-card {
    grid-column: 1 / -1;
}

.sync-history-count {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: var(--bg-gray);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
}

.sync-history-list {
    max-height: 300px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sync-history-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 32px;
    color: var(--text-muted);
}

.sync-history-empty .empty-icon {
    font-size: 2rem;
    opacity: 0.5;
}

.sync-history-item {
    display: grid;
    grid-template-columns: auto 1fr auto auto auto;
    gap: 12px;
    padding: 10px 14px;
    background: var(--bg-white);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    align-items: center;
    font-size: 0.8125rem;
    transition: all 0.2s ease;
}

.sync-history-item:hover {
    border-color: var(--primary-blue);
    box-shadow: var(--shadow-sm);
}

.sync-history-item.success {
    border-left: 3px solid var(--success-green);
}

.sync-history-item.error {
    border-left: 3px solid var(--error-red);
    background: var(--error-light);
}

.sync-status-icon {
    font-size: 1rem;
}

.sync-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.sync-survey-id {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.75rem;
    color: var(--primary-blue);
}

.sync-survey-name {
    color: var(--text-primary);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sync-details {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.sync-responses {
    color: var(--text-primary);
    font-weight: 500;
}

.sync-duration {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.sync-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
    min-width: 60px;
    text-align: right;
}

.sync-error {
    cursor: help;
}

/* Pulse indicator for running state */
.pulse-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--success-green);
    border-radius: 50%;
    margin-right: 6px;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }

    70% {
        box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

.stat-value.running {
    color: var(--success-green);
    font-weight: 600;
}

.stat-value.warning {
    color: var(--warning-orange);
}

.stat-value.success {
    color: var(--success-green);
}

.stat-value.error {
    color: var(--error-red);
}

/* ============================================
   RECENT ERRORS SECTION
   ============================================ */

.error-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    background: var(--bg-gray);
    color: var(--text-secondary);
}

.error-count-badge.has-errors {
    background: var(--error-red);
    color: white;
}

.errors-container {
    padding: 0;
}

.no-errors-message {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 40px;
    color: var(--text-muted);
}

.success-icon {
    font-size: 1.5rem;
}

.errors-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.error-item {
    padding: 12px 16px;
    background: var(--error-light);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--error-red);
}

.error-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
}

.error-status-code {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 8px;
    background: var(--error-red);
    color: white;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 700;
    font-family: 'Consolas', 'Monaco', monospace;
}

.error-endpoint {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.8125rem;
    color: var(--text-primary);
    flex: 1;
}

.error-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.error-message {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    word-break: break-word;
}

/* ============================================
   SPARKLINE CHARTS
   ============================================ */

.sparkline {
    display: block;
    margin-top: 8px;
    background: rgba(0, 120, 212, 0.05);
    border-radius: var(--radius-sm);
}

/* ============================================
   RESPONSIVE ADJUSTMENTS FOR NEW SECTIONS
   ============================================ */

@media (max-width: 1200px) {
    .service-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .sync-history-card {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) {
    .alerts-banner {
        flex-direction: column;
        text-align: center;
    }

    .alerts-details {
        justify-content: center;
    }

    .service-grid {
        grid-template-columns: 1fr;
    }

    .service-details {
        grid-template-columns: 1fr;
    }

    .tracked-survey-item {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .sync-history-item {
        grid-template-columns: auto 1fr auto;
        gap: 8px;
    }

    .sync-history-item .sync-details {
        display: none;
    }

    .error-header {
        flex-wrap: wrap;
    }

    .admin-settings-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================================================
   Admin Settings Section
   ============================================================================ */

.admin-settings-section {
    border-top: 3px solid var(--primary-purple);
}

.admin-settings-section.has-overrides {
    border-top-color: var(--warning-orange);
}

.admin-settings-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 16px;
}

.setting-card {
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.setting-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.setting-icon {
    font-size: 1.25rem;
}

.setting-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.setting-description {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.setting-control {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.setting-control input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--bg-gray);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.setting-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-blue);
    cursor: pointer;
    border: 2px solid var(--bg-white);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.setting-control input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-blue);
    cursor: pointer;
    border: 2px solid var(--bg-white);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.setting-control input[type="range"]:hover::-webkit-slider-thumb {
    background: var(--primary-purple);
}

.setting-control input[type="range"]:hover::-moz-range-thumb {
    background: var(--primary-purple);
}

.setting-value {
    display: flex;
    align-items: baseline;
    gap: 6px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.setting-value span:first-child {
    color: var(--primary-blue);
}

.setting-default {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-tertiary);
}

.setting-card .btn {
    align-self: flex-start;
    margin-top: auto;
}

.settings-note {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg-gray);
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.settings-note.success {
    background: rgba(40, 167, 69, 0.1);
    border: 1px solid rgba(40, 167, 69, 0.2);
    color: var(--text-secondary);
}

.settings-note .note-icon {
    flex-shrink: 0;
}

@media (max-width: 1024px) {
    .admin-settings-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .admin-settings-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   DEPLOYMENT INFO SECTION
   ============================================ */
.deployment-section .deployment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
}

.deployment-card {
    background: var(--bg-light);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
    border: 1px solid var(--border-light);
}

.deployment-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.deployment-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    word-break: break-all;
}

/* ============================================
   ERROR TREND SECTION
   ============================================ */
.error-trend-section .error-trend-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.error-trend-summary {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.trend-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 20px;
    background: var(--bg-light);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    min-width: 100px;
}

.trend-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.trend-value.error {
    color: var(--error-red);
}

.trend-value.warning {
    color: var(--warning-orange);
}

.trend-label {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

.error-trend-chart {
    background: var(--bg-light);
    border-radius: var(--radius-md);
    padding: 16px;
    min-height: 80px;
    border: 1px solid var(--border-light);
}

.chart-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-tertiary);
    font-size: 0.875rem;
}

.mini-bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 60px;
}

.bar-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.bar-wrapper .bar {
    width: 100%;
    max-width: 16px;
    min-height: 2px;
    background: var(--primary-blue);
    border-radius: 2px 2px 0 0;
    transition: height 0.3s ease;
}

.bar-wrapper .bar.warning {
    background: var(--warning-orange);
}

.bar-wrapper .bar.error {
    background: var(--error-red);
}

.bar-wrapper .bar-label {
    font-size: 0.625rem;
    color: var(--text-tertiary);
    display: none;
}

.bar-wrapper:hover .bar-label {
    display: block;
}

/* ============================================
   SYNC HISTORY SECTION
   ============================================ */
.sync-history-section .sync-history-container {
    max-height: 400px;
    overflow-y: auto;
}

.sync-history-empty,
.sync-history-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px;
    text-align: center;
    color: var(--text-tertiary);
}

.sync-history-empty .empty-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.sync-history-table {
    display: flex;
    flex-direction: column;
    gap: 0;
    font-size: 0.875rem;
}

.sync-history-header {
    display: grid;
    grid-template-columns: 100px 1fr 60px 80px;
    gap: 12px;
    padding: 10px 12px;
    background: var(--bg-light);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sync-history-row {
    display: grid;
    grid-template-columns: 100px 1fr 60px 80px;
    gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-light);
    align-items: center;
}

.sync-history-row:last-child {
    border-bottom: none;
}

.sync-history-row:hover {
    background: var(--bg-light);
}

.sync-history-row.error {
    background: rgba(239, 68, 68, 0.05);
}

.sync-history-row .col-time {
    color: var(--text-tertiary);
    font-size: 0.8125rem;
}

.sync-history-row .col-survey {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sync-history-row .col-status {
    text-align: center;
}

.sync-history-row .col-duration {
    color: var(--text-secondary);
    text-align: right;
}

/* Operational Pages styles removed - navigation consolidated to sidebar */
