/* =============================================
   Idea Design Global Style - Dark Theme
   ============================================= */

:root {
    --bg-dark: #1a1a1a;
    --bg-deep: #141414;
    --bg-accent: #1e1e1e;
    --primary-indigo: #818cf8;
    --accent-gold: #f59e0b;
    --accent-gold-light: #fbbf24;
    --accent-orange: #f97316;
    --text-white: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.45);
    --border-zinc: #333333;
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-white);
    background-image: radial-gradient(ellipse at 60% 38%, #2a1a1e 0%, #0e0e0e 55%, #080808 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    /* 统一入场动画 */
    animation: page-in 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes page-in {
    from { opacity: 0; transform: scale(0.98); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes page-out {
    from { opacity: 1; transform: scale(1); }
    to   { opacity: 0; transform: scale(1.02); }
}

body.fade-out {
    animation: page-out 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

body.admin-page {
    display: block;
    justify-content: initial;
    align-items: initial;
    height: 100vh;
    overflow: hidden;
}

body.admin-page .dashboard-container {
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0;
    max-width: none;
    width: auto;
}

/* ===== 星空 + 流星背景 (仅 login 页) ===== */
.starfield {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
}

/* 三层星星：密度+大小+闪烁速度都不同，营造景深 */
.starfield .stars,
.starfield .stars2,
.starfield .stars3 {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
}

.starfield .stars i,
.starfield .stars2 i,
.starfield .stars3 i {
    position: absolute;
    display: block;
    background: #ffffff;
    border-radius: 50%;
    opacity: 0;
    animation-name: twinkle;
    animation-iteration-count: infinite;
    animation-timing-function: ease-in-out;
    will-change: opacity, transform;
}

.starfield .stars i {
    width: 1px; height: 1px;
    box-shadow: 0 0 2px rgba(255,255,255,0.6);
}
.starfield .stars2 i {
    width: 2px; height: 2px;
    background: #e8eaff;
    box-shadow: 0 0 4px rgba(200,210,255,0.8);
}
.starfield .stars3 i {
    width: 3px; height: 3px;
    background: #ffffff;
    box-shadow: 0 0 6px rgba(255,255,255,0.9), 0 0 12px rgba(180,200,255,0.5);
}

@keyframes twinkle {
    0%, 100% { opacity: 0.15; transform: scale(0.8); }
    50%      { opacity: 1;    transform: scale(1.2); }
}

/* ===== 流星：从右上 → 左下 斜划 ===== */
.meteors {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.meteors span {
    position: absolute;
    width: 3px;
    height: 3px;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(255,255,255,0.9), 0 0 16px rgba(180,200,255,0.5);
    animation: meteor-fall linear infinite;
    opacity: 0;
    will-change: transform, opacity;
}

/* 拖尾：从星点出发反向延伸（朝右上），渐变到透明 */
.meteors span::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 180px;
    height: 1.5px;
    transform-origin: 0 50%;
    transform: rotate(-45deg);
    background: linear-gradient(90deg,
        rgba(255,255,255,0.95) 0%,
        rgba(200,210,255,0.55) 25%,
        rgba(160,180,255,0.15) 60%,
        transparent 100%);
    filter: blur(0.4px);
}

@keyframes meteor-fall {
    0%   { transform: translate(0, 0); opacity: 0; }
    8%   { opacity: 1; }
    85%  { opacity: 1; }
    100% { transform: translate(-1200px, 1200px); opacity: 0; }
}

/* 让登录卡片浮在星空之上（不改变它的样式，仅设层级） */
body > .container { position: relative; z-index: 2; }

/* 尊重用户的减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
    .starfield .stars i,
    .starfield .stars2 i,
    .starfield .stars3 i,
    .meteors span { animation: none; opacity: 0.5; }
}

.container {
    background-color: var(--bg-deep);
    border: 1px solid var(--border-zinc);
    padding: 2rem 1.2rem;
    border-radius: 12px;
    box-shadow: 0 4px 28px rgba(0,0,0,0.6), 0 0 0 1px rgba(60,60,60,0.3);
    width: 90%;
    max-width: 280px;
}

body.login-page .container {
    background-color: rgba(20, 20, 20, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.10);
    box-shadow: 0 16px 60px rgba(0,0,0,0.65), 0 0 0 1px rgba(255,255,255,0.06);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

h1 {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 300;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    margin-bottom: 2rem;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 45%, #f97316 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.form-group {
    margin-bottom: 1.5rem;
    position: relative;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--text-muted);
    opacity: 0.5;
    transition: opacity 0.2s;
}

.password-toggle:hover {
    opacity: 1;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"] {
    width: 100%;
    padding: 0.8rem 1rem;
    background-color: #1a1a1a;
    border: 1px solid var(--border-zinc);
    border-radius: 6px;
    color: var(--text-white);
    font-size: 1rem;
    transition: all 0.2s;
    box-sizing: border-box;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus {
    outline: none;
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

input[type="text"]:-webkit-autofill,
input[type="password"]:-webkit-autofill,
input[type="email"]:-webkit-autofill,
input[type="text"]:-webkit-autofill:hover,
input[type="password"]:-webkit-autofill:hover,
input[type="email"]:-webkit-autofill:hover,
input[type="text"]:-webkit-autofill:focus,
input[type="password"]:-webkit-autofill:focus,
input[type="email"]:-webkit-autofill:focus,
input[type="text"]:-webkit-autofill:active,
input[type="password"]:-webkit-autofill:active,
input[type="email"]:-webkit-autofill:active {
    -webkit-text-fill-color: var(--text-white);
    caret-color: var(--text-white);
    box-shadow: 0 0 0px 1000px #1a1a1a inset;
    border: 1px solid var(--border-zinc);
    transition: background-color 9999s ease-in-out 0s;
}

input[type="text"]:-moz-autofill,
input[type="password"]:-moz-autofill,
input[type="email"]:-moz-autofill {
    box-shadow: 0 0 0px 1000px #1a1a1a inset;
    -moz-text-fill-color: var(--text-white);
    caret-color: var(--text-white);
    border: 1px solid var(--border-zinc);
}

button {
    width: 100%;
    padding: 0.8rem;
    background: linear-gradient(90deg, #c8516a, #e8798a);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    transition: all 0.2s;
    box-shadow: 0 0 15px rgba(200, 81, 106, 0.3);
}

button:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 20px rgba(200, 81, 106, 0.5);
}

.admin-nav-btn {
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.10);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.78);
    box-shadow: none;
    letter-spacing: 0;
    text-transform: none;
}

.admin-nav-btn:hover {
    transform: none;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    box-shadow: none;
}

.admin-nav-btn:active {
    transform: translateY(1px);
}

.admin-section-hidden {
    display: none;
}

.admin-topbar-active {
    background: #262626 !important;
    color: #ffffff !important;
}

.admin-topbar-btn {
    width: auto;
    background: transparent;
    box-shadow: none;
    text-transform: none;
    letter-spacing: 0;
}

.admin-topbar-btn:hover {
    box-shadow: none;
}

.model-action-btn {
    width: auto;
    padding: 0;
    background: transparent;
    box-shadow: none;
    text-transform: none;
    letter-spacing: 0;
}

.model-action-btn:hover {
    transform: none;
    box-shadow: none;
}

.link {
    display: block;
    text-align: center;
    margin-top: 1.5rem;
    color: var(--primary-indigo);
    text-decoration: none;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
}

.link:hover {
    text-decoration: underline;
}

.message {
    margin-top: 1.5rem;
    padding: 0.8rem;
    border-radius: 6px;
    font-size: 0.85rem;
    text-align: center;
    display: none;
}

.message.success {
    background-color: rgba(92, 184, 92, 0.1);
    color: #5cb85c;
    border: 1px solid #5cb85c;
    display: block;
}

.message.error {
    background-color: rgba(217, 83, 79, 0.1);
    color: #d9534f;
    border: 1px solid #d9534f;
    display: block;
}

/* Dashboard Styles */
.dashboard-container {
    max-width: 900px;
    width: 95%;
    padding: 3rem;
    background-color: var(--bg-deep);
    border: 1px solid var(--border-zinc);
    border-radius: 12px;
    box-shadow: 0 4px 28px rgba(0,0,0,0.6), 0 0 0 1px rgba(60,60,60,0.3);
}
.section-box {
    border: 1px solid var(--border-zinc);
    border-radius: 12px;
    overflow: hidden;
    margin: 1.5rem 0;
    background-color: var(--bg-accent);
    box-shadow: 0 4px 18px rgba(0,0,0,0.45), 0 0 0 1px rgba(60,60,60,0.22);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.1rem 1.2rem;
    border-bottom: 1px solid var(--border-zinc);
    background-color: rgba(255, 255, 255, 0.03);
}

.pricing-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    padding: 1.2rem;
}

.pricing-grid .form-group {
    margin-bottom: 0;
}

.pricing-actions {
    display: flex;
    justify-content: flex-end;
    padding: 0 1.2rem 1.2rem;
}

.btn-small {
    padding: 0.35rem 0.8rem;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    border-radius: 8px;
}

.custom-scrollbar {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.22) rgba(0, 0, 0, 0);
}

.custom-scrollbar::-webkit-scrollbar {
    width: 10px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0);
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    border: 2px solid rgba(0, 0, 0, 0);
    background-clip: padding-box;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.28);
    border: 2px solid rgba(0, 0, 0, 0);
    background-clip: padding-box;
}

