:root {
    /* Light Theme Colors */
    --bg-primary: #f8f9fa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f3f5;
    --text-primary: #212529;
    --text-secondary: #495057;
    --text-muted: #6c757d;
    --border-color: #dee2e6;
    --accent-color: #3498db;
    --accent-hover: #2980b9;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --error-color: #e74c3c;
    --info-color: #2980b9;
    --debug-color: #7f8c8d;
    
    /* Component Colors */
    --sidebar-bg: #2c3e50;
    --sidebar-text: #ecf0f1;
    --sidebar-item-hover: #34495e;
    --sidebar-item-active: #3498db;
    --topbar-bg: var(--bg-secondary);
    --card-bg: var(--bg-secondary);
    --switch-bg: #cbd2d9;
    --switch-active: #3498db;
    
    /* Button Colors */
    --button-primary-bg: #3498db;
    --button-primary-text: #ffffff;
    --button-primary-hover: #2980b9;
    --button-danger-bg: #e74c3c;
    --button-danger-hover: #c0392b;
    --button-success-bg: #27ae60;
    --button-success-hover: #219955;
    
    /* Status Colors */
    --status-connected: #27ae60;
    --status-not-connected: #e74c3c;
    
    /* Logs Colors */
    --log-bg: var(--bg-secondary);
    --log-border: var(--border-color);
}

.dark-theme {
    --bg-primary: #1a1d24;
    --bg-secondary: #252a34;
    --bg-tertiary: #2d3748;
    --text-primary: #f8f9fa;
    --text-secondary: #e9ecef;
    --text-muted: #adb5bd;
    --border-color: #4a5568;
    --accent-color: #3498db;
    --accent-hover: #2980b9;
    
    /* Component Colors */
    --sidebar-bg: #121212;
    --sidebar-text: #ecf0f1;
    --sidebar-item-hover: #2d3748;
    --sidebar-item-active: #3498db;
    --topbar-bg: #252a34;
    --card-bg: #252a34;
    --switch-bg: #4a5568;
    
    /* Logs Colors */
    --log-bg: #252a34;
    --log-border: #4a5568;
}

/* Base Styles */
body, html {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    height: 100%;
    width: 100%;
    overflow: auto !important; /* Allow scrolling on body and html */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
    height: 100vh;
}

/* Global scrollbar management */
.content-section {
    overflow: auto !important; /* Allow scrolling on content sections */
}

/* Styling for scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #262a36;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #3d4353;
    border-radius: 4px;
    transition: background-color 0.3s;
}

::-webkit-scrollbar-thumb:hover {
    background: #4d5569;
}

/* Allow scrolling on main elements */
body, html, .main-content, .section-wrapper {
    overflow: auto !important;
    scrollbar-width: thin !important;
}

/* Only allow scrollbars on specific elements */
.single-scroll-container {
    scrollbar-width: thin !important;
    overflow-y: auto !important;
}

/* Hide scrollbars on all table elements */
table, tbody, tr, td, th {
    overflow: visible !important;
}

/* Hide all WebKit scrollbars except on allowed containers */
body::-webkit-scrollbar,
html::-webkit-scrollbar,
.content-section::-webkit-scrollbar,
.main-content::-webkit-scrollbar,
.section-wrapper::-webkit-scrollbar {
    width: 8px !important;
    height: 8px !important;
    display: block !important;
}

table::-webkit-scrollbar,
tr::-webkit-scrollbar,
tbody::-webkit-scrollbar,
th::-webkit-scrollbar,
td::-webkit-scrollbar {
    width: 0 !important;
    height: 0 !important;
    display: none !important;
}

a {
    text-decoration: none;
    color: var(--accent-color);
}

button {
    cursor: pointer;
    font-family: inherit;
}

/* Layout Structure */
.app-container {
    display: flex;
    height: 100vh;
    overflow: auto;
}

/* Sidebar */
.sidebar {
    width: 240px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    height: 100%;
    overflow: auto;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 20px 20px;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    min-height: 64px; /* Ensures container doesn't collapse while loading */
}

/* Updated logo size */
.logo {
    width: 64px;
    height: 64px;
    margin-right: 10px;
    object-fit: contain;
    transition: none !important; /* Prevent transition animations */
}

.login-logo {
    width: 64px;
    height: 64px;
    margin-bottom: 10px;
    object-fit: contain;
    transition: none !important; /* Prevent transition animations */
}

.sidebar h1 {
    font-size: 1.5rem;
    font-weight: bold;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    margin-top: 24px; /* Increased from 22px by another 10% */
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 14px 24px; /* Increased from 13px 22px by another 10% */
    color: var(--sidebar-text);
    transition: all 0.3s;
}

.nav-item i {
    margin-right: 14px; /* Increased from 13px by another 10% */
    font-size: 22px; /* Increased from 20px by another 10% */
    width: 29px; /* Increased from 26px by another 10% */
    text-align: center;
}

.nav-item:hover {
    background-color: var(--sidebar-item-hover);
}

.nav-item.active {
    background-color: var(--sidebar-item-active);
    font-weight: 600;
    position: relative;
    box-shadow: 0 0 8px 2px rgba(52, 152, 219, 0.5);
    z-index: 1;
    outline: none;
    border-radius: 4px;
    animation: glowPulse 1.5s infinite alternate;
}

@keyframes glowPulse {
    from {
        box-shadow: 0 0 8px 2px rgba(52, 152, 219, 0.5);
    }
    to {
        box-shadow: 0 0 15px 4px rgba(52, 152, 219, 0.7);
    }
}

