/* ============================================
   CutieAPI - 可爱现代化 UI 样式
   ============================================ */

:root {
    --pink: #FF6B9D;
    --pink-light: #FFB8D0;
    --pink-bg: #FFF0F5;
    --purple: #A78BFA;
    --purple-light: #DDD6FE;
    --blue: #60A5FA;
    --blue-light: #BFDBFE;
    --green: #34D399;
    --green-light: #A7F3D0;
    --yellow: #FBBF24;
    --orange: #FB923C;
    --red: #F87171;
    --red-light: #FECACA;
    --bg: #FFF5F7;
    --bg-card: #FFFFFF;
    --bg-sidebar: #FFFFFF;
    --text: #4A3550;
    --text-light: #8B7D90;
    --text-muted: #B8A8BE;
    --border: #F0E0E8;
    --shadow: 0 4px 24px rgba(255, 107, 157, 0.10);
    --shadow-lg: 0 12px 48px rgba(255, 107, 157, 0.15);
    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 6px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

/* ========== 登录页 ========== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #FFF0F5 0%, #F5F3FF 50%, #FFF5F7 100%);
}

.login-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.floating-shapes .shape {
    position: absolute;
    font-size: 2rem;
    animation: float 6s ease-in-out infinite;
    opacity: 0.6;
}
.shape-1 { top: 10%; left: 10%; animation-delay: 0s; }
.shape-2 { top: 20%; right: 15%; animation-delay: -1s; }
.shape-3 { bottom: 25%; left: 15%; animation-delay: -2s; }
.shape-4 { bottom: 15%; right: 10%; animation-delay: -3s; }
.shape-5 { top: 50%; left: 5%; animation-delay: -4s; font-size: 1.5rem; }
.shape-6 { top: 40%; right: 5%; animation-delay: -5s; font-size: 1.5rem; }

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(10deg); }
}

.login-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 48px 40px;
    width: 400px;
    max-width: 90vw;
    z-index: 1;
    animation: slideUp 0.6s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(40px); }
    to { opacity: 1; transform: translateY(0); }
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}
.login-logo .logo-icon {
    font-size: 3.5rem;
    display: block;
    margin-bottom: 8px;
    animation: bounce 2s infinite;
}
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}
.login-logo h1 {
    font-size: 1.8rem;
    background: linear-gradient(135deg, var(--pink), var(--purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.login-logo p {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-top: 4px;
}

.login-form { display: flex; flex-direction: column; gap: 16px; }

.input-group {
    position: relative;
    display: flex;
    align-items: center;
}
.input-icon {
    position: absolute;
    left: 14px;
    font-size: 1.1rem;
    z-index: 1;
}
.input-group input {
    width: 100%;
    padding: 12px 16px 12px 42px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    background: var(--bg);
    transition: var(--transition);
    outline: none;
}
.input-group input:focus {
    border-color: var(--pink-light);
    box-shadow: 0 0 0 4px rgba(255, 107, 157, 0.1);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    text-decoration: none;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary {
    background: linear-gradient(135deg, var(--pink), var(--purple));
    color: #fff;
    box-shadow: 0 4px 16px rgba(255, 107, 157, 0.3);
}
.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(255, 107, 157, 0.4);
}
.btn-ghost {
    background: transparent;
    color: var(--text-light);
}
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-outline {
    background: transparent;
    border: 2px solid var(--border);
    color: var(--text-light);
}
.btn-outline:hover { border-color: var(--purple-light); color: var(--purple); background: #F5F3FF; }
.btn-danger-outline {
    background: transparent;
    border: 2px solid var(--red-light);
    color: var(--red);
}
.btn-danger-outline:hover { background: #FEF2F2; }
.btn-icon { padding: 8px; min-width: unset; }
.btn-sm { padding: 6px 10px; font-size: 0.8rem; }
.btn-xs { padding: 2px 6px; font-size: 0.7rem; }
.btn-login {
    width: 100%;
    padding: 14px;
    font-size: 1rem;
    margin-top: 8px;
}

.error-msg {
    color: var(--red);
    text-align: center;
    font-size: 0.85rem;
}

.spinner {
    width: 20px; height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ========== 主布局 ========== */
.main-layout {
    display: flex;
    min-height: 100vh;
}

/* ========== 侧边栏 ========== */
.sidebar {
    width: 240px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: width var(--transition);
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 100;
}
.sidebar.collapsed { width: 64px; }

.sidebar-header {
    padding: 20px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border);
}
.sidebar-logo {
    font-size: 1.8rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.2s;
}
.sidebar-logo:hover { transform: scale(1.1) rotate(-5deg); }
.sidebar-brand h2 {
    font-size: 1.1rem;
    background: linear-gradient(135deg, var(--pink), var(--purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.sidebar-brand small {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.sidebar-nav {
    flex: 1;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-light);
    text-decoration: none;
    position: relative;
    font-weight: 500;
}
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active {
    background: linear-gradient(135deg, rgba(255, 107, 157, 0.1), rgba(167, 139, 250, 0.1));
    color: var(--pink);
    font-weight: 600;
}
.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: var(--pink);
    border-radius: 0 3px 3px 0;
}
.nav-icon { font-size: 1.2rem; flex-shrink: 0; }
.nav-badge {
    margin-left: auto;
    background: var(--pink-light);
    color: var(--pink);
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 700;
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--border);
}

/* ========== 主内容区 ========== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.top-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 24px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}
.top-bar-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
}
.top-bar-user {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}
.user-avatar { font-size: 1.4rem; }
.user-name { color: var(--text-light); font-weight: 500; }

.toggle-sidebar {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-xs);
    transition: var(--transition);
}
.toggle-sidebar:hover { background: var(--bg); }

/* ========== 页面内容 ========== */
.page-content {
    padding: 24px;
    flex: 1;
    overflow-y: auto;
}

/* ========== 仪表盘 ========== */
.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-radius: var(--radius);
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border: 2px solid transparent;
}
.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent, var(--pink-light));
}
.stat-icon {
    font-size: 2.2rem;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent, var(--pink-bg));
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}
.stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--pink), var(--purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.stat-label {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 2px;
}

/* ========== 图表 ========== */
.charts-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 16px;
}
.chart-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}
.chart-card h3 {
    font-size: 0.95rem;
    margin-bottom: 12px;
    color: var(--text);
}
.chart-box { width: 100%; height: 280px; }