.model-configs-scroll {
    max-height: 65vh;
    overflow-y: auto;
    padding-right: 6px;
}

.model-empty {
    padding: 1rem 1.2rem;
    border: 1px dashed var(--border-zinc);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
}

.model-card {
    border: 1px solid var(--border-zinc);
    border-radius: 12px;
    background-color: rgba(255, 255, 255, 0.02);
    padding: 1rem 1.1rem;
    margin: 0.8rem 0;
    box-shadow: 0 10px 28px rgba(0,0,0,0.35);
}

.model-card-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.85rem;
}

.model-dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
}

.dot-ok { background: rgba(92, 184, 92, 0.95); }
.dot-warn { background: rgba(245, 158, 11, 0.95); }
.dot-off { background: rgba(217, 83, 79, 0.95); }

.model-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-white);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.model-badges {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.model-badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.7);
    background: rgba(0, 0, 0, 0.25);
}

.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.model-fields {
    display: grid;
    gap: 0.55rem;
    padding-left: 0.1rem;
}

.model-field-row {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 0.8rem;
    align-items: center;
}

.model-field-label {
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.4);
    text-align: right;
}

.model-field-input {
    width: 100%;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.25);
    color: rgba(255, 255, 255, 0.85);
    padding: 0.55rem 0.75rem;
    outline: none;
    font-size: 0.85rem;
}

