/* ============================================================
   Feoin Admin 后台管理系统 - 专用样式
   基于 design-system.css，提供后台管理界面专用组件
   ============================================================ */

/* --- 基础布局 --- */
body {
    font-family: 'Manrope', 'PingFang SC', sans-serif;
    background-color: #f1f5f9;
    color: #0f172a;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Hanken Grotesk', 'PingFang SC', sans-serif;
    letter-spacing: -0.02em;
}

/* --- Admin 布局：侧边栏 + 顶栏 + 内容区 --- */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 256px;
    background: #0f172a;
    color: #cbd5e1;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 50;
    overflow-y: auto;
    transition: transform 0.3s ease;
}

.admin-sidebar-brand {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #1e293b;
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.admin-sidebar-brand img {
    height: 28px;
    width: auto;
}

.admin-sidebar-brand-text {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.01em;
}

.admin-sidebar-nav {
    padding: 0.75rem 0;
}

.admin-sidebar-section {
    padding: 0.5rem 1.5rem 0.25rem;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
}

.admin-sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1.5rem;
    font-size: 0.875rem;
    color: #cbd5e1;
    text-decoration: none;
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
}

.admin-sidebar-link:hover {
    background: #1e293b;
    color: #fff;
}

.admin-sidebar-link.active {
    background: #1e293b;
    color: #fff;
    border-left-color: #3b82f6;
}

.admin-sidebar-link svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.8;
}

.admin-sidebar-link.active svg {
    opacity: 1;
}

/* --- 主内容区 --- */
.admin-main {
    flex: 1;
    margin-left: 256px;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.admin-topbar {
    height: 64px;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 40;
}

.admin-topbar-title {
    font-size: 1rem;
    font-weight: 600;
    color: #0f172a;
}

.admin-topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.admin-topbar-avatar {
    width: 36px;
    height: 36px;
    border-radius: 9999px;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 600;
    color: #475569;
}

.admin-content {
    padding: 1.5rem;
    flex: 1;
}

/* --- 卡片 --- */
.admin-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    overflow: hidden;
}

.admin-card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.admin-card-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #0f172a;
}

.admin-card-body {
    padding: 1.25rem;
}

/* --- 统计卡片 --- */
.admin-stat-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    padding: 1.25rem;
    transition: all 0.2s ease;
}

.admin-stat-card:hover {
    box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.05);
    border-color: #cbd5e1;
}

.admin-stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 0.625rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.admin-stat-icon svg {
    width: 22px;
    height: 22px;
}

.admin-stat-label {
    font-size: 0.8125rem;
    color: #64748b;
    font-weight: 500;
}

.admin-stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #0f172a;
    font-family: 'Hanken Grotesk', sans-serif;
    line-height: 1.2;
}

