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

body {
    font-family: 'Arial', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
    margin: 0;
    padding: 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

.text-center {
    text-align: center;
}

.mt-4 {
    margin-top: 1.5rem;
}

.mb-4 {
    margin-bottom: 1.5rem;
}

.btn {
    display: inline-block;
    font-weight: 400;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    user-select: none;
    border: 1px solid transparent;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.btn-primary {
    color: #fff;
    background-color: #007bff;
    border-color: #007bff;
}

.btn-primary:hover {
    color: #fff;
    background-color: #0069d9;
    border-color: #0062cc;
}

.form-group {
    margin-bottom: 1rem;
}

.form-control {
    display: block;
    width: 100%;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
    color: #495057;
    background-color: #fff;
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.alert {
    position: relative;
    padding: 0.75rem 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: 0.25rem;
}

.alert-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

.hidden {
    display: none;
}

/* 链接样式 */
a {
    color: #007bff;
    text-decoration: none;
    background-color: transparent;
}

a:hover {
    color: #0056b3;
    text-decoration: underline;
}

/* 页脚样式 */
footer {
    margin-top: 2rem;
    padding: 1rem 0;
    text-align: center;
    font-size: 0.9rem;
    color: #6c757d;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .container {
        padding: 0 10px;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
}

.logo-image {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

h1 {
    color: #ff0000;
    text-align: center;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

h2 {
    color: #333;
    margin-bottom: 20px;
}

h3 {
    color: #555;
    margin: 15px 0 10px;
    font-size: 1.3rem;
}

h4 {
    color: #666;
    margin: 10px 0 5px;
    font-size: 1.1rem;
}

.api-key-container, .search-section, .results-section, .troubleshooting {
    background-color: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.api-input {
    flex: 1;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.save-btn {
    background-color: #0b7dda;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}

.save-btn:hover {
    background-color: #0b7dda;
}

.test-btn {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    margin-left: 5px;
}

.test-btn:hover {
    background-color: #5a6268;
}

.test-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.api-info {
    margin-top: 10px;
    color: #666;
    font-size: 0.9rem;
}

.api-info a {
    color: #1a73e8;
}

.search-container {
    margin: 20px 0;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.search-hint {
    width: 100%;
    color: #666;
    font-size: 13px;
    margin-top: 5px;
    padding-left: 2px;
}

.network-settings {
    margin: 15px 0;
    display: flex;
    align-items: center;
}

.checkbox-container {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.checkbox-text {
    margin-left: 5px;
    font-size: 0.9rem;
    color: #555;
}

.troubleshooting-content {
    margin-top: 15px;
}

.trouble-item {
    background-color: #f9f9f9;
    border-left: 3px solid #2196F3;
    padding: 10px 15px;
    margin-bottom: 15px;
    border-radius: 0 4px 4px 0;
}

.trouble-item p {
    margin: 5px 0;
    color: #666;
}

.trouble-item ul {
    margin: 8px 0;
    padding-left: 20px;
}

.trouble-item li {
    margin-bottom: 5px;
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .search-container, .input-group {
        flex-direction: column;
    }
}

input, select, button {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

input {
    flex: 1;
    min-width: 200px;
}

button {
    background-color: #e62117;
    color: white;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #c81c0f;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

th, td {
    padding: 12px 15px;
    border-bottom: 1px solid #ddd;
    text-align: left;
}

th {
    background-color: #f8f8f8;
    font-weight: bold;
}

tr:hover {
    background-color: #f5f5f5;
}

.error {
    color: #e62117;
    background-color: #ffe6e6;
    padding: 15px;
    border-radius: 4px;
    margin: 20px 0;
    border-left: 4px solid #e62117;
}

.success {
    color: #4CAF50;
    background-color: #e6ffe6;
    padding: 15px;
    border-radius: 4px;
    margin: 20px 0;
    border-left: 4px solid #4CAF50;
}

#loading {
    text-align: center;
    margin: 30px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.loader {
    border: 5px solid #f3f3f3;
    border-top: 5px solid #e62117;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.no-results {
    text-align: center;
    padding: 30px;
    color: #666;
    font-size: 1.1rem;
}

/* API密钥设置部分 */
.section {
    margin-bottom: 30px;
    padding: 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.api-key-input {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

input[type="text"] {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

button {
    padding: 10px 20px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #45a049;
}

/* 消息样式 */
.message {
    padding: 15px;
    margin: 15px 0;
    border-radius: 4px;
    display: none;
}

.error-message {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.success-message {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.info-message {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* 搜索控件 */
.search-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.search-controls select, 
.search-controls input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.subscriber-range-select {
    min-width: 130px;
}

.video-count-select {
    min-width: 100px;
}

#searchType {
    min-width: 150px;
}

#searchInput {
    flex: 1;
    min-width: 250px;
}

.search-btn {
    padding: 8px 16px;
    background-color: #e53935;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: background-color 0.3s;
}

.search-btn:hover {
    background-color: #d32f2f;
}

/* 加载动画 */
.loading {
    display: none;
    justify-content: center;
    align-items: center;
    margin: 20px 0;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 视频结果网格 */
.video-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
    margin-top: 20px;
}

.video-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

.video-link:hover {
    text-decoration: none;
    color: inherit;
}

.video-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    height: 100%;
    cursor: pointer;
}

.video-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.video-thumbnail {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.video-thumbnail img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

.video-duration {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 1px 4px;
    border-radius: 2px;
    font-size: 11px;
}

.video-info {
    padding: 12px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.video-title {
    margin: 0 0 8px;
    font-size: 13px;
    line-height: 1.3;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    height: 34px;
}

.video-stats-container {
    display: flex;
    justify-content: space-between;
    margin: 8px 0;
    flex-wrap: wrap;
}

.video-stats {
    color: #606060;
    font-size: 11px;
    margin: 4px 0 0 0;
    display: flex;
    align-items: center;
}

.video-stats i {
    margin-right: 4px;
    font-size: 12px;
}

.video-date {
    color: #606060;
    font-size: 11px;
    margin: 6px 0 0 0;
}

.video-channel {
    font-size: 12px;
    color: #065fd4;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
    max-width: 70%;
}

.subscriber-count {
    color: #606060;
    font-size: 11px;
    background-color: #f1f1f1;
    padding: 2px 6px;
    border-radius: 3px;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 3px;
}

.subscriber-count i {
    font-size: 10px;
}

/* 响应式设计：在不同的屏幕尺寸下调整网格列数 */
@media (max-width: 1200px) {
    .video-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 992px) {
    .video-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

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

@media (max-width: 480px) {
    .video-grid {
        grid-template-columns: 1fr;
    }
}

/* API说明部分 */
.api-instructions {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 4px;
    margin-top: 20px;
}

.api-instructions ol {
    padding-left: 20px;
}

.api-instructions li {
    margin-bottom: 10px;
}

.api-instructions a {
    color: #1a73e8;
    text-decoration: none;
}

.api-instructions a:hover {
    text-decoration: underline;
}

/* 排序按钮样式 */
.sort-options {
    margin: 20px 0;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    display: flex;
    gap: 10px;
    justify-content: center;
}

.sort-btn {
    background-color: #fff;
    color: #666;
    border: 1px solid #ddd;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s ease;
}

.sort-btn:hover {
    background-color: #e62117;
    color: white;
    border-color: #e62117;
}

.sort-btn.active {
    background-color: #e62117;
    color: white;
    border-color: #e62117;
}

.sort-btn i {
    font-size: 14px;
}

/* 分页样式 */
.pagination-container {
    margin: 30px 0;
    display: flex;
    justify-content: center;
}

.pagination {
    display: flex;
    gap: 10px;
    align-items: center;
    background: #fff;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.page-btn {
    background: #fff;
    border: 1px solid #ddd;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s ease;
}

.page-btn:hover:not([disabled]) {
    background-color: #e62117;
    color: white;
    border-color: #e62117;
}

.page-btn.active {
    background-color: #e62117;
    color: white;
    border-color: #e62117;
}

.page-btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-btn i {
    font-size: 12px;
}

/* 错误页面样式 */
.error-page {
    text-align: center;
    padding: 50px 0;
}

.error-page h1 {
    font-size: 6rem;
    color: #dc3545;
    margin-bottom: 10px;
}

.error-page h2 {
    font-size: 2rem;
    color: #343a40;
    margin-bottom: 20px;
}

.error-page p {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 30px;
}

.back-btn {
    display: inline-block;
    background-color: #007bff;
    color: white;
    padding: 10px 25px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 1.1rem;
    transition: background-color 0.3s;
}

.back-btn:hover {
    background-color: #0056b3;
}

/* 健康状态页面样式 */
.health-status {
    margin: 30px 0;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #28a745;
}

.health-status p {
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.language-menu {
    display: none;
    position: absolute;
    background-color: #fff;
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
    right: 0;
    top: 100%;
    border-radius: 4px;
}

.language-menu.show {
    display: block !important;
}

/* 表单验证样式 */
.is-invalid {
    border-color: #dc3545;
    padding-right: calc(1.5em + 0.75rem);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23dc3545' viewBox='0 0 12 12'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.invalid-feedback {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 80%;
    color: #dc3545;
}

.api-key-status {
    margin-left: 10px;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 14px;
    display: inline-block;
}

.api-key-status.success {
    background-color: #e7f9ed;
    color: #28a745;
    border: 1px solid #c3e6cb;
}

.api-key-status.warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.channel-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    margin-top: 4px;
}

/* API Key 输入和选择区域 */
.api-key-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
    width: 100%;
}

.api-key-select-container {
    width: 100%;
}

.api-key-select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 16px;
    color: #333;
}

.api-key-input {
    display: flex;
    width: 100%;
}

.api-key-input input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px 0 0 5px;
    font-size: 16px;
}

.api-key-input .save-btn {
    padding: 10px 20px;
    background-color: #4285f4;
    color: white;
    border: none;
    border-radius: 0 5px 5px 0;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}

.api-key-input .save-btn:hover {
    background-color: #3367d6;
}

.api-key-usage-note {
    font-size: 14px;
    color: #e53935;
    margin: 5px 0;
    font-style: italic;
    display: none;
}