/* ============================================
   后台管理系统 - 补充样式（仅含前台没有的）
   前台基础样式由 css/style.css 提供
   路径：admin/css/admin.css
   ============================================ */

/* ========== 后台主内容区背景 ========== */
.main-content {
    background: var(--bg-primary);
    color: #e2e8f0;
    position: relative;
}
.main-content::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 240px;
    background: radial-gradient(ellipse 60% 100% at 30% 0%, rgba(59,130,246,0.06) 0%, transparent 70%),
                radial-gradient(ellipse 50% 80% at 80% 10%, rgba(139,92,246,0.05) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}
.main-content > * { position: relative; z-index: 1; }
.main-content h1,
.main-content h2,
.main-content h3,
.main-content .page-title {
    color: #f1f5f9;
}

/* ========== 登录页面 ========== */
body {
    background: linear-gradient(135deg, #0a0e1a 0%, #1a1f35 50%, #0d1224 100%);
    min-height: 100vh;
    color: #f1f5f9;
}
.login-header h1 { color: #f1f5f9; }
.login-header p { color: #94a3b8; }
.login-form label { color: #cbd5e1; }
.login-form input {
    background: #1a2235;
    border-color: #2a3548;
    color: #f1f5f9;
}
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}
.login-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 400px; padding: 40px;
    box-shadow: var(--shadow-lg);
}
.login-header { text-align: center; margin-bottom: 28px; }
.login-icon {
    width:56px; height:56px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    border-radius: var(--radius-lg);
    display: flex; align-items: center; justify-content: center;
    font-size:26px; margin: 0 auto 16px;
    box-shadow: 0 4px 16px var(--accent-blue-glow);
}
.login-header h1 { font-size:22px; font-weight:700; margin-bottom:6px; }
.login-header p { color: var(--text-muted); font-size:13px; }
.login-form .form-group { margin-bottom: 20px; }
.btn-block { width:100%; padding:12px; font-size:14px; }
.login-footer { text-align:center; margin-top:20px; }
.login-footer a {
    color: var(--text-muted); font-size:13px;
    text-decoration:none; transition: var(--transition);
}
.login-footer a:hover { color: var(--accent-blue); }

.alert {
    padding:10px 14px; border-radius: var(--radius-sm);
    font-size:13px; margin-bottom:16px;
}
.alert-error {
    background: var(--accent-red-bg);
    color: var(--accent-red);
    border:1px solid rgba(239,68,68,0.2);
}

/* ========== 后台侧边栏补充（在前台 .sidebar-nav-quick / .quick-nav-item 基础上） ========== */
.sidebar {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5), -2px 0 8px rgba(59, 130, 246, 0.04);
    border-right: 1px solid var(--border-color);
}
.sidebar::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 1px;
    background: linear-gradient(to bottom, transparent, rgba(59, 130, 246, 0.25), rgba(139, 92, 246, 0.15), transparent);
}
.sidebar-header {
    background: rgba(17, 24, 39, 0.6);
    border-bottom-color: #1e293b;
    box-shadow: 0 1px 8px rgba(0, 0, 0, 0.3);
}
.sidebar-header h1,
.sidebar-header span {
    color: #f1f5f9;
}
.sidebar-nav-quick {
    background: transparent;
    border-bottom-color: #1e293b;
}
.quick-nav-item {
    color: #94a3b8 !important;
}
.quick-nav-item:hover {
    color: #3b82f6 !important;
}
.quick-nav-item.active {
    color: #3b82f6 !important;
}
.sidebar-footer { padding:12px 16px; border-top:1px solid var(--border-color); flex-shrink:0; margin-top:auto; }
.admin-status {
    display:flex; align-items:center; gap:8px;
    font-size:12px; color:var(--text-muted);
    padding: 4px 0;
}
.status-dot {
    width:8px; height:8px; border-radius:50%;
    background: #34d399;
    box-shadow: 0 0 8px rgba(52,211,153,0.6), 0 0 16px rgba(52,211,153,0.25);
    animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.5} }

.btn-logout {
    display:block; text-align:center; padding:8px;
    border-radius: var(--radius-sm); font-size:12px;
    color: var(--accent-red); text-decoration:none;
    border:1px dashed var(--border-color);
    transition: var(--transition);
    margin-top: 2px;
}
.btn-logout:hover {
    background: var(--accent-red-bg);
    border-color: var(--accent-red);
}

/* ========== 颜色选择器 ========== */
.color-picker { display:flex; flex-wrap:wrap; gap:10px; }

/* ========== 默认按钮高亮样式 ========== */
.action-btn.default-star {
    color: var(--accent-amber);
    font-weight: bold;
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.5);
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.2);
}
.action-btn.default-star:hover {
    background: rgba(245, 158, 11, 0.25);
    border-color: var(--accent-amber);
    color: var(--accent-amber);
}

/* ========== 公司列表 - 项目分组样式 ========== */
.data-table tr.project-group-header { cursor: default; }
.data-table tr.project-group-header:hover { background: inherit !important; }
.data-table tr.project-group-header td { font-weight: 600; }
.color-option { cursor:pointer; }
.color-option input[type="radio"] { display:none; }
.color-swatch {
    display:inline-block; width:32px; height:32px;
    border-radius:50%; border:3px solid transparent;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}
.color-option input[type="radio"]:checked + .color-swatch {
    border-color: #fff;
    transform: scale(1.15);
    box-shadow: 0 0 0 2px var(--bg-secondary), 0 2px 10px rgba(0,0,0,0.35);
}
.color-option:hover .color-swatch { transform: scale(1.08); }