.admin-stat-trend {
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.admin-stat-trend.up { color: #16a34a; }
.admin-stat-trend.down { color: #dc2626; }

/* --- 表格 --- */
.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th {
    text-align: left;
    padding: 0.75rem 1.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}

.admin-table td {
    padding: 0.875rem 1.25rem;
    font-size: 0.875rem;
    color: #334155;
    border-bottom: 1px solid #f1f5f9;
}

.admin-table tbody tr:hover {
    background: #f8fafc;
}

.admin-table tbody tr:last-child td {
    border-bottom: none;
}

/* --- 徽章 --- */
.admin-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.1875rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    white-space: nowrap;
}

.admin-badge-success { background: #dcfce7; color: #15803d; }
.admin-badge-warning { background: #fef3c7; color: #b45309; }
.admin-badge-danger  { background: #fee2e2; color: #b91c1c; }
.admin-badge-info    { background: #dbeafe; color: #1d4ed8; }
.admin-badge-neutral { background: #f1f5f9; color: #475569; }

/* --- 按钮 --- */
.admin-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.875rem;
    font-size: 0.8125rem;
    font-weight: 600;
    border-radius: 0.5rem;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.admin-btn-primary {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
}

.admin-btn-primary:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

.admin-btn-secondary {
    background: #fff;
    color: #334155;
    border-color: #cbd5e1;
}

.admin-btn-secondary:hover {
    background: #f8fafc;
    border-color: #94a3b8;
}

.admin-btn-danger {
    background: #fff;
    color: #dc2626;
    border-color: #fecaca;
}

.admin-btn-danger:hover {
    background: #fef2f2;
}

.admin-btn-sm {
    padding: 0.3125rem 0.625rem;
    font-size: 0.75rem;
}

.admin-btn-icon {
    padding: 0.375rem;
    width: 32px;
    height: 32px;
    justify-content: center;
}

.admin-btn-icon svg {
    width: 16px;
    height: 16px;
}

/* --- 输入框 --- */
.admin-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: #0f172a;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 0.5rem;
    transition: all 0.15s ease;
    outline: none;
}

.admin-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.admin-input::placeholder {
    color: #94a3b8;
}

.admin-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    padding-right: 2rem;
}

/* --- 搜索框 --- */
.admin-search {
    position: relative;
    max-width: 320px;
    width: 100%;
}

.admin-search svg {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: #94a3b8;
    pointer-events: none;
}

.admin-search input {
    padding-left: 2.25rem;
}

/* --- 分页 --- */
.admin-pagination {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.admin-pagination-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 0.5rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #475569;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.admin-pagination-btn:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.admin-pagination-btn.active {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
}

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

/* --- 模态框 --- */
.admin-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.admin-modal {
    background: #fff;
    border-radius: 0.75rem;
    width: 100%;
    max-width: 540px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.admin-modal-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.admin-modal-title {
    font-size: 1rem;
    font-weight: 600;
    color: #0f172a;
}

.admin-modal-body {
    padding: 1.25rem;
    overflow-y: auto;
    flex: 1;
}

.admin-modal-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* --- 表单 --- */
.admin-form-group {
    margin-bottom: 1rem;
}

.admin-form-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 0.375rem;
}

.admin-form-label .required {
    color: #dc2626;
    margin-left: 0.125rem;
}

.admin-form-hint {
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 0.25rem;
}

/* --- Toast 提示 --- */
.admin-toast-container {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.admin-toast {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    min-width: 280px;
    animation: toast-slide-in 0.25s ease-out;
}

@keyframes toast-slide-in {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.admin-toast-success { border-left: 4px solid #16a34a; }
.admin-toast-error   { border-left: 4px solid #dc2626; }
.admin-toast-info    { border-left: 4px solid #2563eb; }

/* --- 空状态 --- */
.admin-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: #94a3b8;
}

.admin-empty svg {
    width: 48px;
    height: 48px;
    margin: 0 auto 0.75rem;
    opacity: 0.5;
}

/* --- 加载状态 --- */
.admin-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    color: #94a3b8;
}

.admin-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #e2e8f0;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* --- 登录页 --- */
.admin-login-bg {
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.admin-login-card {
    background: #fff;
    border-radius: 1rem;
    width: 100%;
    max-width: 400px;
    padding: 2rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.admin-login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    margin-bottom: 1.5rem;
}

.admin-login-logo img {
    height: 32px;
}

.admin-login-logo-text {
    font-size: 1.125rem;
    font-weight: 700;
    color: #0f172a;
}

/* --- 响应式 --- */
@media (max-width: 1024px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }

    .admin-sidebar.open {
        transform: translateX(0);
    }

    .admin-main {
        margin-left: 0;
    }

    .admin-sidebar-toggle {
        display: inline-flex !important;
    }
}

.admin-sidebar-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 0.5rem;
    border: 1px solid #e2e8f0;
    background: #fff;
    cursor: pointer;
}

.admin-sidebar-toggle svg {
    width: 20px;
    height: 20px;
    color: #475569;
}
