
 /**
 * --------------------------------------------------------------------
 * @description 项目的整体样式定义。
 * @author      https://t.me/CCfork
 * @copyright   Copyright (c) 2025, https://t.me/CCfork
 * --------------------------------------------------------------------
 */

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	line-height: 1.6;
	margin: 0;
	background-color: #f8f9fa;
	color: #212529;
	padding: 20px;
}

.container {
	max-width: 90%;
	margin: 20px auto;
	background: #fff;
	padding: 25px;
	border-radius: 12px;
	box-shadow: 0 4px 25px rgba(0, 0, 0, .05);
	border: 1px solid #dee2e6;
}

h1 {
	text-align: center;
	color: #343a40;
	margin-bottom: 25px;
	font-weight: 600;
}

h3 {
	color: #495057;
}

.list-title {
	margin-top: 40px !important;
	border-top: 1px solid #e9ecef;
	padding-top: 20px;
}


.controls-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 8px;
}

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

.top-controls-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.layout-selector {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
}

.layout-selector label {
	font-weight: 500;
	color: #495057;
}

.layout-selector select {
	padding: 5px 10px;
	border-radius: 6px;
	border: 1px solid #ced4da;
	font-size: 14px;
}


.details-panel {
	max-height: 0;
	overflow: hidden;
	background-color: #f8f9fa;
	border-radius: 6px;
	margin-top: 5px;
	transition: max-height .3s ease-in-out, padding .3s ease-in-out, opacity .3s;
	padding: 0 15px;
	opacity: 0;
}

.details-panel.active {
	max-height: 1200px;
	padding: 20px 15px;
	opacity: 1;
}

.details-panel-actions {
	margin-top: 20px;
	padding-top: 15px;
	border-top: 1px solid #e9ecef;
	display: flex;
	justify-content: flex-end;
}

.details-form-grid {
	display: grid;
	gap: 15px 20px;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.details-item {
	display: flex;
	flex-direction: row;
	align-items: center;
}

.details-label {
	font-size: 13px;
	font-weight: 500;
	color: #6c757d;
	margin-right: 10px;
	flex-basis: 80px;
	flex-shrink: 0;
	align-items: flex-start;
}

.details-input {
	width: 100%;
	padding: 6px 10px;
	border: 1px solid #ced4da;
	border-radius: 4px;
	font-size: 14px;
	background-color: #fff;
	cursor: initial;
    min-width: 0;
}

.details-panel textarea {
	min-height: 60px;
	resize: vertical;
	font-family: monospace;
	font-size: 13px;
	line-height: 1.5;
}

.rule-list-grid {
	display: grid;
	gap: 20px;
	grid-template-columns: repeat(var(--grid-columns, 2), 1fr);
}

.rule-item-container {
    position: relative;
	background-color: #f8f9fa;
	border: 1px solid #e9ecef;
	border-radius: 8px;
	padding: 15px;
    padding-right: 35px; 	transition: transform .2s ease-in-out, box-shadow .2s ease-in-out;
    overflow: hidden;
}

.rule-item-container:hover {
	transform: translateY(-3px);
	box-shadow: 0 4px 15px rgba(0, 0, 0, .08);
}

.delete-item-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    padding: 0; 
    height: 24px;
    background-color: #dc3545;
    border: 2px solid white;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    line-height: 1;
    box-shadow: 0 1px 4px rgba(0,0,0,0.25);
    transition: all 0.2s ease-in-out;
    z-index: 10;
    opacity: 0;
    transform: scale(0.5);
}

.rule-item-container:hover .delete-item-btn {
    opacity: 1;
    transform: scale(1);
}

.delete-item-btn:hover {
    transform: scale(1.15);
    background-color: #c82333;
}


.file-list-container {
    padding: 10px 20px !important;
}

ul.file-list,
ul.file-list ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

ul.file-list ul {
    padding-left: 20px;
}

.file-list-item {
    display: flex;
    align-items: center;
    padding: 6px 0;
    cursor: default; }

.file-list-item.is-dir {
    font-weight: 500;
    cursor: pointer;
}

.file-list-item.is-dir:hover,
.file-list-item label:hover {
    background-color: #f1f3f5;
}