/* Theme Switch */
.theme-switcher {
    padding: 24px; /* Increased from 22px by another 10% */
    margin-top: 24px; /* Increased from 22px by another 10% */
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.switch-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px; /* Increased from 9px by another 10% */
    font-size: 17px; /* Increased from 15px by another 10% */
}

.light-icon, .dark-icon {
    color: var(--sidebar-text);
}

.switch {
    position: relative;
    display: inline-block;
    width: 100%;
    height: 26px;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--switch-bg);
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: var(--switch-active);
}

input:checked + .slider:before {
    transform: translateX(calc(100% + 4px));
}

.slider.round {
    border-radius: 34px;
    width: 48px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Main Content */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: auto; /* already set to auto, make sure it stays that way */
}

/* Scheduling specific styles */
#schedulingSection, #schedulingPage, section[id*="scheduling"], div[id*="scheduling"] {
    padding: 0 20px !important;
    margin-left: 20px !important;
    margin-right: 20px !important;
}

/* Scheduling minimalist header */
.scheduling-minimalist-header {
    padding: 15px 0;
    margin-bottom: 15px;
}

.scheduling-minimalist-header h2 {
    font-size: 24px;
    margin-bottom: 10px;
    font-weight: 600;
}

/* Force hide all descriptions and redundant headers in scheduling sections */
.section-header p,
.settings-header p,
div[class*="header"] p,
#schedulingSection p:not(.no-schedules-message p),
#schedulingPage p:not(.no-schedules-message p),
section[id*="scheduling"] p:not(.no-schedules-message p),
div[id*="scheduling"] p:not(.no-schedules-message p),
#schedulingPage .scheduling-minimalist-header,
#schedulingSection .scheduling-minimalist-header {
    display: none !important;
}

/* Ensure color-shift-dividers are visible */
.color-shift-divider {
    display: block !important;
    visibility: visible !important;
    opacity: 0.7 !important;
}

/* Special highlighted dividers that need to be more prominent */
.highlight-divider {
    height: 2px !important;
    opacity: 1 !important;
    margin: 20px 0 !important;
    background-size: 300% 100% !important;
    animation: gradientShift 15s ease infinite !important;
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.2) !important;
}

/* Schedule button styling to match exactly the screenshots */
.schedule-button {
    background-color: #3498db !important;
    border: none !important;
    padding: 10px 15px !important;
    border-radius: 6px !important;
    color: white !important;
    font-weight: 500 !important;
    font-size: 14px !important;
    transition: background-color 0.2s ease !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: auto !important;
    text-align: center !important;
    height: 40px !important;
    box-shadow: none !important;
    cursor: pointer !important;
    min-width: 150px !important;
    max-width: 180px !important;
}

.schedule-button:hover {
    background-color: #2980b9 !important;
}

.schedule-button i {
    margin-right: 8px !important;
    font-size: 16px !important;
}

/* Keep old class references for backward compatibility */
#addScheduleButton, 
#saveSchedulesButton, 
button.save-button, 
button.action-button {
    background-color: #3498db !important;
    border: none !important;
    padding: 10px 15px !important;
    border-radius: 6px !important;
    color: white !important;
}

/* Form area enhancements */
.form-actions {
    display: flex !important;
    width: 100% !important;
    margin-top: 30px !important;
    padding: 0 !important;
    justify-content: flex-start !important;
}

.panel-content {
    padding: 20px !important;
    border-radius: 0 0 8px 8px !important;
    overflow: visible !important;
}

/* Enhanced form field styling */
.scheduler-panel .form-control,
#schedulingSection .form-control,
#schedulingPage .form-control {
    background-color: rgba(30, 39, 56, 0.8) !important;
    border: 1px solid rgba(52, 152, 219, 0.3) !important;
    border-radius: 5px !important;
    color: #ffffff !important;
    font-size: 14px !important;
    height: 38px !important;
    padding: 8px 12px !important;
    transition: all 0.3s ease !important;
}

.scheduler-panel .form-control:focus,
#schedulingSection .form-control:focus,
#schedulingPage .form-control:focus {
    border-color: rgba(52, 152, 219, 0.8) !important;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2) !important;
    outline: none !important;
}

/* Checkbox styling enhancements */
.day-checkbox input[type='checkbox'] {
    position: relative !important;
    cursor: pointer !important;
    margin-right: 5px !important;
    width: 18px !important;
    height: 18px !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    outline: none !important;
    background-color: rgba(30, 39, 56, 0.8) !important;
    border: 1px solid rgba(52, 152, 219, 0.3) !important;
    border-radius: 3px !important;
    vertical-align: middle !important;
}

.day-checkbox input[type='checkbox']:checked {
    background-color: #3498db !important;
    border-color: #3498db !important;
}

.day-checkbox input[type='checkbox']:checked:after {
    content: '\2714' !important;
    font-size: 12px !important;
    position: absolute !important;
    top: 0 !important;
    left: 4px !important;
    color: white !important;
}

/* Label styling */
.scheduler-panel label,
#schedulingSection label,
#schedulingPage label {
    font-weight: 500 !important;
    color: rgba(255, 255, 255, 0.9) !important;
    margin-bottom: 8px !important;
    display: block !important;
    font-size: 14px !important;
}

/* Make dropdown selects in scheduling section fit content */
#schedulingSection select.form-control,
#schedulingPage select.form-control,
section[id*="scheduling"] select.form-control,
.scheduler-container select.form-control {
    width: auto !important;
    min-width: 160px !important;
    max-width: 300px !important;
}

/* Make all dropdown selects across the app fit their content */
select.form-control {
    width: auto !important;
    min-width: 160px !important;
    max-width: 300px !important;
    display: inline-block !important;
}

