/* 扁平化设计 - 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;
    gap: 12px;
    align-items: flex-end;
}

.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;
}

/* 域名生成器样式 */
.row {
    display: flex;
    margin: 0 -10px;
    gap: 20px;
}

.col-md-6 {
    flex: 1;
    padding: 0 10px;
}

.config-section, .result-section, .help-section {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.config-section h5, .result-section h5, .help-section h5 {
    margin-bottom: 20px;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    font-weight: normal;
    margin-bottom: 0;
}

.checkbox-group input[type="checkbox"] {
    margin-right: 8px;
}

.port-config {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.port-config label {
    display: flex;
    align-items: center;
    font-weight: normal;
    margin-bottom: 0;
}

.port-config input[type="radio"] {
    margin-right: 8px;
}

.d-inline {
    display: inline-block !important;
}

.btn-block {
    width: 100%;
    margin-bottom: 10px;
}

.result-preview {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 15px;
    min-height: 400px;
    max-height: 600px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
}

.result-preview pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 13px;
    line-height: 1.5;
}

.result-stats {
    margin-top: 15px;
    padding: 10px;
    background: #e3f2fd;
    border: 1px solid #bbdefb;
    border-radius: 4px;
    font-size: 13px;
}

.float-right {
    float: right;
}

.help-content {
    font-size: 14px;
    color: var(--text-secondary);
}

.help-content ul {
    margin-left: 20px;
    margin-bottom: 15px;
}

.help-content li {
    margin-bottom: 5px;
}

.help-content strong {
    color: var(--text-primary);
}

/* 响应式调整 */
@media (max-width: 768px) {
    .row {
        flex-direction: column;
    }
    
    .col-md-6 {
        width: 100%;
    }
    
    .result-preview {
        min-height: 300px;
        max-height: 400px;
    }
}

/* 域名生成器新布局 */
.generator-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.config-panel, .result-panel {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
}

.config-panel h5, .result-panel h5 {
    margin-bottom: 20px;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.config-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.config-column {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.parse-options {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.option-inline {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-weight: normal;
    cursor: pointer;
}

.option-inline input[type="checkbox"] {
    cursor: pointer;
}

.option-inline span {
    font-weight: 500;
    color: var(--text-primary);
}

.option-inline input[type="text"] {
    width: 80px;
    margin-left: 5px;
}

.mode-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mode-option {
    display: flex;
    flex-direction: column;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.mode-option:hover {
    border-color: var(--primary-color);
    background: #f8f9fa;
}

.mode-option input[type="radio"] {
    margin-right: 8px;
}

.mode-option span {
    font-weight: 500;
    color: var(--text-primary);
}

.mode-option small {
    color: var(--text-secondary);
    font-size: 12px;
    margin-left: 24px;
}

.sub-config {
    margin-top: 10px;
    padding-left: 24px;
}

.action-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.result-count {
    color: var(--primary-color);
    font-size: 14px;
    font-weight: normal;
}

.help-panel {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
}

.help-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.help-item {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
}

.help-item h6 {
    margin-bottom: 10px;
    color: var(--text-primary);
    font-size: 14px;
}

.help-item code {
    display: block;
    padding: 8px;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 12px;
    margin-bottom: 5px;
    word-break: break-all;
}

.help-item p {
    margin: 10px 0 0 0;
    font-size: 13px;
    color: var(--text-secondary);
}

/* 响应式调整 */
@media (max-width: 1200px) {
    .generator-container {
        grid-template-columns: 1fr;
    }
    
    .config-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .parse-options {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .action-buttons {
        flex-wrap: wrap;
    }
    
    .action-buttons .btn {
        flex: 1;
        min-width: 120px;
    }
}