/* styles.css */

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background-color: #f8f9fa;
  color: #343a40;
  margin: 0;
  padding: 0;
}

/* 顶部区域 */
.top-bar {
  background-color: #ffffff;
  border-bottom: 1px solid #dee2e6;
  padding: 15px 0;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.top-bar h1 {
  font-size: 1.8rem;
  color: #1a73e8;
  margin: 0;
}
.top-bar h1 .brand {
  font-weight: bold;
}
.top-bar h1 .subtitle {
  font-size: 1rem;
  color: #6c757d;
  margin-left: 10px;
}

/* 底部区域 */
.footer {
  background-color: #ffffff;
  border-top: 1px solid #dee2e6;
  padding: 15px 0;
  text-align: center;
  color: #6c757d;
  font-size: 0.9rem;
  margin-top: 30px;
  box-shadow: 0 -2px 5px rgba(0,0,0,0.05);
}

/* 主内容区域 */
.main-content {
  max-width: 1200px;
  margin: 30px auto;
  padding: 0 15px;
}

/* 输入区域 */
.input-section {
  background-color: #ffffff;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  margin-bottom: 20px;
}
.input-section label {
  font-weight: 500;
  color: #495057;
}

/* 中间内容区域 */
.content-container {
  display: flex;
  gap: 20px;
  flex-wrap: wrap; /* Allow wrapping on smaller screens if needed */
}

/* 侧边栏 (Left Navigation) */
#sidebar {
  width: 240px;
  background-color: #ffffff;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  height: 600px; /* Maintain height */
  overflow-y: auto; /* Scroll if content overflows */
  flex-shrink: 0; /* Prevent shrinking */
}
#sidebar h3 {
  font-size: 1.2rem;
  color: #343a40;
  margin-bottom: 15px;
  border-bottom: 1px solid #e9ecef;
  padding-bottom: 8px;
}
/* Left Sidebar Navigation Buttons Styling */
#sidebar .nav-button {
    border: 1px solid #e9ecef;
    transition: all 0.2s ease-in-out;
    padding: 0.4rem 0.6rem !important; /* Adjust padding */
    width: 100%; /* Ensure full width */
    margin-bottom: 8px; /* Space between buttons */
}
#sidebar .nav-button:hover {
    background-color: #e9ecef;
    border-color: #ced4da;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
#sidebar .nav-button .nav-item-type {
   font-size: 0.85rem;
   color: #343a40;
}
#sidebar .nav-button .nav-item-videoid {
    font-size: 0.75rem;
    font-family: monospace;
    color: #6c757d; /* Muted color for ID */
    display: block; /* Ensure it takes its line */
    white-space: nowrap; /* Prevent wrapping */
    overflow: hidden; /* Hide overflow */
    text-overflow: ellipsis; /* Add ellipsis */
}
/* Subtle left border color for type */
#sidebar .nav-profile { border-left: 3px solid #6f42c1 !important; }
#sidebar .nav-file { border-left: 3px solid #198754 !important; }

/* Optional: Highlight effect on scroll */
@keyframes highlight {
  from { background-color: rgba(255, 255, 0, 0.5); }
  to { background-color: inherit; }
}
.highlight-scroll {
  animation: highlight 1.5s ease-out;
}

/* 日志区域 */
.log-container {
  flex: 1; /* Takes remaining horizontal space */
  min-width: 0; /* Prevent flex item from overflowing */
}
#logOutput {
  height: 600px;
  overflow-y: auto;
  padding: 15px;
  background-color: #ffffff;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  font-size: 0.9rem;
}

/* 状态栏 */
#statusBar {
  margin-top: 10px;
  padding: 10px 15px;
  background-color: #e7f1ff;
  border: 1px solid #c4d9ff;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  gap: 10px;
}
#statusBar span {
  font-size: 0.9rem;
  color: #343a40;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#statusBar progress {
  flex-shrink: 0; /* Prevent progress bar shrinking */
  width: 150px;
  height: 10px;
  border-radius: 5px;
}