/* Scheduler Container - Changed to vertical layout as per user preference */
.scheduler-container {
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
    margin-left: 15px !important;
    margin-right: 15px !important;
    width: calc(100% - 30px) !important;
    overflow: auto !important;
}

/* Color-shifting divider line */
.color-shift-divider {
    height: 1px;
    background: linear-gradient(to right, #3498db, #9b59b6, #2ecc71, #f1c40f, #e74c3c);
    background-size: 500% 100%;
    animation: gradientShift 30s ease infinite;
    margin: 15px 0;
    border: none;
    opacity: 0.7;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Top Bar */
.top-bar {
    height: 60px;
    background: linear-gradient(135deg, #1e2738 0%, #0e1420 50%, #101824 75%, rgba(18, 25, 38, 0.95) 100%);
    background-size: 100% 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid rgba(90, 109, 137, 0.15);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    position: relative;
}

/* Add subtle highlight to the bottom of the topbar */
.top-bar::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, rgba(52, 152, 219, 0.3), rgba(155, 89, 182, 0.3)); /* Sonarr blue to Whisparr purple */
    z-index: 1;
}

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

.user-info {
    display: flex;
    align-items: center;
    font-size: 14px;
}

.user-info span {
    margin-right: 12px;
}

.logout-btn {
    color: var(--text-secondary);
    transition: color 0.3s;
}

.logout-btn:hover {
    color: var(--error-color);
}

/* Content Sections - Strict section isolation */
.content-section {
    display: none !important;
    visibility: hidden;
    position: absolute;
    left: 0;
    right: 0;
    height: 0;
    overflow: hidden;
    opacity: 0;
    z-index: -1;
}

.content-section.active {
    display: block !important;
    visibility: visible;
    position: relative;
    height: auto;
    overflow: auto !important; /* Allow scrolling when content is tall */
    opacity: 1;
    z-index: 1;
    padding: 10px 20px; /* Reduced vertical padding by 50% (from 20px to 10px) while keeping horizontal padding at 20px */
}

/* Cards */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.card {
    background: linear-gradient(135deg, rgba(30, 39, 56, 0.95) 0%, rgba(14, 20, 32, 0.95) 50%, rgba(16, 24, 36, 0.95) 100%);
    border-radius: 8px;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
    padding: 20px;
    position: relative;
    border: 1px solid rgba(90, 109, 137, 0.1);
    overflow: hidden;
}

/* Add subtle glow accent to cards */
.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, rgba(52, 152, 219, 0.3), rgba(155, 89, 182, 0.3)); /* Sonarr blue to Whisparr purple */
    opacity: 0.7;
}

.card h2, .card h3 {
    margin-bottom: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
}

.card h2 i, .card h3 i {
    margin-right: 10px;
    color: var(--accent-color);
}

.welcome-card {
    grid-column: 1 / -1;
}

/* Status Card */
.status-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
}

.status-badge i {
    margin-right: 5px;
}

.status-badge.connected {
    background-color: rgba(39, 174, 96, 0.2);
    color: var(--status-connected);
}

.status-badge.not-connected {
    background-color: rgba(231, 76, 60, 0.2);
    color: var(--status-not-connected);
}

/* Stats Card */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    border-radius: 6px;
    background-color: var(--bg-tertiary);
}

.stat-value {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--accent-color);
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 5px;
}

/* Action Card */
.action-buttons {
    display: flex;
    gap: 10px;
}

.action-button {
    padding: 12px 20px;
    border-radius: 6px;
    border: none;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    transition: background-color 0.3s, transform 0.2s;
}

.action-button i {
    margin-right: 8px;
}

.action-button.start {
    background-color: var(--button-success-bg);
    color: white;
}

.action-button.start:hover {
    background-color: var(--button-success-hover);
}

.action-button.stop {
    background-color: var(--button-danger-bg);
    color: white;
}

.action-button.stop:hover {
    background-color: var(--button-danger-hover);
}

/* Logs Section */
.section-header {
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.app-tabs, .log-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.app-tab, .settings-tab {
    padding: 8px 20px;
    background-color: var(--bg-tertiary);
    border: none;
    border-radius: 20px;
    color: var(--text-secondary);
    font-weight: 500;
    transition: all 0.3s;
}

.app-tab.active, .settings-tab.active {
    background-color: var(--accent-color);
    color: white;
}

.app-tab:hover, .settings-tab:hover {
    background-color: var(--accent-hover);
    color: white;
}

.log-tabs {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 15px; /* Add some space below the tabs */
}

.log-tab {
    padding: 8px 20px;
    background-color: var(--bg-tertiary);
    border: none;
    border-radius: 20px;
    color: var(--text-secondary);
    font-weight: 500;
    transition: all 0.3s;
    cursor: pointer; /* Add cursor pointer */
}

.log-tab.active {
    background-color: var(--accent-color);
    color: white;
}

.log-tab:hover {
    background-color: var(--accent-hover);
    color: white;
}

/* Adjust log controls layout if needed */
.log-controls {
    display: flex;
    justify-content: flex-end; /* Align controls to the right */
    align-items: center;
    gap: 15px;
    flex-grow: 1; /* Allow controls to take remaining space */
}

/* Ensure section header handles flex layout properly */
/* Remove background from all section headers */
#appsSection .section-header,
#schedulingSection .section-header,
#logsSection .section-header,
#historySection .section-header {
    background-color: transparent !important;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    padding: 7px 0 !important; /* Reduced from 15px to 7px (50% reduction) */
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
    gap: 15px;
    margin-bottom: 20px;
}

