@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-card: rgba(17, 24, 39, 0.7);
    --bg-card-hover: rgba(31, 41, 55, 0.8);
    --border: rgba(75, 85, 99, 0.4);
    --border-hover: rgba(99, 102, 241, 0.5);
    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --accent: #6366f1;
    --accent-light: #818cf8;
    --accent-glow: rgba(99, 102, 241, 0.3);
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --error: #ef4444;
    --error-bg: rgba(239, 68, 68, 0.1);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --gradient-1: linear-gradient(135deg, #6366f1, #8b5cf6, #a78bfa);
    --gradient-2: linear-gradient(135deg, #0a0e1a 0%, #1a1f35 50%, #0a0e1a 100%);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.15);
    --input-bg: rgba(255, 255, 255, 0.05);
    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 6px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--gradient-2);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at 30% 20%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 80%, rgba(139, 92, 246, 0.06) 0%, transparent 50%);
    z-index: 0;
    pointer-events: none;
}

/* 头部 */
.header {
    position: relative;
    z-index: 1;
    padding: 36px 0 16px;
    text-align: center;
}

.header h1 {
    font-size: 2.2rem;
    font-weight: 700;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 6px;
    letter-spacing: -0.5px;
}

.header p {
    color: var(--text-secondary);
    font-size: 0.92rem;
    font-weight: 300;
}

/* 容器 */
.container {
    position: relative;
    z-index: 1;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px 60px;
}

/* ===== 按钮 ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-primary {
    background: var(--gradient-1);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
}

.btn-accent {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-accent:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
    backdrop-filter: blur(10px);
}

.btn-secondary:hover {
    border-color: var(--border-hover);
    background: var(--bg-card-hover);
}

.btn-danger {
    background: var(--error-bg);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--error);
}

.btn-warning {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.btn-warning:hover {
    background: rgba(245, 158, 11, 0.2);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.82rem;
    border-radius: var(--radius-xs);
}

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

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

/* ===== 操作栏 ===== */
.action-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

/* ===== 统计 ===== */
.stats-bar {
    display: flex;
    gap: 14px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.stat-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 24px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    backdrop-filter: blur(10px);
}

.stat-chip .num {
    font-weight: 600;
    color: var(--accent-light);
}

.stat-chip.warn .num {
    color: var(--warning);
}

/* ===== 站点卡片 ===== */
.sites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
    gap: 20px;
}

.site-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    backdrop-filter: blur(20px);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.site-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-1);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.site-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-glow);
    transform: translateY(-3px);
}

.site-card:hover::before {
    opacity: 1;
}

.site-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.site-name {
    font-size: 1.05rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.login-badge {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 10px;
    letter-spacing: 0.03em;
    flex-shrink: 0;
}
.badge-session  { background: rgba(16,185,129,0.15); color: #10b981; }
.badge-password { background: rgba(245,158,11,0.15);  color: #f59e0b; }
.badge-oauth    { background: rgba(99,102,241,0.15);  color: #818cf8; }
.badge-token    { background: rgba(107,114,128,0.15); color: #9ca3af; }

.site-url {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 4px;
    word-break: break-all;
}

.site-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    flex-shrink: 0;
}

.status-online {
    background: var(--success-bg);
    color: var(--success);
}

.status-signed {
    background: rgba(99, 102, 241, 0.12);
    color: var(--accent-light);
}

.status-offline {
    background: var(--error-bg);
    color: var(--error);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

.user-info-section {
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm);
    padding: 14px;
    margin-bottom: 16px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    font-size: 0.85rem;
}

.info-label {
    color: var(--text-secondary);
}

.info-value {
    color: var(--text-primary);
    font-weight: 500;
}

.info-value.balance {
    color: var(--accent-light);
    font-weight: 600;
}

.sign-result {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-xs);
    font-size: 0.83rem;
}

.sign-result.success {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.sign-result.error {
    background: var(--error-bg);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.sign-result.warning {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.sign-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 8px;
}

.card-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    flex-wrap: wrap;
}

/* ===== 弹窗 ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    width: 100%;
    max-width: 520px;
    box-shadow: var(--shadow-lg);
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s ease;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-sm {
    max-width: 400px;
}

.modal-overlay.active .modal {
    transform: translateY(0) scale(1);
}

.modal h2 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 20px;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.modal-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.modal-footer {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    justify-content: flex-end;
}

/* ===== 标签页 ===== */
.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
    padding: 4px;
}

.tab {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: var(--radius-xs);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 500;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab:hover {
    color: var(--text-secondary);
}

.tab.active {
    background: var(--accent);
    color: white;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

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

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

.form-group input {
    width: 100%;
    padding: 11px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text-primary);
    transition: all 0.3s ease;
    outline: none;
}

.form-group input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 6px;
}


/* ===== 批量签到结果 ===== */
.batch-result-bar {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px 24px;
    margin-bottom: 20px;
    display: none;
    backdrop-filter: blur(20px);
}

.batch-result-bar.active {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.batch-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.88rem;
}

.batch-stat .count {
    font-weight: 600;
    font-size: 1.1rem;
}

.batch-stat.total .count {
    color: var(--accent-light);
}

.batch-stat.ok .count {
    color: var(--success);
}

.batch-stat.fail .count {
    color: var(--error);
}

.batch-divider {
    width: 1px;
    height: 24px;
    background: var(--border);
}

/* ===== 空状态 ===== */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-secondary);
    grid-column: 1 / -1;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-state h3 {
    font-size: 1.2rem;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.empty-state p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* ===== Spinner ===== */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.btn .spinner {
    width: 14px;
    height: 14px;
}

/* ===== Toast ===== */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius-xs);
    font-size: 0.88rem;
    font-weight: 500;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
    max-width: 400px;
}

.toast.success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.toast.error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.toast.info {
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent-light);
    border: 1px solid rgba(99, 102, 241, 0.3);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* ===== 确认弹窗 ===== */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.confirm-overlay.active {
    opacity: 1;
    visibility: visible;
}

.confirm-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 28px;
    text-align: center;
    max-width: 360px;
    box-shadow: var(--shadow-lg);
}

.confirm-box p {
    margin-bottom: 20px;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.confirm-box .btn-group {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .header h1 {
        font-size: 1.6rem;
    }

    .container {
        padding: 0 16px 40px;
    }

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

    .modal {
        padding: 20px;
    }

    .action-bar {
        flex-direction: column;
    }

    .action-bar .btn {
        justify-content: center;
    }

}

/* ===== 登录遮罩 ===== */
.auth-overlay {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 20, 0.85);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

@keyframes authBoxIn {
    from { opacity: 0; transform: translateY(-20px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-box {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 360px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    animation: authBoxIn 0.3s ease;
}

.auth-box h2 {
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.auth-box p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.auth-box input[type="password"] {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--input-bg);
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 0.75rem;
    box-sizing: border-box;
    text-align: center;
    letter-spacing: 0.15em;
}

.auth-box input[type="password"]:focus {
    outline: none;
    border-color: var(--accent);
}

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

.auth-error {
    color: #f87171;
    font-size: 0.85rem;
    min-height: 1.2em;
    margin-bottom: 0.5rem;
}