/* ============================
   ai99x 站群管理 - 暗色主题
   复刻前端模板视觉风格
   ============================ */

/* ---- Reset ---- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: 222.2 84% 4.9%;
    --fg: 210 40% 98%;
    --card-bg: 222.2 84% 4.9%;
    --muted-bg: 217.2 32.6% 17.5%;
    --muted-fg: 215 20.2% 65.1%;
    --border-color: 217.2 32.6% 17.5%;
    --primary: 329 100% 65%;
    --destructive: 0 62.8% 30.6%;
    --radius: 0.5rem;
}

html {
    font-size: 115%;
    scroll-behavior: smooth;
}

body {
    font-family: 'Space Grotesk', sans-serif;
    background-color: hsl(222, 84%, 5%);
    color: hsl(210, 40%, 98%);
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Orbitron', sans-serif;
}

.bg-background {
    background-color: hsl(222, 84%, 5%);
}

/* ---- Gradient Title ---- */
.gradient-title {
    background: linear-gradient(90deg, #a78bfa, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

.gradient-title.glow {
    text-shadow: 0 0 10px rgba(255,105,180,0.7), 0 0 20px rgba(255,105,180,0.5), 0 0 30px rgba(255,105,180,0.3);
}

/* ---- Login Page ---- */
.login-wrapper {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.grid-overlay {
    position: absolute;
    inset: 0;
    background-size: 40px 40px;
    background-image:
        linear-gradient(to right, rgba(255,255,255,0.03) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255,255,255,0.03) 1px, transparent 1px);
    opacity: 0.3;
}

.particles {
    position: absolute;
    inset: 0;
}

.particle {
    position: absolute;
    border-radius: 50%;
    background: rgba(168, 85, 247, 0.2);
    animation: float 3s ease-in-out infinite;
}

.pixel-overlay {
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255,255,255,0.1) 1px, transparent 1px);
    background-size: 30px 30px;
    animation: pixelFloat 20s linear infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes pixelFloat {
    0% { background-position: 0 0; }
    100% { background-position: 30px 30px; }
}

.login-card {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 420px;
    margin: 0 1rem;
    padding: 2.5rem 2rem;
    background: rgba(31, 41, 55, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 1rem;
    border: 1px solid rgba(75, 85, 99, 0.5);
    box-shadow: 0 0 10px rgba(255,105,180,0.3), 0 0 20px rgba(255,105,180,0.2), 0 0 30px rgba(255,105,180,0.1);
    animation: cardIn 0.6s ease-out;
}

@keyframes cardIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    font-size: 1.75rem;
    margin-bottom: 0.25rem;
}

.login-subtitle {
    color: hsl(215, 20%, 65%);
    font-size: 0.875rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.login-form .btn-gradient {
    width: 100%;
    justify-content: center;
}

.glow-orb {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 600px;
    background: linear-gradient(135deg, rgba(147,51,234,0.2), rgba(219,39,119,0.2));
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.3;
}

/* ---- Dashboard Page BG ---- */
.page-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.page-bg .grid-overlay,
.page-bg .pixel-overlay,
.page-bg .particles {
    position: absolute;
    inset: 0;
}

.page-bg .glow-orb {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 600px;
    background: linear-gradient(135deg, rgba(147,51,234,0.2), rgba(219,39,119,0.2));
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.3;
}

/* 确保内容在背景上方 */
.main-content {
    position: relative;
    z-index: 1;
}

#tableContainer {
    position: relative;
    z-index: 1;
}

/* ---- Navbar ---- */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    background: rgba(3, 8, 23, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid hsl(217, 33%, 18%);
    transition: all 0.3s;
}

.navbar.scrolled {
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.nav-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 4rem;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.brand-icon {
    font-size: 1.5rem;
    color: #ec4899;
}

.nav-title {
    font-size: 1.5rem;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-tag {
    color: hsl(210, 20%, 75%);
    font-size: 0.875rem;
    font-weight: 500;
}

/* ---- Main Content ---- */
.main-content {
    max-width: 1280px;
    margin: 0 auto;
    padding: 5rem 1.5rem 3rem;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h2 {
    font-size: 1.75rem;
    margin-bottom: 0.25rem;
}

.page-subtitle {
    color: hsl(215, 20%, 65%);
    font-size: 0.875rem;
}

/* ---- Buttons ---- */
.btn-gradient {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    color: #fff;
    background: linear-gradient(90deg, #9333ea, #db2777);
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(147,51,234,0.3);
}

.btn-gradient:hover {
    background: linear-gradient(90deg, #7c3aed, #be185d);
    transform: translateY(-1px);
    box-shadow: 0 6px 25px rgba(168,85,247,0.4);
}

.btn-gradient:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-outline {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: 1px solid hsl(217, 19%, 27%);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-family: inherit;
    color: hsl(210, 20%, 75%);
    background: transparent;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-outline:hover {
    color: #fff;
    border-color: hsl(215, 14%, 50%);
}

.btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-family: inherit;
    color: #fff;
    background: #dc2626;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-danger:hover {
    background: #b91c1c;
}

/* ---- Form ---- */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.form-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: hsl(210, 20%, 75%);
}

.required { color: #f87171; }

.form-input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    background: rgba(17, 24, 39, 0.8);
    border: 1px solid hsl(217, 19%, 27%);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-family: inherit;
    color: #fff;
    outline: none;
    transition: all 0.2s;
}

.form-input::placeholder {
    color: hsl(215, 14%, 46%);
}

.form-input:focus {
    border-color: rgba(168, 85, 247, 0.5);
    box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.25);
}

.form-textarea {
    resize: none;
    min-height: 80px;
}

.password-wrapper {
    position: relative;
}

.toggle-pwd {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: hsl(215, 14%, 46%);
    font-size: 1.125rem;
    transition: color 0.2s;
}

.toggle-pwd:hover { color: #fff; }

.error-msg {
    padding: 0.5rem 0.875rem;
    background: rgba(185, 28, 28, 0.3);
    border: 1px solid rgba(248, 113, 113, 0.5);
    border-radius: 0.5rem;
    color: #fca5a5;
    font-size: 0.875rem;
}

.hidden { display: none !important; }

/* ---- Table ---- */
.table-card {
    background: rgba(31, 41, 55, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 1rem;
    border: 1px solid rgba(75, 85, 99, 0.5);
    overflow: hidden;
    overflow-x: auto;
}

.loading-box {
    padding: 3rem;
    text-align: center;
    color: hsl(215, 20%, 65%);
}

.spinner {
    display: inline-block;
    width: 32px;
    height: 32px;
    border: 3px solid rgba(168, 85, 247, 0.3);
    border-top-color: #a78bfa;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.empty-box {
    padding: 4rem;
    text-align: center;
}

.empty-box p:first-child {
    color: hsl(215, 20%, 65%);
    font-size: 1.125rem;
}

.empty-box p:last-child {
    color: hsl(215, 14%, 46%);
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
}

.data-table thead tr {
    border-bottom: 1px solid rgba(75, 85, 99, 0.5);
}

.data-table th {
    text-align: left;
    padding: 0.875rem 1.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: hsl(215, 20%, 65%);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.data-table td {
    padding: 0.875rem 1.5rem;
    font-size: 0.875rem;
    border-bottom: 1px solid rgba(75, 85, 99, 0.2);
    color: #fff;
    white-space: nowrap;
}

.data-table td.desc-cell {
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    color: hsl(215, 20%, 65%);
}

.data-table td.date-cell {
    color: hsl(215, 20%, 65%);
}

.data-table td.id-cell {
    color: hsl(215, 20%, 65%);
    font-family: monospace;
}

.data-table tbody tr:hover {
    background: rgba(55, 65, 81, 0.3);
    transition: background 0.15s;
}

.domain-link {
    color: #c084fc;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    transition: color 0.2s;
}

.domain-link:hover {
    color: #a78bfa;
}

.actions-cell {
    text-align: right;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 0.5rem;
    background: transparent;
    cursor: pointer;
    color: hsl(215, 20%, 65%);
    transition: all 0.15s;
}

.action-btn:hover {
    background: rgba(168, 85, 247, 0.15);
    color: #c084fc;
}

.action-btn.del:hover {
    background: rgba(220, 38, 38, 0.15);
    color: #fca5a5;
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ---- Modal ---- */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-card {
    position: relative;
    width: 100%;
    max-width: 480px;
    background: rgba(31, 41, 55, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 1rem;
    border: 1px solid rgba(75, 85, 99, 0.5);
    padding: 1.75rem;
    box-shadow: 0 0 10px rgba(255,105,180,0.3), 0 0 20px rgba(255,105,180,0.2);
    animation: modalIn 0.2s ease-out;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-title {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
}

.modal-card form {
    display: flex;
    flex-direction: column;
    gap: 1.125rem;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    padding-top: 0.5rem;
}

.modal-actions .btn-gradient,
.modal-actions .btn-outline,
.modal-actions .btn-danger {
    flex: 1;
    justify-content: center;
    padding: 0.625rem 1rem;
}

.confirm-card {
    max-width: 380px;
    text-align: center;
}

/* ---- Pagination ---- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(75, 85, 99, 0.3);
}

.pagination-info {
    color: hsl(215, 20%, 65%);
    font-size: 0.875rem;
}

.pagination-btns {
    display: flex;
    gap: 0.375rem;
    flex-wrap: wrap;
}

.page-btn {
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0 0.5rem;
    border: 1px solid hsl(217, 19%, 27%);
    border-radius: 0.375rem;
    background: transparent;
    color: hsl(210, 20%, 75%);
    font-size: 0.8125rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
}

.page-btn:hover:not(:disabled):not(.page-btn-active) {
    border-color: hsl(215, 14%, 50%);
    color: #fff;
    background: rgba(168, 85, 247, 0.1);
}

.page-btn-active {
    background: linear-gradient(90deg, #9333ea, #db2777);
    border-color: transparent;
    color: #fff;
    font-weight: 600;
    cursor: default;
}

.page-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* ---- UNSAFE: utility for gradient title without Orbitron ---- */
.gradient-title.plain {
    font-family: 'Space Grotesk', sans-serif;
}

/* ============================
   SignalLayer 外链投放 - 附加样式
   ============================ */

/* 状态徽章 */
.status-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

.status-pending    { background: rgba(251, 191, 36,  0.15); color: #fbbf24; }
.status-processing { background: rgba(96,  165, 250, 0.15); color: #60a5fa; }
.status-completed  { background: rgba(52,  211, 153, 0.15); color: #34d399; }
.status-failed     { background: rgba(248, 113, 113, 0.15); color: #f87171; }
.status-paused     { background: rgba(156, 163, 175, 0.15); color: #9ca3af; }

/* 微型进度条 */
.progress-mini {
    width: 80px;
    height: 6px;
    background: rgba(75, 85, 99, 0.5);
    border-radius: 9999px;
    overflow: hidden;
    margin-bottom: 4px;
}

.progress-mini .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #9333ea, #db2777);
    border-radius: 9999px;
    transition: width 0.3s ease;
}

/* nav-title 链接去下划线 */
.nav-title {
    text-decoration: none;
}

/* 弹窗关闭按钮 */
.modal-close-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(75, 85, 99, 0.3);
    border-radius: 0.375rem;
    color: hsl(215, 20%, 65%);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.modal-close-btn:hover {
    background: rgba(168, 85, 247, 0.25);
    color: #fff;
}

/* 外链表紧凑布局：收紧间距 + 状态列加宽，避免横向滚动 */
#campaignTable .data-table th,
#campaignTable .data-table td {
    padding-left: 0.65rem;
    padding-right: 0.65rem;
}

#campaignTable .data-table th:last-child,
#campaignTable .data-table td:last-child {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}
