/* ============================================================
   龙虾发布器 — 管理面板样式
   深蓝色主题
   ============================================================ */

/* ---- 重置与基础 ---- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg-dark: #0a1628;
    --bg-card: #122240;
    --bg-card-hover: #1a2d52;
    --bg-input: #0e1d38;
    --border-color: #1e3a5f;
    --text-primary: #e8edf5;
    --text-secondary: #8899b4;
    --text-muted: #5a6d8a;
    --accent-blue: #3b82f6;
    --accent-blue-hover: #2563eb;
    --accent-green: #22c55e;
    --accent-red: #ef4444;
    --accent-yellow: #eab308;
    --accent-orange: #f97316;
    --accent-purple: #a855f7;
    --radius: 8px;
    --radius-sm: 4px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    --transition: 0.2s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Microsoft YaHei", sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--accent-blue); text-decoration: none; }
a:hover { color: var(--accent-blue-hover); }

/* ---- 顶部导航 ---- */
.top-nav {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 24px;
    height: 56px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: 32px;
}

.brand-icon { font-size: 24px; }
.brand-text {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 1px;
}

.nav-links {
    display: flex;
    gap: 4px;
}

.nav-link {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 14px;
    transition: var(--transition);
}

.nav-link:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.nav-link.active {
    background: var(--accent-blue);
    color: #fff;
}

/* ---- 主内容区 ---- */
.main-content {
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px;
    min-height: calc(100vh - 56px - 48px);
}

/* ---- 页面头部 ---- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 700;
}

.page-desc {
    color: var(--text-secondary);
    font-size: 14px;
}

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* ---- 统计卡片网格 ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
}

.stat-card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.stat-icon { font-size: 32px; }

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--accent-blue);
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ---- 面板 ---- */
.panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    margin-bottom: 24px;
    overflow: hidden;
}

.panel-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panel-header h2 {
    font-size: 16px;
    font-weight: 600;
}

.panel-body {
    padding: 20px;
}

/* ---- 数据表格 ---- */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

.data-table th {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table tbody tr:hover {
    background: var(--bg-card-hover);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.action-cell {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* 设置页表格 */
.settings-table td:first-child {
    width: 200px;
    font-weight: 600;
    color: var(--text-secondary);
}

.setting-key { white-space: nowrap; }

/* ---- 徽章 ---- */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge-active, .badge-replied { background: rgba(34,197,94,0.15); color: var(--accent-green); }
.badge-inactive, .badge-expired { background: rgba(239,68,68,0.15); color: var(--accent-red); }
.badge-pending { background: rgba(234,179,8,0.15); color: var(--accent-yellow); }
.badge-logging_in { background: rgba(59,130,246,0.15); color: var(--accent-blue); }
.badge-cancelled { background: rgba(90,109,138,0.15); color: var(--text-muted); }
.badge-skipped { background: rgba(90,109,138,0.15); color: var(--text-muted); }
.badge-platform { background: rgba(168,85,247,0.15); color: var(--accent-purple); }

/* ---- 按钮 ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    color: #fff;
}

.btn:hover { opacity: 0.9; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary { background: var(--accent-blue); }
.btn-primary:hover { background: var(--accent-blue-hover); }
.btn-success { background: var(--accent-green); }
.btn-danger { background: var(--accent-red); }
.btn-warning { background: var(--accent-orange); }
.btn-info { background: #6366f1; }

.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 16px; }
.btn-block { width: 100%; }

/* ---- 表单 ---- */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

textarea.form-control {
    resize: vertical;
    font-family: inherit;
}

select.form-control {
    appearance: auto;
}

.inline-select {
    width: auto;
    display: inline-block;
}

.inline-input {
    width: auto;
    display: inline-block;
    min-width: 300px;
}

.form-row {
    display: flex;
    gap: 16px;
}

.flex-1 { flex: 1; }

.content-textarea {
    min-height: 200px;
}

.checkbox-group {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-primary);
}

.checkbox-label input[type="checkbox"] {
    accent-color: var(--accent-blue);
    width: 16px;
    height: 16px;
}

/* ---- 发布页面布局 ---- */
.publish-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

@media (max-width: 900px) {
    .publish-layout { grid-template-columns: 1fr; }
}

/* ---- 发布历史 ---- */
.history-item {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
}

.history-item:last-child { border-bottom: none; }

.history-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.history-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--text-muted);
}

/* ---- 平台卡片网格 ---- */
.platform-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}

.platform-card {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
}

.platform-card h3 {
    font-size: 16px;
    margin-bottom: 4px;
}

.platform-count {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent-blue);
    display: block;
}

.platform-status {
    font-size: 12px;
    color: var(--accent-green);
}