.file-list-item label {
    display: flex;
    align-items: center;
    cursor: pointer;
    width: 100%;
}

.file-list-item .icon {
    margin-right: 8px;
    width: 20px;
    text-align: center;
}

.file-list li.dir.collapsed > ul {
    display: none;
}

.toggle-icon {
    width: 1.2em;
    text-align: center;
    display: inline-block;
    font-weight: bold;
    color: #888;
    transition: transform 0.2s; }

.dir:not(.collapsed) .toggle-icon {
    transform: rotate(90deg);
}

.download-status {
    display: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-left: 8px;
    vertical-align: middle;
    background-color: #adb5bd;     border: 1px solid rgba(0,0,0,0.1);
    transition: background-color 0.3s;
}

.show-status .download-status {
    display: inline-block;
}

.download-status.downloading {
    background-color: #ffc107;
    animation: pulse 1.5s infinite;
}

.download-status.downloaded {
    background-color: #28a745;
}

.download-status.failed {
    background-color: #dc3545;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(255, 193, 7, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 193, 7, 0); }
}

.shake-on-delete {
    animation: shake-animation 0.7s ease-in-out both;
}

@keyframes shake-animation {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-3px); }
  40%, 60% { transform: translateX(3px); }
}

.item-fade-out {
    animation: fade-out-animation 0.4s ease-out forwards;
}

.variable-accordion {
    display: none;
    flex-direction: column;
    gap: 15px;
    margin-left: 160px;
    margin-top: 8px;
    padding: 15px;
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}
.variable-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.variable-item {
    padding: 5px 12px;
    background-color: #e9ecef;
    border: 1px solid #dee2e6;
    color: #495057;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease-in-out;
}
.variable-item:hover {
    background-color: #dee2e6;
    border-color: #adb5bd;
    transform: translateY(-1px);
}
.example-code {
    font-family: 'Courier New', Courier, monospace;
    white-space: pre-wrap;
    word-break: break-all;
    background-color: #f8f9fa;
    padding: 10px;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    font-size: 13px;
    color: #343a40;
    margin-bottom: 8px;
}

@keyframes fade-out-animation {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(0.95); }
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.file-info {
    flex: 1;
    min-width: 200px;
}

.file-path {
    display: flex;
    align-items: center;
    font-size: 18px;
    font-weight: 500;
    color: #495057;
    margin-bottom: 5px;
}

.file-icon {
    margin-right: 8px;
    font-size: 20px;
}

.full-path {
    font-size: 13px;
    color: #6c757d;
    word-break: break-all;
}
.header-actions {
    flex-shrink: 0;
}
.file-list-item input[type="radio"] {
    width: auto !important;
    margin-right: 8px;
}

.main-header {
    gap: 0.3rem;
    margin-bottom: 20px;
}
.header-row {
    width: 100%;
}
.file-path {
    display: flex;
    align-items: center;
    font-size: 16px;
    font-weight: 500;
    color: #495057;
}
.file-icon {
    margin-right: 8px;
    font-size: 18px;
}
#sourceCodeView {
    display: block;
    white-space: pre-wrap;
    word-break: break-all;
    background-color: #282c34;     color: #abb2bf;     padding: 1em;
    border-radius: 6px;
    font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
    font-size: 14px;
}
#historyList {
    list-style: none;
    padding: 0;
    margin: 0;
}
.history-item {
    padding: 10px 15px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.2s ease;
    word-break: break-all;
    font-size: 14px;
}
.history-item:last-child {
    border-bottom: none;
}
.history-item:hover {
    background-color: #f8f9fa;
}
.api-filter-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 40vh;
    overflow-y: auto;
    padding: 5px;
}
.api-filter-grid::-webkit-scrollbar {
    width: 6px;
}

.api-filter-grid::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}
.ai-helper-content::-webkit-scrollbar-thumb,
.api-filter-grid::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

.ai-helper-content::-webkit-scrollbar-thumb:hover,
.api-filter-grid::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}
#health-check-results ul {
    max-height: 40vh; 
    overflow-y: auto;
    padding-right: 10px;
    overscroll-behavior: contain;
}