.model-field-input:focus {
    border-color: rgba(129, 140, 248, 0.55);
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.12);
}

.model-card-footer {
    margin-top: 0.9rem;
    padding-top: 0.8rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: flex-end;
}
.user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem;
    border-bottom: 1px solid var(--border-zinc);
}

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

.users-table-wrap {
    width: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    max-height: calc(100vh - 260px);
}

.users-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.85rem;
    table-layout: fixed;
}

.users-table th,
.users-table td {
    padding: 0.75rem 0.75rem;
    border-right: 1px solid var(--border-zinc);
    border-bottom: 1px solid var(--border-zinc);
    vertical-align: middle;
    text-align: center;
}

.users-table th:first-child,
.users-table td:first-child {
    border-left: 1px solid var(--border-zinc);
}

.users-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    border-top: 1px solid var(--border-zinc);
}

#renewals-list {
    max-height: calc(100vh - 260px);
    overflow-y: auto;
}

#model-configs-list {
    max-height: calc(100vh - 260px);
    overflow-y: auto;
}

.users-table tbody td {
    background: rgba(0, 0, 0, 0.18);
}

.users-table tbody tr:nth-child(even) td {
    background: rgba(255, 255, 255, 0.02);
}

.users-table tbody tr:hover td {
    background: rgba(129, 140, 248, 0.10);
}

.users-cell-main {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
}

.users-cell-sub {
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    overflow-wrap: anywhere;
}

.users-email {
    font-weight: 700;
    color: var(--text-white);
    overflow-wrap: anywhere;
}

.users-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    flex: 0 0 auto;
}

.users-dot-online { background: #5cb85c; }
.users-dot-offline { background: #d9534f; }

.users-cell-center {
    text-align: center;
    white-space: nowrap;
}

.users-cell-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.78);
    white-space: nowrap;
}

.users-cell-actions {
    text-align: center;
    padding: 0.45rem 0.55rem;
}

.users-table .btn-group {
    display: inline-flex;
    flex-wrap: nowrap;
    justify-content: center;
    gap: 0.35rem;
}

.users-table .btn-group .btn-small {
    padding: 0.28rem 0.48rem;
    font-size: 0.68rem;
    letter-spacing: 0.05em;
    border-radius: 10px;
    min-width: 70px;
}

.users-table .btn-group .btn-small.btn-reject {
    min-width: 66px;
}

.member-month-select {
    width: 88px;
    padding: 0.35rem 0.55rem;
    border-radius: 8px;
    border: 1px solid var(--border-zinc);
    background: rgba(0, 0, 0, 0.25);
    color: rgba(255, 255, 255, 0.9);
    outline: none;
    appearance: none;
}

.member-month-select:focus {
    border-color: rgba(129, 140, 248, 0.55);
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.12);
}

.member-month-select option {
    background-color: #1a1a1a;
    color: #ffffff;
}

.btn-group {
    display: flex;
    gap: 0.8rem;
}

.btn-approve { 
    background: #5cb85c; 
    width: auto; 
    padding: 0.5rem 1.2rem; 
    box-shadow: none;
}
.btn-reject { 
    background: #d9534f; 
    width: auto; 
    padding: 0.5rem 1.2rem; 
    box-shadow: none;
}
.btn-logout { 
    background: #333; 
    width: auto; 
    padding: 0.6rem 1.5rem; 
    margin-top: 2rem;
    box-shadow: none;
}

hr {
    border: none;
    border-top: 1px solid var(--border-zinc);
    margin: 2rem 0;
}

p {
    margin: 0.8rem 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

strong {
    color: var(--text-white);
}
