/* ============================================================
   激活码管理系统 - 管理后台样式
   环境: PHP 8.0 + Nginx 1.26
   ============================================================ */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", 
                 "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    color: #333;
    background: #f0f2f5;
    line-height: 1.6;
}
a { color: #667eea; text-decoration: none; }
a:hover { color: #5a6fd6; }
code { 
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    background: #f0f0f0; padding: 2px 6px; border-radius: 4px; font-size: 13px;
}

/* --- Layout --- */
.layout { display: flex; min-height: 100vh; }

/* --- Sidebar --- */
.sidebar {
    width: 240px;
    min-width: 240px;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    color: #ccc;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}
.sidebar-logo {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-logo h3 {
    color: #fff;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.5px;
}
.sidebar-nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}
.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    color: #aab;
    font-size: 15px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}
.nav-item:hover { color: #fff; background: rgba(255,255,255,0.05); }
.nav-item.active {
    color: #fff;
    background: rgba(102,126,234,0.2);
    border-left-color: #667eea;
}
.nav-icon { margin-right: 10px; font-size: 16px; }

/* --- Main Content --- */
.main-content {
    flex: 1;
    margin-left: 240px;
    min-height: 100vh;
}
.content-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 28px;
    background: #fff;
    border-bottom: 1px solid #e8e8e8;
    position: sticky;
    top: 0;
    z-index: 50;
}
.content-header h2 { font-size: 20px; font-weight: 600; color: #1a1a2e; }
.header-right { display: flex; align-items: center; gap: 12px; }
.user-tag { font-size: 13px; color: #666; }
.content-body { padding: 24px 28px; }

/* --- Stats Grid --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: #fff;
    border-radius: 10px;
    padding: 24px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border-left: 4px solid #667eea;
    transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.1); }
.stat-card.stat-active  { border-left-color: #52c41a; }
.stat-card.stat-expired { border-left-color: #faad14; }
.stat-card.stat-disabled { border-left-color: #ff4d4f; }
.stat-number { font-size: 32px; font-weight: 700; color: #1a1a2e; margin-bottom: 4px; }
.stat-label { font-size: 14px; color: #888; }

/* --- Cards --- */
.card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    overflow: hidden;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid #f0f0f0;
}
.card-header h3 { font-size: 16px; font-weight: 600; color: #1a1a2e; }
.card-body { padding: 24px; }

/* --- Tables --- */
.table-wrap { overflow-x: auto; }
.table {
    width: 100%;
    border-collapse: collapse;
}
.table th, .table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
    white-space: nowrap;
}
.table th {
    background: #fafafa;
    font-weight: 600;
    font-size: 13px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.table tbody tr:hover { background: #fafbff; }
.table .empty-cell { 
    text-align: center; 
    color: #bbb; 
    padding: 40px 16px; 
    white-space: normal;
}
.table-detail .label-col { 
    font-weight: 600; 
    width: 120px; 
    color: #666; 
    background: #fafafa; 
}
.actions { display: flex; gap: 6px; align-items: center; }
.actions form { display: inline-flex; }

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 18px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    line-height: 1.4;
    white-space: nowrap;
}
.btn:hover { opacity: 0.85; }
.btn-primary { background: #667eea; color: #fff; border-color: #667eea; }
.btn-primary:hover { background: #5a6fd6; }
.btn-outline { background: #fff; color: #555; border-color: #d9d9d9; }
.btn-outline:hover { color: #667eea; border-color: #667eea; }
.btn-success { background: #52c41a; color: #fff; border-color: #52c41a; }
.btn-warning { background: #faad14; color: #fff; border-color: #faad14; }
.btn-danger { background: #ff4d4f; color: #fff; border-color: #ff4d4f; }
.btn-sm { padding: 4px 12px; font-size: 13px; }
.btn-xs { padding: 2px 10px; font-size: 12px; border-radius: 4px; }

/* --- Alerts --- */
.alert {
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 20px;
}
.alert-error { background: #fff2f0; border: 1px solid #ffccc7; color: #ff4d4f; }
.alert-success { background: #f6ffed; border: 1px solid #b7eb8f; color: #52c41a; }

/* --- Badges --- */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    background: #f0f0f0;
    color: #666;
}
.badge-success { background: #f6ffed; color: #52c41a; }
.badge-warning { background: #fffbe6; color: #faad14; }
.badge-danger  { background: #fff2f0; color: #ff4d4f; }

/* --- Forms --- */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.form-group { margin-bottom: 18px; }
.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 6px;
}
.form-group .required { color: #ff4d4f; }
.form-group small { display: block; margin-top: 4px; font-size: 12px; color: #999; }
.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #d9d9d9;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    background: #fff;
    font-family: inherit;
}
.form-input:focus { border-color: #667eea; box-shadow: 0 0 0 2px rgba(102,126,234,0.1); }
.form-actions {
    display: flex;
    gap: 12px;
    padding-top: 8px;
}
select.form-input { cursor: pointer; }

/* --- Action Bar --- */
.action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}
.action-bar-left, .action-bar-right { display: flex; align-items: center; gap: 8px; }
.select-sm, .input-sm {
    padding: 6px 12px;
    border: 1.5px solid #d9d9d9;
    border-radius: 6px;
    font-size: 13px;
    outline: none;
    font-family: inherit;
}
.input-sm:focus, .select-sm:focus { border-color: #667eea; }

/* --- Pagination --- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    border-top: 1px solid #f0f0f0;
    font-size: 13px;
    color: #888;
}
.pagination-links { display: flex; gap: 4px; }

/* --- Text helpers --- */
.text-muted { color: #999; font-size: 13px; }

/* --- Responsive --- */
@media (max-width: 768px) {
    .sidebar { width: 200px; min-width: 200px; }
    .main-content { margin-left: 200px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .form-row { grid-template-columns: 1fr; }
    .action-bar { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 576px) {
    .sidebar { display: none; }
    .main-content { margin-left: 0; }
    .stats-grid { grid-template-columns: 1fr; }
    .content-header { flex-direction: column; gap: 8px; align-items: flex-start; }
    .content-body { padding: 16px; }
}