#health-check-results ul::-webkit-scrollbar {
    width: 6px;
}
#health-check-results ul::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 5px;
}
#health-check-results ul::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 5px;
}
#health-check-results ul::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

.health-status {
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 4px;
    color: white;
}
.status-pending { background-color: #6c757d; }
.status-success { background-color: #28a745; }
.status-error { background-color: #dc3545; }
.status-warning { background-color: #ffc107; color: #343a40; }

#health-check-results li > span {
    white-space: nowrap;
    overflow-x: auto;
    text-overflow: ellipsis;
    display: block; 
    padding-bottom: 5px;
}

.health-status {
    font-weight: 500;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 4px;
    color: white;
    flex-shrink: 0;
}

#health-check-results li > span::-webkit-scrollbar {
    height: 4px;
}
#health-check-results li > span::-webkit-scrollbar-track {
    background: transparent;
}
#health-check-results li > span::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 2px;
}


.input-with-buttons {
	width: 100%;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

/* 筛选编辑器样式 */
.filter-editor-simple-layout {
    display: flex;
    flex-direction: column;
    padding: 15px;
    gap: 15px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    background: #f8f9fa;
    min-height: 400px;
}

.filter-editor-content-wrap {
    display: flex;
    gap: 15px;
    flex-grow: 1;
    min-height: 0;
}

.filter-editor-left-panel,
.filter-editor-right-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.filter-editor-left-panel {
    flex-grow: 1;
    min-width: 0;
}
.filter-editor-left-panel textarea {
    flex-grow: 1;
    min-height: 200px;
    font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
    transition: opacity 0.3s ease;
}

.filter-editor-right-panel {
    flex-shrink: 0;
    width: 200px;
}

.filter-editor-buttons {
    flex-shrink: 0;
}

.filter-categories-list {
    list-style: none;
    padding: 0;
    margin: 0;
    flex-grow: 1;
    overflow-y: auto;
    min-height: 0;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
}
.filter-categories-list li {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #e9ecef;
    font-weight: 500;
}
.filter-categories-list li:last-child {
    border-bottom: none;
}
.filter-categories-list li:hover {
    background-color: #e9f4ff;
}
.filter-categories-list li.active {
    background-color: #007bff;
    color: #fff;
    border-color: #007bff;
}
.category-edit-input {
    display: none;
    width: 100%;
    padding: 2px 5px;
    border: 1px solid #007bff;
    border-radius: 3px;
    outline: none;
    font-weight: 500;
}
.filter-categories-list li.is-editing .category-name-span {
    display: none;
}
.filter-categories-list li.is-editing .category-edit-input {
    display: block;
}
.placeholder-text {
    text-align: center;
    color: #6c757d;
    padding: 20px;
}

/* 变量样式 */
.variable-accordion {
    display: none;
    flex-direction: column;
    gap: 15px;
    margin-top: 8px;
    padding: 15px;
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}
.variable-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.variable-item {
    padding: 5px 12px;
    background-color: #e9ecef;
    border: 1px solid #dee2e6;
    color: #495057;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease-in-out;
}
.variable-item:hover {
    background-color: #dee2e6;
    border-color: #adb5bd;
    transform: translateY(-1px);
}

/* 文件列表项布局 */
.file-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-radius: 4px;
    margin: 2px 0;
    transition: background-color 0.2s;
}

.file-list-item:hover {
    background-color: #f0f0f0;
}