.app-tabs, .log-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.app-tab, .settings-tab {
    padding: 8px 20px;
    background-color: var(--bg-tertiary);
    border: none;
    border-radius: 20px;
    color: var(--text-secondary);
    font-weight: 500;
    transition: all 0.3s;
}

.app-tab.active, .settings-tab.active {
    background-color: var(--accent-color);
    color: white;
}

.app-tab:hover, .settings-tab:hover {
    background-color: var(--accent-hover);
    color: white;
}

.log-options {
    display: flex;
    align-items: center;
    gap: 15px;
}

.auto-scroll {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
}

.clear-button {
    padding: 6px 12px;
    background-color: var(--button-danger-bg);
    color: white;
    border: none;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background-color 0.3s;
}

.clear-button:hover {
    background-color: var(--button-danger-hover);
}

.logs {
    /* Reduce height by 15% from original calc(100vh - 160px) */
    height: calc(85vh - 160px);
    background-color: var(--log-bg);
    border: 1px solid var(--log-border);
    border-radius: 8px;
    padding: 15px;
    overflow-y: auto;
    font-family: monospace;
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.5;
    font-size: 14px;
    margin-bottom: 20px; /* Add margin to create space between logs and footer */
}

.log-entry {
    margin-bottom: 5px;
    padding: 2px 5px; /* Add some horizontal padding */
    display: flex; /* Use flexbox for alignment */
    align-items: baseline; /* Align items based on text baseline */
    gap: 8px; /* Space between elements */
}

.log-timestamp {
    color: var(--text-muted); /* Muted color for timestamp */
    font-size: 0.85em;
    white-space: nowrap; /* Prevent timestamp from wrapping */
}

.log-app {
    color: var(--accent-color); /* Use accent color for app name */
    font-weight: bold;
    font-size: 0.9em;
    white-space: nowrap;
}

.log-level {
    font-weight: bold;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.8em;
    text-transform: uppercase;
    white-space: nowrap;
}