/* ========== 页面工具栏 ========== */
.page-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    flex: 1;
    max-width: 320px;
}
.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.9rem;
}
.search-box input {
    width: 100%;
    padding: 10px 16px 10px 36px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    background: var(--bg-card);
    transition: var(--transition);
    outline: none;
}
.search-box input:focus {
    border-color: var(--pink-light);
    box-shadow: 0 0 0 3px rgba(255, 107, 157, 0.08);
}

/* ========== 表格 ========== */
.table-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}
.data-table th {
    text-align: left;
    padding: 14px 16px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg);
    border-bottom: 2px solid var(--border);
}
.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}
.data-table tbody tr {
    transition: var(--transition);
}
.data-table tbody tr:hover { background: var(--pink-bg); }
.data-table tbody tr:last-child td { border-bottom: none; }

.empty-cell {
    text-align: center;
    padding: 48px 16px !important;
    color: var(--text-muted);
    font-size: 0.95rem;
}

code {
    background: var(--bg);
    padding: 2px 8px;
    border-radius: var(--radius-xs);
    font-size: 0.85em;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    color: var(--purple);
}
.key-value {
    font-size: 0.8em;
    word-break: break-all;
}

.method-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.method-badge.get { background: #DBEAFE; color: #2563EB; }
.method-badge.post { background: #D1FAE5; color: #059669; }
.method-badge.put { background: #FEF3C7; color: #D97706; }
.method-badge.delete { background: #FEE2E2; color: #DC2626; }
.method-badge.patch { background: #EDE9FE; color: #7C3AED; }

.status-dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}
.status-dot.on { background: var(--green); box-shadow: 0 0 6px var(--green); }
.status-dot.off { background: var(--text-muted); }

.status-code {
    font-weight: 700;
    font-size: 0.85rem;
}
.status-code.ok { color: var(--green); }
.status-code.err { color: var(--red); }

.action-cell { display: flex; gap: 6px; flex-wrap: wrap; }

/* ========== 分页 ========== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px;
    border-top: 1px solid var(--border);
}
.pagination button {
    padding: 6px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-xs);
    background: var(--bg-card);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.85rem;
}
.pagination button:hover:not(:disabled) { border-color: var(--purple-light); color: var(--purple); }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }
.pagination span { font-size: 0.85rem; color: var(--text-light); }

/* ========== 弹窗 ========== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(74, 53, 80, 0.3);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 520px;
    max-width: 92vw;
    max-height: 85vh;
    overflow-y: auto;
    animation: modalPop 0.3s ease;
}
.modal-wide { width: 640px; }
@keyframes modalPop {
    from { opacity: 0; transform: scale(0.9) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1.1rem; }
.modal-body { padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}

/* ========== 表单 ========== */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-light);
}
.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: inherit;
    background: var(--bg);
    transition: var(--transition);
    outline: none;
    resize: vertical;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--pink-light);
    box-shadow: 0 0 0 3px rgba(255, 107, 157, 0.08);
}
.form-group input[type="checkbox"] {
    width: 18px; height: 18px;
    accent-color: var(--pink);
    margin-right: 6px;
}
.form-row { display: flex; gap: 12px; }
.flex-1 { flex: 1; }
.flex-2 { flex: 2; }
.code-area {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace !important;
    font-size: 0.8rem !important;
}

/* ========== 测试弹窗 ========== */
.test-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg);
    border-radius: var(--radius-sm);
}
.code-block {
    background: #1e1e2e;
    color: #cdd6f4;
    padding: 14px;
    border-radius: var(--radius-sm);
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.8rem;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 300px;
    overflow-y: auto;
}
.response-block { border-left: 3px solid var(--green); }

/* ========== Toast 通知 ========== */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    pointer-events: all;
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
    font-size: 0.9rem;
    font-weight: 500;
}
.toast.success { border-left: 4px solid var(--green); }
.toast.error { border-left: 4px solid var(--red); }
.toast.info { border-left: 4px solid var(--blue); }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(40px); }
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    .sidebar { width: 64px; }
    .sidebar .sidebar-brand,
    .sidebar .nav-label,
    .sidebar .nav-badge,
    .sidebar .sidebar-footer .btn-ghost { display: none; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .charts-row { grid-template-columns: 1fr; }
    .page-content { padding: 16px; }
    .search-box { max-width: 100%; }
    .form-row { flex-direction: column; }
}