.file-list-item .file-info-section {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-list-item label {
    display: flex;
    align-items: center;
    cursor: pointer;
    margin: 0;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-list-item .file-actions {
    margin-left: 10px;
}

/* 改进的下拉菜单样式 */
.file-list .dropdown-menu {
    min-width: 120px;
    right: 0;
    left: auto;
}

.file-list .dropdown-toggle {
    padding: 3px 8px;
    font-size: 12px;
}

/* 更好的目录树缩进 */
.file-list ul.nested {
    padding-left: 20px;
    margin-top: 4px;
}

/* 更明显的选中状态 */
.dir.selected > .file-list-item {
    background-color: rgba(13, 110, 253, 0.1);
    border-left: 3px solid #0d6efd;
}

/* 处理文件图标和文本的对齐 */
.file-list-item .icon {
    margin-right: 6px;
    min-width: 16px;
    text-align: center;
}

/* 美化下拉菜单 */
.dropdown-item {
    padding: 6px 12px;
    font-size: 13px;
}

.dropdown-item:hover {
    background-color: #f8f9fa;
}

.dropdown-item.text-danger {
    color: #dc3545;
}

.dropdown-item.text-danger:hover {
    background-color: #fcf0f1;
}

.dropdown-menu {
  display: none; /* 默认隐藏 */
  position: absolute;
  z-index: 1000;
}

.dropdown-menu.active {
  display: block;
}

.dropdown.dropup .dropdown-menu {
  top: auto;
  bottom: 100%;
  margin-top: 0;
  margin-bottom: 2px; 
}
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background-color: #ccc;
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: content-box;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background-color: #aaa;
}

.info-banner-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background-color: #e6f7ff;
    border: 1px solid #91d5ff;
    color: #0d6efd;
    padding: 6px 10px;
    border-radius: 4px;
    margin: 8px 0;
    overflow: hidden;
    box-sizing: border-box;
}

.info-banner-text-wrapper {
    flex-grow: 1;
    overflow: hidden;
    white-space: nowrap;
}

.info-banner-text {
    display: inline-block;
    padding-left: 100%;
    animation: marquee 20s linear infinite;
    font-size: 13px;
    font-weight: 500;
}

.info-banner-close {
    background: none;
    border: none;
    color: #0d6efd;
    font-size: 20px;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
    padding: 0 5px;
    margin-left: 10px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.info-banner-close:hover {
    opacity: 1;
}
.header-top-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    flex-grow: 1;
}

/* 确保提示横幅本身能灵活伸缩 */
.header-right-controls {
    flex-shrink: 1;
    min-width: 200px;
}


.global-actions .btn-group {
    white-space: nowrap;
}
.test-content {
    background:#f8f9fa;
    border:1px solid #e9ecef;
    padding:10px;
    border-radius:6px;
    min-height:40vh;
    max-height:100px;
    overflow-y:auto;
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}

.test-content::-webkit-scrollbar {
    width: 6px;
}

.test-content::-webkit-scrollbar-track {
    background: transparent;
}

.test-content::-webkit-scrollbar-thumb {
    background-color: #ccc;
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: content-box;
}

.test-content::-webkit-scrollbar-thumb:hover {
    background-color: #aaa;
}


@keyframes marquee {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-150%);
    }
}

@media (max-width:768px) {
	body {
		padding: 10px;
	}
	
	.container {
		max-width: none;
		margin: 0;
		padding: 10px;
		border: none;
		box-shadow: none;
	}
	
	.input-with-buttons {
		flex-direction: column;
		align-items: stretch;
	}
	
	.input-with-buttons .action-btn-group {
		margin-left: 0;
		/* margin-top: 10px; */
		display: grid;
		grid-template-columns: repeat(3, 1fr);
	}
	

	.controls-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .left-controls,
    .top-controls-row {
        width: 100%;
    }
    

	.rule-list-grid,
	.details-form-grid {
		grid-template-columns: 1fr;
	}
	
	.layout-selector {
		display: none;
	}

    .variable-accordion {
        margin-left: 0;
    }
    .header-container {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .header-actions {
        width: 100%;
    }
    
    .btn-group {
        width: 100%;
    }

    /* 筛选编辑器样式 */
    .filter-editor-content-wrap {
        flex-direction: column;
        min-height: 400px;
    }
    .filter-editor-left-panel,
    .filter-editor-right-panel {
        width: 100%;
        height: auto;
        min-height: 0;
    }
    .filter-editor-left-panel {
        order: 2;
        flex: 1 1 0%;
        min-height: 220px;
        display: flex;
        flex-direction: column;
    }
    .filter-editor-left-panel textarea {
        flex: 1 1 auto !important;
        min-height: 200px !important;
        height: auto !important;
        max-height: 60vh !important;
        resize: vertical;
        width: 100%;
        box-sizing: border-box;
    }
}
