/* ============================================
   频道定时发送系统 - 样式
   ============================================ */

:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #eef2ff;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
    --dark: #1e293b;
    --light: #f8fafc;
    --border: #e2e8f0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: #f1f5f9;
    color: #1e293b;
    min-height: 100vh;
}

.main-content {
    max-width: 1400px;
    margin: 0 auto;
}

/* ============== 导航栏 ============== */
.app-navbar {
    background: linear-gradient(90deg, #4f46e5 0%, #7c3aed 100%);
    box-shadow: 0 2px 10px rgba(79, 70, 229, 0.2);
}

.app-navbar .navbar-brand {
    font-size: 1.15rem;
    letter-spacing: 0.5px;
}

.app-navbar .nav-link {
    color: rgba(255,255,255,0.85) !important;
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    border-radius: 6px;
    transition: all 0.2s;
}

.app-navbar .nav-link:hover {
    background: rgba(255,255,255,0.15);
    color: white !important;
}

/* ============== 登录页 ============== */
.login-body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.login-wrap {
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: white;
    padding: 2.5rem;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.login-logo {
    width: 70px;
    height: 70px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2rem;
    box-shadow: 0 10px 25px -5px rgba(79, 70, 229, 0.4);
}

.login-card .input-group-text {
    border-right: none;
}

.login-card .form-control {
    border-left: none;
}

.login-card .form-control:focus {
    box-shadow: none;
    border-color: #4f46e5;
}

.login-card .input-group:focus-within .input-group-text {
    border-color: #4f46e5;
}

/* ============== 卡片 ============== */
.card {
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: all 0.2s;
}

.card-header {
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.25rem;
    background: white;
}

.card-header h5 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--dark);
}

/* ============== 统计卡片 ============== */
.stat-card {
    background: white;
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    transition: all 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    color: white;
    flex-shrink: 0;
}

.stat-primary .stat-icon { background: linear-gradient(135deg, #4f46e5, #7c3aed); }
.stat-info .stat-icon { background: linear-gradient(135deg, #06b6d4, #0891b2); }
.stat-success .stat-icon { background: linear-gradient(135deg, #10b981, #059669); }
.stat-warning .stat-icon { background: linear-gradient(135deg, #f59e0b, #d97706); }

.stat-num {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--dark);
    line-height: 1;
}

.stat-label {
    font-size: 0.85rem;
    color: #64748b;
    margin-top: 4px;
}

/* ============== 模版卡片 ============== */
.template-card {
    transition: all 0.2s;
}

.template-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.08);
    border-color: var(--primary);
}

/* ============== 消息列表（模版编辑页） ============== */
.message-list {
    padding: 0;
}

.message-item {
    display: grid;
    grid-template-columns: 100px 1fr auto;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    align-items: start;
    transition: background 0.15s;
}

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

.message-item:hover {
    background: #f8fafc;
}

.message-time {
    font-size: 0.95rem;
    color: var(--primary);
    font-weight: 600;
    padding-top: 0.25rem;
}

.message-content {
    background: #f8fafc;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: inherit;
    font-size: 0.9rem;
    color: #334155;
    border: 1px solid var(--border);
    line-height: 1.6;
}

.message-meta {
    margin-top: 0.5rem;
}

.message-actions {
    display: flex;
    gap: 0.5rem;
    align-items: start;
}

/* ============== 时间线（预览页） ============== */
.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 11px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.timeline-item {
    position: relative;
    margin-bottom: 1.5rem;
}

.timeline-dot {
    position: absolute;
    left: -1.7rem;
    top: 8px;
    width: 14px;
    height: 14px;
    background: var(--primary);
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 0 0 2px var(--primary);
    z-index: 2;
}

.timeline-dot.override {
    background: var(--warning);
    box-shadow: 0 0 0 2px var(--warning);
}

.timeline-item.sent .timeline-dot {
    background: var(--success);
    box-shadow: 0 0 0 2px var(--success);
}

.timeline-time {
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.timeline-card {
    border-left: 4px solid var(--primary);
}

.timeline-item.sent .timeline-card {
    border-left-color: var(--success);
    opacity: 0.85;
}

.timeline-card:has(+ .modal) {
    /* placeholder */
}

.rendered-content {
    background: #f8fafc;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: inherit;
    font-size: 0.9rem;
    color: #1e293b;
    border: 1px solid var(--border);
    line-height: 1.65;
}

/* ============== 按钮 ============== */
.btn {
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.15s;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-sm {
    padding: 0.25rem 0.6rem;
    font-size: 0.8rem;
}

/* ============== 表格 ============== */
.table {
    margin-bottom: 0;
}

.table thead th {
    font-weight: 600;
    font-size: 0.85rem;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 2px solid var(--border);
}

.table tbody tr {
    transition: background 0.15s;
}

.table-hover tbody tr:hover {
    background: var(--primary-light) !important;
}

/* ============== 徽章 ============== */
.badge {
    font-weight: 500;
    padding: 0.4em 0.7em;
    border-radius: 6px;
}

/* ============== 表单 ============== */
.form-control, .form-select {
    border-color: var(--border);
    border-radius: 8px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-label {
    font-weight: 500;
    color: #334155;
    font-size: 0.9rem;
}

textarea.form-control {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", monospace;
    font-size: 0.92rem;
    line-height: 1.55;
}

/* ============== 警告框 ============== */
.alert {
    border-radius: 10px;
    border: 1px solid transparent;
}

.alert-info {
    background: #ecfeff;
    border-color: #cffafe;
    color: #0e7490;
}

.alert-warning {
    background: #fffbeb;
    border-color: #fef3c7;
    color: #92400e;
}

.alert-success {
    background: #f0fdf4;
    border-color: #dcfce7;
    color: #15803d;
}

.alert-danger {
    background: #fef2f2;
    border-color: #fecaca;
    color: #b91c1c;
}

/* ============== 面包屑 ============== */
.breadcrumb {
    background: transparent;
    padding: 0;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

.breadcrumb a {
    color: var(--primary);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

/* ============== 模态框 ============== */
.modal-content {
    border-radius: 12px;
    border: none;
    box-shadow: 0 25px 50px rgba(0,0,0,0.15);
}

.modal-header {
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.5rem;
}

.modal-footer {
    border-top: 1px solid var(--border);
}

/* ============== 滚动条 ============== */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ============== 页面标题 ============== */
.page-header h3 {
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 0.25rem;
}

.page-header h3 i {
    color: var(--primary);
}

/* ============== 列表组 ============== */
.list-group-item {
    border-color: var(--border);
}

.list-group-item-action.active {
    background: var(--primary);
    border-color: var(--primary);
}

/* ============== 响应式 ============== */
@media (max-width: 768px) {
    .stat-card {
        padding: 1rem;
    }
    .stat-icon {
        width: 44px;
        height: 44px;
        font-size: 1.3rem;
    }
    .stat-num {
        font-size: 1.4rem;
    }
    .message-item {
        grid-template-columns: 1fr;
    }
    .timeline {
        padding-left: 1.5rem;
    }
}

/* ============== 代码标签 ============== */
code {
    background: #f1f5f9;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    color: #be185d;
    font-size: 0.88em;
    font-weight: 500;
}

/* ============== Footer ============== */
footer {
    margin-top: 3rem;
}