/* ---- 评论卡片 ---- */
.comments-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.comment-card {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 16px;
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.comment-author {
    font-weight: 600;
}

.comment-post {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.comment-content {
    padding: 8px 0;
    border-top: 1px solid var(--border-color);
    line-height: 1.8;
}

.comment-reply {
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(59, 130, 246, 0.1);
    border-radius: var(--radius-sm);
    font-size: 13px;
}

.comment-actions {
    margin-top: 12px;
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ---- 模态框 ---- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.modal-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    width: 480px;
    max-width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 { font-size: 16px; }

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 0 4px;
}

.modal-close:hover { color: var(--text-primary); }

.modal-body {
    padding: 20px;
}

/* ---- Toast通知 ---- */
#toast-container {
    position: fixed;
    top: 72px;
    right: 24px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    box-shadow: var(--shadow);
    animation: toast-in 0.3s ease;
    max-width: 400px;
}

.toast-success { background: var(--accent-green); color: #fff; }
.toast-error { background: var(--accent-red); color: #fff; }
.toast-info { background: var(--accent-blue); color: #fff; }

@keyframes toast-in {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ---- 页脚 ---- */
.footer {
    text-align: center;
    padding: 16px;
    color: var(--text-muted);
    font-size: 12px;
    border-top: 1px solid var(--border-color);
}

/* ---- 工具类 ---- */
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }

/* ============================================================
   Q1-10：移动端响应式适配
   ============================================================ */

/* 平板端（≤1024px）*/
@media (max-width: 1024px) {
    .top-nav {
        padding: 0 16px;
    }

    .main-content {
        padding: 16px;
    }

    .nav-links {
        gap: 8px;
    }

    .nav-links a {
        font-size: 13px;
        padding: 6px 10px;
    }

    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 手机端（≤768px）*/
@media (max-width: 768px) {
    /* 导航折叠 */
    .top-nav {
        flex-wrap: wrap;
        height: auto;
        padding: 8px 12px;
        gap: 8px;
    }

    .nav-brand {
        font-size: 16px;
    }

    .nav-links {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        padding-bottom: 4px;
        gap: 4px;
    }

    .nav-links a {
        white-space: nowrap;
        font-size: 12px;
        padding: 5px 8px;
    }

    /* 主内容区 */
    .main-content {
        padding: 12px;
    }

    /* 卡片 */
    .card {
        padding: 14px;
        border-radius: var(--radius);
    }

    /* 栅格全部单列 */
    .grid-3,
    .grid-2 {
        grid-template-columns: 1fr;
    }

    /* 统计摘要卡片横向滚动 */
    .stats-summary {
        display: flex;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 10px;
        padding-bottom: 6px;
    }

    .stats-summary > * {
        min-width: 140px;
        flex-shrink: 0;
    }

    /* 表格横向滚动 */
    .table-wrapper,
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }

    /* 表单布局 */
    .form-row {
        flex-direction: column;
    }

    .form-row > * {
        width: 100% !important;
    }

    /* 按钮组垂直排列 */
    .btn-group {
        flex-direction: column;
        gap: 8px;
    }

    .btn-group .btn {
        width: 100%;
        justify-content: center;
    }

    /* 发布表单全宽 */
    .publish-form {
        max-width: 100%;
    }

    /* 账号列表卡片 */
    .account-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .account-card .account-actions {
        width: 100%;
        display: flex;
        gap: 6px;
        flex-wrap: wrap;
    }

    .account-card .account-actions .btn {
        flex: 1;
        min-width: 80px;
        font-size: 12px;
        padding: 5px 8px;
    }

    /* 任务历史列表 */
    .task-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .task-item .task-meta {
        font-size: 11px;
    }

    /* 模态弹窗全屏 */
    .modal {
        padding: 8px;
    }

    .modal-box {
        width: 100%;
        max-width: 100%;
        max-height: 90vh;
        border-radius: var(--radius);
    }

    .modal-header {
        padding: 12px 16px;
    }

    .modal-body {
        padding: 12px 16px;
        overflow-y: auto;
    }

    /* Toast 全宽 */
    .toast-container {
        left: 12px;
        right: 12px;
        bottom: 12px;
    }

    .toast {
        max-width: 100%;
        width: 100%;
    }

    /* 进度条文字 */
    .task-progress {
        font-size: 12px;
    }

    /* 内容日历移动端 */
    .calendar-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }

    .calendar-day {
        min-height: 60px;
        padding: 6px;
        font-size: 11px;
    }

    .calendar-header {
        font-size: 13px;
        flex-wrap: wrap;
        gap: 6px;
    }

    /* 健康度评分卡片 */
    .health-score-card {
        flex-direction: column;
    }
}

/* 超小屏（≤480px）*/
@media (max-width: 480px) {
    :root {
        --radius: 6px;
    }

    .top-nav .nav-brand {
        font-size: 14px;
    }

    h1 { font-size: 18px; }
    h2 { font-size: 16px; }
    h3 { font-size: 14px; }

    .btn {
        font-size: 12px;
        padding: 6px 10px;
    }

    .calendar-grid {
        grid-template-columns: 1fr;
    }

    .stats-summary > * {
        min-width: 120px;
    }
}