/* ========== 返回顶部按钮 ========== */
.back-to-top {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 999;
}
.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.back-to-top:hover {
    background: var(--accent-blue);
    color: #fff;
    border-color: var(--accent-blue);
    box-shadow: 0 4px 12px rgba(59,130,246,0.4);
}

/* ========== 响应式 ========== */
@media(max-width:768px) {
    .login-card { width:95%; padding:28px; }
}

/* ========== 全局表单控件样式 ========== */
input:not([type="radio"]):not([type="checkbox"]):not([type="hidden"]):not([type="file"]):not([type="range"]),
select,
textarea {
    background-color: #1e293b !important;
    border: 1px solid var(--border-color, #4a6080);
    border-radius: var(--radius-sm, 6px);
    color: var(--text-primary, #f1f5f9);
    padding: 8px 12px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: var(--transition, all 0.25s ease);
}
select {
    padding-right: 28px;
}

input:not([type="radio"]):not([type="checkbox"]):not([type="hidden"]):not([type="file"]):not([type="range"]):focus,
select:focus,
textarea:focus {
    border-color: var(--accent-blue, #3b82f6);
    box-shadow: 0 0 0 3px var(--accent-blue-glow, rgba(59, 130, 246, 0.25));
}

input:not([type="radio"]):not([type="checkbox"]):not([type="hidden"]):not([type="file"]):not([type="range"])::placeholder,
select::placeholder,
textarea::placeholder {
    color: var(--text-muted, #64748b);
}

/* 数字输入框右侧微调按钮样式 */
input[type="number"] {
    -moz-appearance: textfield;
}
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    opacity: 1;
    height: 24px;
}

/* 日期输入框日历图标颜色 */
input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(0.6);
    cursor: pointer;
}

/* ========== 统一板块卡片样式（全局兜底） ==========
   后台各页面使用了不同类名表示同一概念：
   .section-card (dashboard) / .tpl-section (data,template) /
   .settings-section (settings,channel-settings) / .logic-section (project-logic,account)
   此处提供统一样式，各页面内联 <style> 仍可覆盖细节（如 max-width）。
   同时修复 account.php 未定义 .logic-section 的 bug。 */
.section-card,
.tpl-section,
.settings-section,
.logic-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 18px 20px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
    position: relative;
}
.section-card:hover,
.tpl-section:hover,
.settings-section:hover,
.logic-section:hover {
    border-color: rgba(59, 130, 246, 0.35);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(59, 130, 246, 0.08);
}

/* 板块标题统一样式（仅作兜底，不覆盖各页面已有定义） */
.tpl-title,
.settings-title,
.logic-section-title,
.section-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.01em;
}
.tpl-title .icon,
.settings-title .icon,
.section-title .icon {
    font-size: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: var(--accent-blue-glow);
    color: var(--accent-blue);
    flex-shrink: 0;
}

.logic-section-title .icon {
    font-size: 15px;
}

/* 板块提示文字 */
.tpl-hint,
.settings-hint,
.logic-desc {
    font-size: 12.5px;
    color: var(--text-secondary);
    margin-bottom: 14px;
    line-height: 1.6;
}

/* ========== 顶栏增强 ========== */
.topbar {
    background: rgba(17, 24, 39, 0.8);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(74, 96, 128, 0.5);
    box-shadow: 0 1px 0 rgba(59, 130, 246, 0.04), 0 4px 20px rgba(0, 0, 0, 0.2);
}
.page-title {
    background: linear-gradient(135deg, #f1f5f9 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.current-path-tag {
    background: linear-gradient(135deg, rgba(59,130,246,0.12), rgba(139,92,246,0.08));
    border: 1px solid rgba(59,130,246,0.2);
}

/* ========== 页面内容节奏 ========== */
.page-content {
    padding: 22px 28px 32px;
    animation: fadeInUp 0.35s ease;
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========== 表格容器增强 ========== */
.table-container {
    border-left-width: 3px;
    border-left-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
.data-table thead th {
    background: linear-gradient(180deg, var(--bg-secondary), rgba(17, 24, 39, 0.9));
    border-color: rgba(74, 96, 128, 0.6) !important;
}
.data-table td {
    border-color: rgba(74, 96, 128, 0.35) !important;
}
.data-table tbody tr:hover {
    background: rgba(59, 130, 246, 0.06);
}

/* ========== 统一空状态 ========== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 13px;
}
.empty-state .empty-icon {
    font-size: 36px;
    opacity: 0.4;
    margin-bottom: 10px;
    display: block;
}

/* ========== 统一加载状态 ========== */
.loading-state {
    text-align: center;
    padding: 30px 20px;
    color: var(--text-muted);
    font-size: 13px;
}
.loading-state::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ========== 滚动条美化 ========== */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 5px;
    border: 2px solid var(--bg-primary);
}
::-webkit-scrollbar-thumb:hover { background: #5a7ba8; }
* { scrollbar-width: thin; scrollbar-color: var(--border-color) var(--bg-primary); }

/* ========== 模态框增强 ========== */
.modal {
    border: 1px solid rgba(74, 96, 128, 0.6);
    box-shadow: var(--shadow-lg), 0 0 0 1px rgba(59, 130, 246, 0.05);
}
.modal-header {
    background: linear-gradient(180deg, rgba(59,130,246,0.04), transparent);
}
.modal-header h3 {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ========== 按钮微调 ========== */
.btn {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-primary {
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}
.btn-danger {
    border: 1px solid rgba(239, 68, 68, 0.5) !important;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.15);
}

/* ========== 工具栏统一 ========== */
.toolbar-left,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ========== 响应式补充 ========== */
@media(max-width:768px) {
    .page-content { padding: 16px 14px 24px; }
    .section-card,
    .tpl-section,
    .settings-section,
    .logic-section { padding: 14px 16px; }
}
