/* 扁平化设计 - CDN管理系统样式 */
:root {
    --primary-color: #007AFF;
    --success-color: #34C759;
    --warning-color: #FF9500;
    --danger-color: #FF3B30;
    --gray-light: #F5F5F7;
    --gray-medium: #E5E5E7;
    --gray-dark: #86868B;
    --text-primary: #1D1D1F;
    --text-secondary: #6E6E73;
    --white: #FFFFFF;
    --border-color: #D2D2D7;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--gray-light);
    line-height: 1.5;
}

/* 导航条样式 */
.navbar {
    background: var(--white);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.navbar-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.navbar-info {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 13px;
    color: var(--text-secondary);
}

.navbar-info span {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* 主容器 */
.main-wrapper {
    margin-top: 60px;
    padding: 20px;
}

.container-fluid {
    max-width: 100%;
    margin: 0 auto;
    width: 100%;
}

/* 搜索区域 */
.search-section {
    background: var(--white);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    padding: 20px;
    margin-bottom: 20px;
}

.search-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.search-options {
    margin: 0;
}

.search-buttons {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.form-check:hover {
    background: var(--hover-bg);
    border-color: var(--primary-color);
}

.form-check-input {
    margin: 0;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.form-check-input:checked {
    background: var(--primary-color);
    border-color: var(--primary-color);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e");
}

.form-check-label {
    font-size: 14px;
    color: var(--text-color);
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
}

.form-check-label i {
    color: var(--primary-color);
    font-size: 12px;
}

/* 精确匹配图标样式 */
.domain-name-cell {
    position: relative;
}

.exact-match-icon {
    color: var(--primary-color);
    font-size: 12px;
    margin-left: 6px;
    opacity: 0.8;
    transition: all 0.2s ease;
}

.exact-match-icon:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* 精确匹配行的特殊样式 */
tr[data-exact-match="true"] {
    border-left: 3px solid var(--primary-color);
}

tr[data-exact-match="true"] .domain-name-cell {
    font-weight: 500;
    color: var(--primary-color);
}

/* 精确匹配统计信息样式 */
.exact-match-stats {
    color: var(--primary-color) !important;
    font-weight: 600;
    text-shadow: 0 0 2px rgba(0, 123, 255, 0.3);
}

/* 批量控制区域样式 */
.batch-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px 8px 0 0;
    margin-bottom: 0;
}

.batch-controls-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.batch-controls-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.select-all-container {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    font-size: 14px;
    font-weight: 500;
}

.select-all-container input[type="checkbox"] {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.select-all-container input[type="checkbox"]:checked {
    background: var(--primary-color);
    border-color: var(--primary-color);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e");
}

.selected-count {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* 表格行选中状态样式 */
.table tbody tr.selected {
    background-color: rgba(0, 123, 255, 0.1) !important;
    border-left: 3px solid var(--primary-color);
}

.table tbody tr.selected:hover {
    background-color: rgba(0, 123, 255, 0.15) !important;
}

/* 可点击行样式 */
.table tbody tr.clickable-row {
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.table tbody tr.clickable-row:hover {
    background-color: rgba(0, 123, 255, 0.05) !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.table tbody tr.clickable-row.selected:hover {
    background-color: rgba(0, 123, 255, 0.15) !important;
}

/* 行点击提示 */
.table tbody tr.clickable-row::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: transparent;
    transition: all 0.2s ease;
}

.table tbody tr.clickable-row:hover::before {
    background: var(--primary-color);
    opacity: 0.3;
}

/* 行复选框样式 */
.table tbody tr td:first-child {
    text-align: center;
    vertical-align: middle;
}

.table tbody tr td:first-child input[type="checkbox"] {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.table tbody tr td:first-child input[type="checkbox"]:checked {
    background: var(--primary-color);
    border-color: var(--primary-color);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e");
}

/* 表格头部复选框样式 */
.table thead tr th:first-child {
    text-align: center;
}

.table thead tr th:first-child input[type="checkbox"] {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.table thead tr th:first-child input[type="checkbox"]:checked {
    background: var(--primary-color);
    border-color: var(--primary-color);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e");
}

/* 复制成功提示动画 */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.copy-success-toast {
    animation: slideInRight 0.3s ease;
}

/* 表格列数调整 */
.table .empty-state td {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.table .empty-state i {
    font-size: 48px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    display: block;
}

.table .empty-state p {
    margin: 0;
    font-size: 16px;
}

.form-group {
    flex: 1;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    outline: none;
}

.form-control:focus {
    border-color: var(--primary-color);
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

/* 按钮样式 */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    outline: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary-color);
    color: var(--white);
}

.btn-primary:hover {
    background: #0051d5;
}

.btn-secondary {
    background: var(--gray-medium);
    color: var(--text-primary);
}

.btn-success {
    background: var(--success-color);
    color: var(--white);
}

.btn-warning {
    background: var(--warning-color);
    color: var(--white);
}

.btn-danger {
    background: var(--danger-color);
    color: var(--white);
}

.btn-info {
    background: #17a2b8;
    color: var(--white);
}

.btn-info:hover {
    background: #138496;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

/* 操作栏 */
.action-bar {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.action-buttons {
    display: flex;
    gap: 8px;
}

.selected-count {
    color: var(--text-secondary);
}

.selected-count strong {
    color: var(--primary-color);
}

/* 结果表格 */
.table-section {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: visible;
}

.table {
    width: 100%;
    border-collapse: collapse !important;
    background: var(--white);
}

/* 简化的表格边框规则 - 确保所有单元格都有边框 */
.table th,
.table td {
    border: 1px solid #dee2e6 !important;
    padding: 12px;
    vertical-align: middle;
}

.table thead th {
    background: #f8f9fa;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 13px;
    text-align: left;
}

.table tbody tr:hover {
    background: #f8f9fa !important;
}

/* 状态标签 */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background: #E8F5E9;
    color: #2E7D32;
}

.badge-warning {
    background: #FFF3E0;
    color: #E65100;
}

.badge-danger {
    background: #FFEBEE;
    color: #C62828;
}

.badge-info {
    background: #E3F2FD;
    color: #1565C0;
}

.badge-primary {
    background: #E8EAF6;
    color: #3F51B5;
}

/* 复选框 */
.form-check-input {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* 站点分组 */
.site-group {
    background: var(--white) !important;
}

/* WAF规则列 */
.waf-rules {
    font-size: 12px;
    color: var(--text-secondary);
}

.waf-rule-badge {
    display: inline-block;
    padding: 3px 8px;
    background: #e9ecef;
    border: 1px solid #dee2e6;
    border-radius: 3px;
    margin-right: 4px;
    margin-bottom: 2px;
    font-size: 11px;
}

.waf-rule-badge.system-rule {
    background: #e8f5e9;
    border: 1px solid #c8e6c9;
    color: #2e7d32;
}

/* 查询统计 */
.stats-section {
    background: #E8F5FF;
    border: 1px solid #B3D9FF;
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 20px;
    font-size: 13px;
    color: var(--text-secondary);
}

.stats-highlight {
    color: var(--primary-color);
    font-weight: 600;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
}

.modal-content {
    background: var(--white);
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    overflow: hidden;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h5 {
    margin: 0;
    font-size: 16px;
}

.modal-body {
    padding: 20px;
    max-height: calc(85vh - 120px);
    overflow-y: auto;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.btn-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
}

/* Tab导航 */
.nav-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.nav-tab {
    padding: 8px 16px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

.nav-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* 响应式 */
@media (max-width: 768px) {
    .navbar-info {
        display: none;
    }
    
    .search-form {
        flex-direction: column;
    }
    
    .action-bar {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    .table {
        font-size: 12px;
    }
    
    .table thead th,
    .table tbody td {
        padding: 8px;
    }
    
    .modal-content {
        width: 95%;
        max-height: 90vh;
    }
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 48px;
    opacity: 0.3;
    display: block;
    margin-bottom: 16px;
}

/* 历史记录表格悬停效果 */
#historyTableBody tr {
    transition: background-color 0.2s;
}

#historyTableBody tr:hover {
    background-color: #f0f0f0;
}

/* 选项卡片样式 */
.option-card {
    flex: 1;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
    cursor: pointer;
    text-align: center;
    background: var(--gray-light);
    display: block;
}

.option-card:hover {
    background: var(--gray-medium);
}

.option-card.selected {
    border-color: var(--primary-color);
    background: #E8F5FF;
    color: var(--primary-color);
}

/* 表单组 */
.form-group {
    margin-bottom: 16px;
}

/* 域名预览项 */
.domain-preview-item {
    padding: 8px;
    margin-bottom: 4px;
    background: var(--gray-light);
    border-radius: 4px;
    font-size: 13px;
}

.domain-preview-item .domain-name {
    font-weight: 500;
    color: var(--primary-color);
}

.domain-preview-item .domain-info {
    font-size: 11px;
    color: var(--text-secondary);
}

/* 自定义端口样式 */
#customPortsList {
    max-height: 200px;
    overflow-y: auto;
}

#customPortsList .form-control {
    display: inline-block;
}

#customPortsList label {
    margin-bottom: 0;
    font-weight: normal;
    cursor: pointer;
}

/* 端口徽章样式 */
.port-badge {
    display: inline-block;
    padding: 3px 8px;
    background: #e3f2fd;
    border: 1px solid #bbdefb;
    color: #1565c0;
    border-radius: 3px;
    font-size: 11px;
    margin-right: 4px;
    margin-bottom: 2px;
}

.port-badge.custom-port {
    background: #fff3e0;
    border: 1px solid #ffe0b2;
    color: #e65100;
}

/* 源站徽章样式 */
.origin-badge {
    display: inline-block;
    padding: 3px 8px;
    background: #f3e5f5;
    border: 1px solid #e1bee7;
    color: #6a1b9a;
    border-radius: 3px;
    font-size: 11px;
    margin-right: 4px;
    margin-bottom: 2px;
}

.origin-badge.ip {
    background: #e8f5e9;
    border: 1px solid #c8e6c9;
    color: #2e7d32;
}

.origin-badge.domain {
    background: #fce4ec;
    border: 1px solid #f8bbd0;
    color: #c2185b;
}

/* 站点分组样式（用于排序时的平铺显示） */
.site-separator {
    border: none !important;
}

.site-separator td {
    border: none !important;
    padding: 0 !important;
}

.site-row {
    transition: background-color 0.2s ease;
}

.site-row:hover {
    filter: brightness(0.95);
}

.site-id-cell.first-in-site {
    font-weight: 600;
    color: var(--primary-color);
    border-left: 3px solid var(--primary-color);
    padding-left: 8px !important;
}

.site-id-cell.continuation {
    color: var(--gray-dark);
    font-size: 12px;
    border-left: 3px solid transparent;
    padding-left: 8px !important;
    position: relative;
}

.site-id-cell.continuation::before {
    content: "└─";
    color: var(--gray-dark);
    font-size: 10px;
    position: absolute;
    left: 2px;
    top: 50%;
    transform: translateY(-50%);
}

/* 筛选功能样式 */
.filter-dropdown {
    position: relative;
    display: inline-block;
    margin-left: 8px;
}

.filter-icon {
    color: var(--gray-dark);
    font-size: 12px;
    cursor: pointer;
    padding: 2px;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.filter-icon:hover {
    color: var(--primary-color);
    background-color: rgba(0, 122, 255, 0.1);
}

.filter-icon.active {
    color: var(--primary-color);
    background-color: rgba(0, 122, 255, 0.2);
}

.filter-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    z-index: 1000;
    display: none;
    padding: 8px 0;
}

.filter-menu.show {
    display: block;
}

.filter-search {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 8px;
}

.filter-search input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 12px;
    outline: none;
}

.filter-search input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.2);
}

.filter-options {
    max-height: 200px;
    overflow-y: auto;
    padding: 0 4px;
}

.filter-options label {
    display: block;
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
    border-radius: 4px;
    margin: 2px 0;
    transition: background-color 0.2s ease;
}

.filter-options label:hover {
    background-color: var(--hover-color);
}

.filter-options input[type="checkbox"] {
    margin-right: 8px;
    transform: scale(0.9);
}

.filter-options label.all-option {
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 8px;
    padding-bottom: 8px;
}

.first-in-site {
    font-weight: 500;
}

.continuation {
    color: var(--gray-dark);
    font-size: 13px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .navbar-container {
        flex-direction: column;
        gap: 10px;
    }

    .search-form {
        flex-direction: column;
    }

    .action-bar {
        flex-direction: column;
        gap: 10px;
    }

    .action-buttons {
        flex-wrap: wrap;
        justify-content: center;
    }

    .table-responsive {
        font-size: 12px;
    }

    .modal-dialog {
        margin: 10px;
    }

    .site-id-cell.continuation::before {
        display: none;
    }
}