.log-level-info {
    background-color: var(--info-bg, #d1ecf1); /* Use CSS variables with fallbacks */
    color: var(--info-color, #0c5460);
}

.log-level-warning {
    background-color: var(--warning-bg, #fff3cd);
    color: var(--warning-color, #856404);
}

.log-level-error {
    background-color: var(--error-bg, #f8d7da);
    color: var(--error-color, #721c24);
}

.log-level-debug {
    background-color: var(--debug-bg, #e2e3e5);
    color: var(--debug-color, #383d41);
}

/* Apply level colors directly to the entry for fallback */
.log-info .log-message {
    color: var(--info-color, #0c5460);
}

.log-warning .log-message {
    color: var(--warning-color, #856404);
}

.log-error .log-message {
    color: var(--error-color, #721c24);
}

.log-debug .log-message {
    color: var(--debug-color, #383d41);
}

.log-logger {
    color: var(--text-muted); /* Muted color for logger name */
    font-size: 0.85em;
    white-space: nowrap;
}

.log-message {
    flex-grow: 1; /* Allow message to take remaining space */
    word-break: break-word; /* Break long words */
}

.status-connected {
    color: var(--status-connected);
    font-weight: 600;
}

.status-disconnected {
    color: var(--status-not-connected);
    font-weight: 600;
}

/* Settings Section */
.settings-actions {
    display: flex;
    gap: 10px;
}

.save-button, .reset-button {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background-color 0.3s;
}

.save-button {
    background-color: var(--button-success-bg);
    color: white;
}

.save-button:hover {
    background-color: var(--button-success-hover);
}

.reset-button {
    background-color: var(--button-danger-bg);
    color: white;
}

.reset-button:hover {
    background-color: var(--button-danger-hover);
}

.settings-form {
    padding: 0;
}

.app-settings-panel {
    display: none;
}

.app-settings-panel.active {
    display: block;
}

.settings-group {
    background: linear-gradient(145deg, rgba(30, 39, 56, 0.6), rgba(22, 28, 40, 0.7));
    border: 1px solid rgba(90, 109, 137, 0.15);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
    position: relative;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(5px);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.settings-group:hover {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.settings-group h3 {
    margin-bottom: 20px;
    padding: 12px 18px;
    font-size: 1.2rem;
    color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    background: linear-gradient(to right, rgba(52, 152, 219, 0.8), rgba(41, 128, 185, 0.7));
    border-left: 4px solid rgba(52, 152, 219, 0.9);
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.settings-group h3::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0));
    pointer-events: none;
}

.setting-item {
    margin-bottom: 25px;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    position: relative;
    padding-bottom: 5px;
}

.setting-item:not(:last-child)::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(to right, rgba(90, 109, 137, 0), rgba(90, 109, 137, 0.1), rgba(90, 109, 137, 0));
}

.setting-item label {
    width: 200px;
    font-weight: 600;
    margin-right: 20px;
    color: var(--text-primary);
    letter-spacing: 0.3px;
    display: flex;
    align-items: flex-start;
    font-size: 0.9rem; /* Reduced font size by ~25% */
    line-height: 1.3;
}

.setting-item label .info-icon {
    margin-right: 8px;
    color: rgba(52, 152, 219, 0.8);
    transition: color 0.2s ease, transform 0.2s ease;
    flex-shrink: 0;
    margin-top: 1px; /* Slight adjustment to align with first line of text */
}

.setting-item label .info-icon:hover {
    color: rgba(52, 152, 219, 1);
    transform: scale(1.1);
}

/* Enhanced input fields */
.setting-item input[type="text"],
.setting-item input[type="number"],
.setting-item input[type="password"] {
    width: 300px;
    padding: 12px 15px;
    border: 1px solid rgba(90, 109, 137, 0.2);
    border-radius: 8px;
    background: linear-gradient(145deg, rgba(15, 23, 36, 0.7), rgba(22, 30, 45, 0.5));
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 0 rgba(255, 255, 255, 0.05) inset;
    backdrop-filter: blur(5px);
}

.setting-item input[type="text"]:focus,
.setting-item input[type="number"]:focus,
.setting-item input[type="password"]:focus {
    border-color: rgba(52, 152, 219, 0.5);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15), 0 1px 0 rgba(255, 255, 255, 0.1) inset;
    outline: none;
}

.setting-item input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Enhanced select boxes */
.setting-item select {
    width: 300px;
    padding: 12px 15px;
    border: 1px solid rgba(90, 109, 137, 0.2);
    border-radius: 8px;
    background: linear-gradient(145deg, rgba(15, 23, 36, 0.7), rgba(22, 30, 45, 0.5));
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235A6D89' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 0 rgba(255, 255, 255, 0.05) inset;
    backdrop-filter: blur(5px);
}

.setting-item select:focus {
    border-color: rgba(52, 152, 219, 0.5);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15), 0 1px 0 rgba(255, 255, 255, 0.1) inset;
    outline: none;
}

.setting-item select:hover {
    border-color: rgba(90, 109, 137, 0.4);
    background: linear-gradient(145deg, rgba(15, 23, 36, 0.8), rgba(22, 30, 45, 0.6));
}

/* Enhanced option styling for better visibility */
.setting-item select option {
    background-color: rgba(22, 30, 45, 0.95);
    color: var(--text-primary);
    padding: 10px 15px;
    border: none;
    font-size: 14px;
}

.setting-item select option:hover,
.setting-item select option:focus {
    background-color: rgba(52, 152, 219, 0.8);
    color: #ffffff;
}

.setting-item select option:checked {
    background-color: rgba(52, 152, 219, 0.9);
    color: #ffffff;
    font-weight: 600;
}

/* Improved help text */
.setting-help {
    width: 100%;
    margin-top: 8px;
    margin-left: 220px;
    font-size: 0.75rem; /* Reduced font size ~25% */
    color: var(--text-muted);
    opacity: 0.85;
    line-height: 1.4;
    position: relative;
    padding-left: 18px;
}

@media (max-width: 768px) {
    .setting-help {
        margin-left: 0;
        margin-top: 6px;
    }
}

/* Improved toggle switch styling */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px; /* Reduced size to match setup.html */
    height: 20px; /* Reduced height */
    margin-right: 10px;
    flex-shrink: 0;
}

.toggle-switch input[type="checkbox"] {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(145deg, rgba(30, 39, 56, 0.6), rgba(22, 28, 40, 0.7));
    border: 1px solid rgba(90, 109, 137, 0.2);
    transition: .4s;
    border-radius: 20px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 12px; /* Reduced size to match setup.html */
    width: 12px; /* Reduced size to match setup.html */
    left: 4px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

input:checked + .toggle-slider {
    background: linear-gradient(145deg, rgba(41, 128, 185, 0.7), rgba(52, 152, 219, 0.8));
}

input:checked + .toggle-slider:before {
    transform: translateX(20px); /* Adjusted for new smaller size */
}

/* Enhanced instance items */
.instance-item {
    background: linear-gradient(145deg, rgba(30, 39, 56, 0.4), rgba(22, 28, 40, 0.5));
    border: 1px solid rgba(90, 109, 137, 0.1);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.instance-item:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    border-color: rgba(90, 109, 137, 0.2);
}

.instance-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    margin-bottom: 15px;
    border-bottom: 1px solid rgba(90, 109, 137, 0.1);
}

.instance-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
}

.instance-header h4::before {
    content: '\f233'; /* Font Awesome server icon */
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    margin-right: 10px;
    color: rgba(52, 152, 219, 0.8);
    font-size: 14px;
}

/* Enhanced buttons */
.test-connection-btn,
.add-instance-btn,
.remove-instance-btn {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.test-connection-btn {
    background: linear-gradient(145deg, rgba(41, 128, 185, 0.2), rgba(52, 152, 219, 0.15));
    color: rgba(52, 152, 219, 0.9);
    border: 1px solid rgba(52, 152, 219, 0.3);
}

.test-connection-btn:hover {
    background: linear-gradient(145deg, rgba(41, 128, 185, 0.3), rgba(52, 152, 219, 0.25));
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    color: rgba(52, 152, 219, 1);
}

.add-instance-btn {
    background: linear-gradient(145deg, rgba(39, 174, 96, 0.2), rgba(46, 204, 113, 0.15));
    color: rgba(46, 204, 113, 0.9);
    border: 1px solid rgba(46, 204, 113, 0.3);
}

.add-instance-btn:hover {
    background: linear-gradient(145deg, rgba(39, 174, 96, 0.3), rgba(46, 204, 113, 0.25));
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    color: rgba(46, 204, 113, 1);
}

.remove-instance-btn {
    background: linear-gradient(145deg, rgba(231, 76, 60, 0.2), rgba(192, 57, 43, 0.15));
    color: rgba(231, 76, 60, 0.9);
    border: 1px solid rgba(231, 76, 60, 0.3);
}

.remove-instance-btn:hover {
    background: linear-gradient(145deg, rgba(231, 76, 60, 0.3), rgba(192, 57, 43, 0.25));
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    color: rgba(231, 76, 60, 1);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .app-tabs, .settings-actions {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 5px; /* Prevent cut-off of button shadows */
    }
    
    .app-tab, .settings-tab {
        flex: 1;
        white-space: nowrap;
        min-width: 100px; /* Minimum button width */
    }

    /* Layout improvements for user cards on mobile */
    .user-card {
        padding: 15px;
    }

    .verification-container {
        flex-direction: column;
        align-items: center;
    }

    .verification-input {
        width: 100%;
        max-width: 200px;
        margin-right: 0;
        margin-bottom: 10px;
    }
    
    /* Styles moved from 992px breakpoint */
    .settings-group {
        padding: 15px;
    }
    
    .setting-item label {
        width: 100%;
        margin-bottom: 8px;
    }
    
    .setting-help {
        margin-left: 0;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }

    /* Make inputs responsive on narrow screens */
    .setting-item input[type="text"],
    .setting-item input[type="number"],
    .setting-item input[type="password"] {
        width: 100%;
        max-width: 300px;
    }

    /* Specific width for short number inputs */
    .setting-item input.short-number-input {
        width: 80px; /* Adjust width as needed */
        max-width: 80px;
    }
    
    /* History styles moved from 992px breakpoint */
    .history-table {
        font-size: 13px;
    }
    
    .history-table th, .history-table td {
        padding: 8px 10px;
    }
    
    .history-search input {
        width: 150px;
    }
    
    /* Original mobile history styles */
    .history-controls {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .history-search {
        width: 100%;
        margin-bottom: 10px;
    }
    
    .history-search input {
        width: calc(100% - 40px);
    }
    
    /* Sidebar styles moved from 950px breakpoint */
    .sidebar {
        width: 60px;
    }
    
    .sidebar h1, .nav-item span, .switch-label {
        display: none;
    }
    
    .nav-item i {
        margin-right: 0;
        font-size: 22px;
    }
    
    .logo-container {
        justify-content: center;
    }
    
    .logo {
        margin-right: 0;
    }
}

/* Ensure very small screens can still access everything */
@media (max-width: 480px) {
    .top-bar {
        flex-direction: column;
        align-items: flex-start;
        height: auto;
        padding: 10px 15px;
    }

    .user-info {
        margin-top: 10px;
    }

    .action-buttons {
        flex-direction: column;
    }

    .action-button {
        margin-bottom: 10px;
    }
}

/* Footer */
.footer {
    text-align: center;
    padding: 20px;
    margin-top: 20px;
    background-color: var(--bg-secondary);
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    color: var(--text-secondary);
    font-size: 14px;
}

.footer p {
    margin: 5px 0;
}

.footer a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.footer a:hover {
    text-decoration: underline;
    color: var(--accent-hover);
}

/* Notification styles for async operations */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transform: translateY(-20px);
    opacity: 0;
    transition: transform 0.3s, opacity 0.3s;
}

.notification.show {
    transform: translateY(0);
    opacity: 1;
}

.notification.success {
    background-color: var(--success-color);
}

.notification.error {
    background-color: var(--error-color);
}

.notification.info {
    background-color: var(--info-color);
}

/* Multi-instance styles */
.instances-container {
    margin-bottom: 20px;
}

.instance-item {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 16px;
    background-color: var(--card-bg);
}

.instance-header {
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--card-header-bg);
    border-radius: 8px 8px 0 0;
}

.instance-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
}

.instance-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.instance-toggle {
    margin-right: 5px;
}

.instance-content {
    padding: 15px;
}

.add-instance-container {
    display: flex;
    justify-content: center;
    margin: 15px 0;
}

.add-instance-btn {
    padding: 8px 16px;
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s;
}

.add-instance-btn:hover {
    background-color: var(--accent-color-dark);
}

.add-instance-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.remove-instance-btn {
    padding: 5px 10px;
    background-color: var(--delete-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.2s;
}

.remove-instance-btn:hover {
    background-color: var(--delete-color-dark);
}

.test-connection-btn {
    padding: 6px 12px;
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.test-connection-btn:hover {
    background-color: var(--accent-color-dark);
}

.connection-status {
    margin-left: 10px;
    font-size: 14px;
}

.connection-status.success {
    color: var(--success-color);
}

.connection-status.error {
    color: var(--error-color);
}

.connection-status.testing {
    color: var(--accent-color);
}

/* Log Dropdown Styles */
.log-dropdown-container {
    position: relative;
    margin-bottom: 15px;
}

.log-dropdown {
    position: relative;
    display: inline-block;
}

.log-dropdown-btn {
    padding: 10px 20px;
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 20px;
    font-weight: 500;
    transition: all 0.3s;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 140px;
    justify-content: space-between;
}

.log-dropdown-btn:hover {
    background-color: var(--accent-hover);
}

.log-dropdown-content {
    display: none;
    position: absolute;
    background-color: var(--bg-secondary);
    min-width: 180px;
    z-index: 10;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin-top: 8px;
    border: 1px solid var(--border-color);
    max-height: 400px;
    overflow-y: auto;
}

.log-dropdown-content.show {
    display: block;
}

.log-option {
    display: block;
    padding: 10px 15px;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.2s;
    text-align: left;
}

.log-option:hover {
    background-color: var(--bg-tertiary);
}

.log-option.active {
    color: var(--accent-color);
    font-weight: 600;
    background-color: rgba(var(--accent-color-rgb), 0.1);
}

/* Settings Dropdown Styles - Matching log dropdown styles */
.settings-dropdown-container {
    position: relative;
    margin-bottom: 15px;
}

.settings-dropdown {
    position: relative;
    display: inline-block;
}

.settings-dropdown-btn {
    padding: 10px 20px;
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 20px;
    font-weight: 500;
    transition: all 0.3s;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 140px;
    justify-content: space-between;
}

.settings-dropdown-btn:hover {
    background-color: var(--accent-hover);
}

.settings-dropdown-content {
    display: none;
    position: absolute;
    background-color: var(--bg-secondary);
    min-width: 180px;
    z-index: 10;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin-top: 8px;
    border: 1px solid var(--border-color);
    max-height: 400px;
    overflow-y: auto;
}

.settings-dropdown-content.show {
    display: block;
}

.settings-option {
    display: block;
    padding: 10px 15px;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.2s;
    text-align: left;
}

.settings-option:hover {
    background-color: var(--bg-tertiary);
}

.settings-option.active {
    color: var(--accent-color);
    font-weight: 600;
    background-color: rgba(var(--accent-color-rgb), 0.1);
}

/* History Dropdown Styles - Matching log dropdown styles */
.history-dropdown-container {
    display: flex;
    align-items: center;
}

.history-dropdown {
    position: relative;
    display: inline-block;
}

.history-dropdown-btn {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 8px 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text-primary);
    transition: all 0.2s;
    cursor: pointer;
}

.history-dropdown-btn:hover {
    background-color: var(--bg-primary);
}

.history-dropdown-content {
    display: none;
    position: absolute;
    background-color: var(--bg-secondary);
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1001;
    border-radius: 4px;
    max-height: 400px;
    overflow-y: auto;
}

.history-dropdown-content a {
    color: var(--text-primary);
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    transition: all 0.2s;
}

.history-dropdown-content a:hover {
    background-color: var(--bg-tertiary);
}

.history-dropdown-content a.active {
    background-color: var(--accent-color);
    color: white;
}

.history-dropdown-content.show {
    display: block;
}

/* Placeholder message styling */
.placeholder-message {
    display: flex;
    justify-content: center;
    align-items: center;
    height: calc(100% - 60px); /* Adjust based on header height */
}

.message-container {
    text-align: center;
    padding: 30px;
    background-color: var(--bg-secondary);
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    max-width: 500px;
}

.message-container i {
    color: var(--accent-color);
    margin-bottom: 15px;
}

.message-container h3 {
    margin-bottom: 10px;
    font-size: 1.5rem;
}

.message-container p {
    color: var(--text-secondary);
    line-height: 1.5;
}

/* History Table Styles */
.history-container {
    position: relative;
    height: calc(85vh - 160px); /* Use fixed viewport height like logs page instead of percentage */
    overflow-y: auto; /* Only vertical scrolling like logs page */
    background-color: var(--bg-secondary);
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    font-size: 14px;
}

.history-table thead {
    position: sticky;
    top: 0;
    background-color: var(--bg-tertiary);
    z-index: 1;
}

.history-table th {
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
}

.history-table td {
    padding: 10px 15px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.history-table tbody tr:nth-child(even) {
    background-color: var(--bg-tertiary);
}

.history-table tbody tr:hover {
    background-color: rgba(var(--accent-color-rgb), 0.1);
}

/* Operation Type Styles in History Table */
.operation-missing {
    background-color: #8b1538;
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.9em;
    display: inline-block;
}

.operation-upgrade {
    background-color: #1e40af; /* Changed from #2a9d8f to a more vibrant blue */
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.9em;
    display: inline-block;
}

/* History Controls */
.history-controls {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 15px;
}

.history-search {
    display: flex;
    align-items: center;
    margin-right: auto; /* Push to left side */
}

.history-search input {
    padding: 8px 15px;
    border: 1px solid var(--border-color);
    border-radius: 4px 0 0 4px;
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    width: 200px;
}

.history-search button {
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 0 4px 4px 0;
    padding: 8px 12px;
    cursor: pointer;
}

.history-search button:hover {
    background-color: var(--accent-hover);
}

.history-page-size {
    display: flex;
    align-items: center;
    gap: 8px;
}

.history-page-size select {
    padding: 7px 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Pagination Controls */
.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 15px 0;
    gap: 15px;
}

.pagination-button {
    padding: 8px 15px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.pagination-button:hover {
    background-color: var(--accent-color);
    color: white;
}

.pagination-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: var(--bg-tertiary);
    color: var(--text-muted);
}

#historyPageInfo {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Empty state and loading */
.empty-state-message, .loading-indicator {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: var(--text-muted);
    text-align: center;
    padding: 20px;
}

.empty-state-message i, .loading-indicator i {
    margin-bottom: 15px;
    color: var(--accent-color);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .history-controls {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .history-search {
        width: 100%;
        margin-bottom: 10px;
    }
    
    .history-search input {
        width: calc(100% - 40px);
    }
}

/* Define color-shifting animation with 50% reduced glow */
@keyframes glowing-ring {
  0% { box-shadow: 0 0 7.5px #3498db, 0 0 2.5px rgba(52, 152, 219, 0.4); } /* Sonarr blue */
  20% { box-shadow: 0 0 7.5px #f1c40f, 0 0 2.5px rgba(241, 196, 15, 0.4); } /* Radarr yellow */
  40% { box-shadow: 0 0 7.5px #2ecc71, 0 0 2.5px rgba(46, 204, 113, 0.4); } /* Lidarr green */
  60% { box-shadow: 0 0 7.5px #e74c3c, 0 0 2.5px rgba(231, 76, 60, 0.4); } /* Readarr red */
  80% { box-shadow: 0 0 7.5px #9b59b6, 0 0 2.5px rgba(155, 89, 182, 0.4); } /* Whisparr purple */
  100% { box-shadow: 0 0 7.5px #3498db, 0 0 2.5px rgba(52, 152, 219, 0.4); } /* Back to Sonarr blue */
}

.styled-select {
  background: var(--accent-color);
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 10px 35px 10px 20px; /* Increase right padding for the arrow */
  font-weight: 500;
  font-size: 1rem;
  min-width: 140px;
  /* Add glowing ring animation */
  animation: glowing-ring 10s infinite ease-in-out;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
  outline: none;
  transition: all 0.3s ease;
  margin-right: 10px;
  position: relative;
  /* Add dropdown arrow using pseudo-element */
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
}

.styled-select option {
  color: var(--text-primary);
  background: var(--bg-secondary);
  padding: 8px 12px;
}

/* Define faster glowing animation for hover state with 50% reduced glow */
@keyframes glowing-ring-hover {
  0% { box-shadow: 0 0 10px #3498db, 0 0 5px rgba(52, 152, 219, 0.6); } /* Sonarr blue */
  20% { box-shadow: 0 0 10px #f1c40f, 0 0 5px rgba(241, 196, 15, 0.6); } /* Radarr yellow */
  40% { box-shadow: 0 0 10px #2ecc71, 0 0 5px rgba(46, 204, 113, 0.6); } /* Lidarr green */
  60% { box-shadow: 0 0 10px #e74c3c, 0 0 5px rgba(231, 76, 60, 0.6); } /* Readarr red */
  80% { box-shadow: 0 0 10px #9b59b6, 0 0 5px rgba(155, 89, 182, 0.6); } /* Whisparr purple */
  100% { box-shadow: 0 0 10px #3498db, 0 0 5px rgba(52, 152, 219, 0.6); } /* Back to Sonarr blue */
}

.styled-select:focus, .styled-select:hover {
  background: var(--accent-hover);
  /* Switch to more intense glowing animation on hover */
  animation: glowing-ring-hover 6s infinite ease-in-out;
}

/* Add helper text for dropdowns */
.dropdown-helper {
  display: block;
  color: rgba(255,255,255,0.7);
  font-size: 0.8rem;
  margin-top: 8px;
  text-align: center;
  position: absolute;
  width: 100%;
  left: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.log-dropdown:hover .dropdown-helper {
  opacity: 1;
}

/* Any container elements that might have overflow: hidden */
.app-container, 
.content-section, 
.scheduler-container, 
.scheduler-panel {
    overflow: auto !important;
}

#schedulingPage, 
#schedulingSection {
    overflow-y: auto !important;
}

/* Special case for panels that should show their content but not have a scrollbar themselves */
.panel-content,
.schedules-list {
    overflow: visible !important;
}

/* Make number inputs shorter where appropriate */
.short-number-input,
.setting-item input.short-number-input {
    width: 100px !important; /* Use !important to override wider default */
    padding: 12px 10px !important;
}

/* Make number inputs for intervals shorter */
input[type="number"].interval-input,
#generalSettings .setting-item input#stateful_management_hours {
    width: 80px !important; /* Use !important to override potential broader input styles */
    padding: 12px 8px !important;
}

/* Stateful management header row with reset button */
.stateful-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px;
    margin-bottom: 15px;
    width: 100%;
}

.stateful-header-row h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Reset button styling */
#reset_stateful_btn {
    background: linear-gradient(145deg, rgba(231, 76, 60, 0.2), rgba(192, 57, 43, 0.15));
    color: rgba(231, 76, 60, 0.9);
    border: 1px solid rgba(231, 76, 60, 0.3);
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

#reset_stateful_btn:hover {
    background: linear-gradient(145deg, rgba(231, 76, 60, 0.3), rgba(192, 57, 43, 0.25));
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    color: rgba(231, 76, 60, 1);
}

#reset_stateful_btn i {
    font-size: 13px;
}

/* Stateful Management Section Styling */
#generalSettings .setting-info-block {
    background: linear-gradient(145deg, rgba(30, 39, 56, 0.4), rgba(22, 28, 40, 0.5));
    border: 1px solid rgba(90, 109, 137, 0.1);
    border-radius: 8px;
    padding: 15px;
    margin-top: 0;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

#generalSettings .info-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

#generalSettings .date-info-block {
    background: linear-gradient(145deg, rgba(20, 25, 35, 0.4), rgba(15, 19, 26, 0.3));
    padding: 12px 15px;
    border-radius: 6px;
    border-left: 3px solid var(--accent-color);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

#generalSettings .date-label {
    font-size: 0.85em;
    color: var(--text-secondary);
    margin-bottom: 5px;
    opacity: 0.85;
}

#generalSettings .date-value {
    font-size: 0.95em;
    font-weight: 600;
    color: var(--text-primary);
    font-family: inherit;
    background-color: transparent;
    padding: 0;
}

#generalSettings .setting-item .reset-help {
    color: var(--warning-color);
    font-style: normal;
    font-size: 0.85em;
    opacity: 0.9;
}

/* Fix specific input field widths - State Reset Interval */
#generalSettings .setting-item input#stateful_management_hours,
input#stateful_management_hours {
    width: 55px !important; /* Make it significantly narrower to match the red line in the image */
    padding: 8px 6px !important;
    text-align: center;
    margin-right: 10px;
    min-width: 55px !important;
    max-width: 55px !important;
    font-size: 0.9rem;
}

/* Pagination controls above table - left aligned and compact */
.pagination-controls.pagination-above-table {
    display: flex;
    justify-content: flex-start; /* Align to left instead of center */
    align-items: center;
    padding: 10px 0; /* Reduced padding for more compact spacing */
    gap: 15px;
    margin-bottom: 15px; /* Add margin below to separate from table */
}

/* Fix for Swaparr toggle alignment in instances (diagnostic) */
.instance-item .setting-item.swaparr-instance-toggle label:not(.toggle-switch) {
    width: 250px !important; /* Extremely large width for testing */
    min-width: 250px !important;
    flex-shrink: 0 !important;
}