/* 系统状态侧栏 (Right) */
#system-status {
  width: 240px;
  background-color: #ffffff;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  height: 600px; /* Maintain height */
  display: flex; /* Enable flex column layout */
  flex-direction: column; /* Stack children vertically */
  overflow: hidden; /* Hide overflow from the main container */
  flex-shrink: 0; /* Prevent shrinking */
}
#system-status h3, #system-status h4 {
  text-align: center;
  margin-bottom: 10px; /* Consistent margin */
}
#system-status h3 i {
  vertical-align: middle;
}
#system-status hr {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

/* Styling for the new compact status */
#compact-status-display {
    box-shadow: 0 1px 3px rgba(0,0,0,0.07);
}
#compact-status-display .status-item {
    text-align: center;
}
#compact-status-display .status-item i {
    font-size: 1.2rem;
    vertical-align: middle;
}
#compact-status-display .status-item strong {
    font-weight: 600;
    vertical-align: middle;
}

/* 刷新控制按钮组 */
.status-refresh-controls {
   /* text-center applied in HTML */
}
.status-refresh-controls .btn-group .btn {
  font-size: 0.9rem;
  padding: 5px 10px;
  transition: all 0.3s;
}
.status-refresh-controls .btn-group .btn.active {
  background-color: #1a73e8;
  color: #ffffff;
  border-color: #1a73e8;
}
.status-refresh-controls .btn-group .btn:not(.active) {
  background-color: #f1f3f5;
  color: #495057;
  border-color: #dee2e6;
}

/* Styling for the task list container and items */
#task-list-container {
    flex-grow: 1; /* Allow list to take remaining vertical space */
    overflow-y: auto; /* Enable vertical scrolling ONLY for the list */
    background-color: #f8f9fa;
    padding: 8px;
    border-radius: 5px;
    border: 1px solid #eee;
    margin-top: 10px; /* Add some space */
}

.task-list-item {
    background-color: #ffffff;
    font-size: 0.8rem;
    line-height: 1.4;
    margin-bottom: 6px !important;
    padding: 8px 10px !important; /* Adjust padding */
    border-radius: 4px !important;
    border: 1px solid #dee2e6 !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    display: flex; /* Use flex for item layout */
    justify-content: space-between; /* Push state badge to the right */
    align-items: flex-start; /* Align items top */
    gap: 5px; /* Gap between content and badge */
}

.task-list-item .task-meta {
    flex-grow: 1; /* Allow meta info to take space */
    word-break: break-word; /* Break long video IDs */
    min-width: 0; /* Important for flex text truncation */
}

.task-list-item .task-videoid {
    display: block; /* Video ID on its own line */
    font-weight: 500; /* Slightly bolder */
    color: #343a40;
    margin-bottom: 2px;
    white-space: nowrap; /* Prevent wrapping */
    overflow: hidden; /* Hide overflow */
    text-overflow: ellipsis; /* Add ellipsis */
}

.task-list-item .task-type {
    display: inline-block; /* Type can be inline */
    font-size: 0.75rem;
    color: #6c757d;
    text-transform: capitalize; /* Nicer display: Profile, Download */
}
/* Add icons for task types */
.task-type-profile::before { content: "\F472"; font-family: bootstrap-icons !important; margin-right: 4px; vertical-align: -0.1em; color: #6f42c1; } /* Person icon */
.task-type-download::before { content: "\F30A"; font-family: bootstrap-icons !important; margin-right: 4px; vertical-align: -0.1em; color: #fd7e14; } /* Download icon */
.task-type-combine::before { content: "\F49C"; font-family: bootstrap-icons !important; margin-right: 4px; vertical-align: -0.1em; color: #17a2b8; } /* Merge icon */
.task-type-unknown::before { content: "\F61F"; font-family: bootstrap-icons !important; margin-right: 4px; vertical-align: -0.1em; color: #6c757d; } /* Question mark icon */

.task-list-item .task-state { /* State badge */
    font-size: 0.7rem;
    font-weight: 500;
    padding: 0.2em 0.5em !important; /* Adjust padding */
    white-space: nowrap; /* Prevent badge text wrapping */
    align-self: center; /* Center badge vertically */
    flex-shrink: 0; /* Prevent badge shrinking */
}
/* Badge colors */
.task-state-waiting { background-color: #ffc107 !important; color: #000 !important; }
.task-state-running { background-color: #0dcaf0 !important; color: #000 !important;}
.task-state-finished { background-color: #198754 !important; }
.task-state-error { background-color: #dc3545 !important; }

/* 结果输出区域 */
#resultsOutput {
  margin-top: 15px;
  padding: 15px;
  border: 1px dashed #1a73e8;
  background-color: #e7f1ff;
  white-space: pre-wrap;
  display: none;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* 日志条目样式 */
.log-entry {
  margin-bottom: 8px;
  padding: 8px 12px;
  border-radius: 5px;
  border-left: 4px solid #ced4da;
  background-color: #f8f9fa;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  word-wrap: break-word;
  transition: background-color 0.3s;
}
.log-entry:hover {
  background-color: #f1f3f5;
}
.log-src-FRONTEND { border-left-color: #6c757d; }
.log-src-TASK { border-left-color: #1a73e8; }
.log-src-YTDLP { border-left-color: #fd7e14; }
.log-src-FFMPEG { border-left-color: #6f42c1; }
.log-src-SYSTEM { border-left-color: #dc3545; background-color: #f8d7da; }
.log-src-WEBSOCKET { border-left-color: #0dcaf0; } /* Added */
.log-type-INFO { }
.log-type-START { font-style: italic; color: #1a73e8; }
.log-type-DEBUG { color: #6c757d; font-size: 0.种植85rem; }
.log-type-WARNING { background-color: #fff3cd; border-left-color: #ffc107; }
.log-type-ERROR { background-color: #f8d7da; color: #dc3545; border-left-color: #dc3545; }
.log-type-FATAL { background-color: #f8d7da; color: #dc3545; font-weight: bold; border-left-color: #dc3545; }
.log-type-SUCCESS { background-color: #d1e7dd; color: #0f5132; font-weight: bold; border-left-color: #198754; } /* Adjusted success color */
.log-type-FAILURE { background-color: #f8d7da; color: #dc3545; font-weight: bold; border-left-color: #dc3545; }
.log-type-RESULT { background-color: #cff4fc; border-left-color: #0dcaf0; } /* Adjusted result color */
.log-ts { font-size: 0.85rem; color: #6c757d; margin-right: 10px; }
.log-source { font-weight: bold; margin-right: 8px; }
.log-payload { }

/* UI 块样式 */
.profile-ui-block, .file-result-banner {
  border: 1px solid #c4d9ff;
  background-color: #e7f1ff;
  /* max-width: 650px; Remove max-width to allow flex */
  padding: 15px;
  margin: 10px 0;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* Profile UI Header Refinements */
.profile-header {        /* Uses Bootstrap flex, gap */    }
.profile-thumbnail {
    width: 120px; /* Keep width */
    height: auto; /* Maintain aspect ratio */
    object-fit: cover; /* Cover the area nicely */
    flex-shrink: 0; /* Prevent image shrinking */
}
.profile-thumbnail-placeholder {
    width: 120px;
    height: 68px; /* Approx 16:9 aspect ratio for placeholder */
    flex-shrink: 0;
}
.profile-header-text .profile-title {
    font-size: 1.15rem; /* Slightly larger title */
    font-weight: 600;
    color: #343a40;
}
.profile-header-text .profile-channel strong {        color: #1a73e8; /* Highlight channel name */}
.profile-header-text .profile-details {        line-height: 1.5; }

.hidden-section {
  display: none;
  /* max-width: 620px; Remove max-width */
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed #dee2e6;
}
.formats-table th, .formats-table td {
  font-size: 0.85rem; /* Smaller table text */
  padding: 0.4rem !important; /* Adjust padding */
  vertical-align: middle;
}

.dltd { /* Action 列（Download 按钮） */
  min-width: 120px; /* Adjust width if needed */
  width: 120px;
  text-align: center;
}
/* Style for download buttons in results */
.download-trigger-button {        /* Use existing btn styles */    }
