/* ================================
   后台管理面板样式
   ================================ */

/* Reset & Base */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --admin-primary: #0a4d8f;
    --admin-primary-light: #1a6fc4;
    --admin-accent: #00a8e8;
    --admin-success: #27ae60;
    --admin-warning: #f39c12;
    --admin-danger: #e74c3c;
    --admin-text: #333;
    --admin-text-light: #888;
    --admin-bg: #f0f2f5;
    --admin-white: #fff;
    --admin-border: #e0e6ed;
    --admin-sidebar: #0d1b2a;
    --admin-sidebar-active: #1a3a5c;
    --admin-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

body {
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    background: var(--admin-bg);
    color: var(--admin-text);
    line-height: 1.6;
}

a { text-decoration: none; color: inherit; transition: all .2s; }

/* ===== Login Page ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0d1b2a, #0a4d8f, #00a8e8);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 30% 40%, rgba(0,168,232,0.3), transparent 50%),
        radial-gradient(circle at 70% 60%, rgba(26,111,196,0.3), transparent 50%);
}

.login-box {
    position: relative;
    z-index: 2;
    width: 420px;
    background: var(--admin-white);
    border-radius: 16px;
    padding: 50px 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-box .logo {
    text-align: center;
    margin-bottom: 35px;
}

.login-box .logo .icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--admin-primary), var(--admin-accent));
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 28px;
    font-weight: bold;
    margin-bottom: 15px;
}

.login-box .logo h2 {
    font-size: 20px;
    color: var(--admin-text);
    font-weight: 700;
}

.login-box .logo p {
    font-size: 13px;
    color: var(--admin-text-light);
}

.login-error {
    padding: 12px 16px;
    background: #ffe6e6;
    border: 1px solid #ffcccc;
    border-radius: 8px;
    color: var(--admin-danger);
    font-size: 14px;
    margin-bottom: 20px;
    display: none;
}

.login-error.show { display: block; }

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form .form-group label {
    display: block;
    font-size: 14px;
    color: var(--admin-text);
    margin-bottom: 8px;
    font-weight: 500;
}

.login-form .form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    transition: all .2s;
}

.login-form .form-group input:focus {
    outline: none;
    border-color: var(--admin-accent);
    box-shadow: 0 0 0 3px rgba(0,168,232,0.1);
}

.login-form .login-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--admin-primary), var(--admin-accent));
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    letter-spacing: 2px;
}

.login-form .login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,168,232,0.3);
}

.login-hint {
    margin-top: 20px;
    text-align: center;
    font-size: 13px;
    color: var(--admin-text-light);
}

/* ===== Admin Layout ===== */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
    width: 240px;
    background: var(--admin-sidebar);
    color: rgba(255,255,255,0.8);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.sidebar-header {
    padding: 25px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header .logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-header .logo .icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--admin-primary), var(--admin-accent));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    font-weight: bold;
}

.sidebar-header .logo .text {
    font-size: 15px;
    font-weight: 600;
    color: white;
}

.sidebar-header .logo .text .sub {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
    margin-top: 2px;
}

.sidebar-nav {
    flex: 1;
    padding: 15px 0;
}

.sidebar-nav .nav-section {
    padding: 10px 20px 5px;
    font-size: 12px;
    color: rgba(255,255,255,0.4);
    letter-spacing: 1px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: rgba(255,255,255,0.7);
    font-size: 14px;
    border-radius: 0;
    transition: all .2s;
    position: relative;
}

.sidebar-nav a:hover {
    background: var(--admin-sidebar-active);
    color: white;
}

.sidebar-nav a.active {
    background: var(--admin-sidebar-active);
    color: white;
    border-left: 3px solid var(--admin-accent);
}

.sidebar-nav a .nav-icon {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

.sidebar-nav a .badge {
    margin-left: auto;
    background: var(--admin-danger);
    color: white;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-footer .logout-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
    color: rgba(255,255,255,0.7);
    font-size: 14px;
    cursor: pointer;
    transition: all .2s;
    width: 100%;
    border: none;
}

.sidebar-footer .logout-btn:hover {
    background: var(--admin-danger);
    color: white;
}

/* Main Content */
.admin-main {
    flex: 1;
    margin-left: 240px;
    min-height: 100vh;
}

.admin-topbar {
    background: var(--admin-white);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--admin-border);
    box-shadow: var(--admin-shadow);
    position: sticky;
    top: 0;
    z-index: 50;
}

.admin-topbar .page-title h3 {
    font-size: 18px;
    font-weight: 600;
}

.admin-topbar .page-title p {
    font-size: 13px;
    color: var(--admin-text-light);
}

.admin-topbar .user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--admin-text-light);
}

.admin-topbar .user-info .avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--admin-primary), var(--admin-accent));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 14px;
}

.admin-content {
    padding: 30px;
}

/* ===== Dashboard ===== */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--admin-white);
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--admin-shadow);
    display: flex;
    align-items: center;
    gap: 15px;
}

.stat-card .stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
}

.stat-card .stat-icon.blue { background: linear-gradient(135deg, #0a4d8f, #1a6fc4); }
.stat-card .stat-icon.green { background: linear-gradient(135deg, #27ae60, #2ecc71); }
.stat-card .stat-icon.orange { background: linear-gradient(135deg, #f39c12, #f1c40f); }
.stat-card .stat-icon.red { background: linear-gradient(135deg, #e74c3c, #c0392b); }

.stat-card .stat-info .stat-number {
    font-size: 28px;
    font-weight: 700;
    color: var(--admin-text);
    line-height: 1.2;
}

.stat-card .stat-info .stat-label {
    font-size: 13px;
    color: var(--admin-text-light);
}

.dashboard-section {
    background: var(--admin-white);
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--admin-shadow);
    margin-bottom: 20px;
}

.dashboard-section .section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.dashboard-section .section-head h4 {
    font-size: 16px;
    font-weight: 600;
}

.dashboard-section .section-head a {
    font-size: 14px;
    color: var(--admin-accent);
}

/* ===== Data Tables ===== */
.data-table-wrap {
    background: var(--admin-white);
    border-radius: 12px;
    box-shadow: var(--admin-shadow);
    overflow: hidden;
}

.data-table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid var(--admin-border);
}

.data-table-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.data-table-actions {
    display: flex;
    gap: 10px;
}

.btn {
    padding: 8px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all .2s;
    border: none;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--admin-primary), var(--admin-accent));
    color: white;
}

.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,168,232,0.3); }

.btn-success { background: var(--admin-success); color: white; }
.btn-warning { background: var(--admin-warning); color: white; }
.btn-danger { background: var(--admin-danger); color: white; }
.btn-outline { background: transparent; border: 1px solid var(--admin-border); color: var(--admin-text); }
.btn-outline:hover { border-color: var(--admin-accent); color: var(--admin-accent); }
.btn-sm { padding: 5px 12px; font-size: 13px; }

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: var(--admin-bg);
    padding: 12px 15px;
    font-size: 13px;
    font-weight: 600;
    color: var(--admin-text-light);
    text-align: left;
    border-bottom: 1px solid var(--admin-border);
}

.data-table td {
    padding: 12px 15px;
    font-size: 14px;
    border-bottom: 1px solid var(--admin-border);
}

.data-table tr:hover td { background: rgba(0,168,232,0.03); }

.data-table .status-badge {
    padding: 3px 10px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge.active { background: #e8f5e9; color: var(--admin-success); }
.status-badge.inactive { background: #ffebee; color: var(--admin-danger); }
.status-badge.unread { background: #fff3e0; color: var(--admin-warning); }
.status-badge.read { background: #e8f5e9; color: var(--admin-success); }

.data-table .actions {
    display: flex;
    gap: 8px;
}

/* ===== Modal / Dialog ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-overlay.show { display: flex; }

.modal {
    width: 600px;
    max-width: 90vw;
    background: var(--admin-white);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
}

.modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid var(--admin-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    font-size: 24px;
    cursor: pointer;
    color: var(--admin-text-light);
    line-height: 1;
}

.modal-close:hover { color: var(--admin-text); }

.modal-body {
    padding: 25px;
}

.modal-body .form-group {
    margin-bottom: 18px;
}

.modal-body .form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
}

.modal-body .form-group label .req { color: var(--admin-danger); }

.modal-body .form-group input,
.modal-body .form-group textarea,
.modal-body .form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: all .2s;
    background: var(--admin-bg);
}

.modal-body .form-group input:focus,
.modal-body .form-group textarea:focus,
.modal-body .form-group select:focus {
    outline: none;
    border-color: var(--admin-accent);
    background: var(--admin-white);
    box-shadow: 0 0 0 3px rgba(0,168,232,0.1);
}

.modal-body .form-group textarea { min-height: 100px; resize: vertical; }

.modal-body .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.modal-footer {
    padding: 15px 25px;
    border-top: 1px solid var(--admin-border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ===== Settings Page ===== */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.settings-card {
    background: var(--admin-white);
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--admin-shadow);
}

.settings-card h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--admin-border);
}

.settings-card .form-group {
    margin-bottom: 15px;
}

.settings-card .form-group label {
    display: block;
    font-size: 13px;
    color: var(--admin-text-light);
    margin-bottom: 6px;
}

.settings-card .form-group input,
.settings-card .form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: var(--admin-bg);
}

.settings-card .form-group input:focus,
.settings-card .form-group textarea:focus {
    outline: none;
    border-color: var(--admin-accent);
    background: var(--admin-white);
}

.settings-card .form-group textarea { min-height: 80px; resize: vertical; }

/* ===== Messages ===== */
.message-detail {
    background: var(--admin-white);
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--admin-shadow);
}

.message-detail .msg-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.message-detail .msg-header h4 {
    font-size: 18px;
}

.message-detail .msg-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.message-detail .msg-meta .meta-item {
    padding: 10px;
    background: var(--admin-bg);
    border-radius: 8px;
}

.message-detail .msg-meta .meta-item .label {
    font-size: 12px;
    color: var(--admin-text-light);
}

.message-detail .msg-meta .meta-item .value {
    font-size: 14px;
    margin-top: 3px;
}

.message-detail .msg-content {
    padding: 20px;
    background: var(--admin-bg);
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.8;
}

/* Responsive */
@media (max-width: 768px) {
    .admin-sidebar { width: 200px; }
    .admin-main { margin-left: 200px; }
    .dashboard-stats { grid-template-columns: repeat(2, 1fr); }
    .settings-grid { grid-template-columns: 1fr; }
    .modal-body .form-row { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .admin-sidebar {
        width: 60px;
    }
    .admin-sidebar .sidebar-header .logo .text { display: none; }
    .admin-sidebar .sidebar-nav a .nav-text { display: none; }
    .admin-sidebar .sidebar-nav a .badge { display: none; }
    .admin-sidebar .sidebar-nav .nav-section { display: none; }
    .admin-main { margin-left: 60px; }
    .dashboard-stats { grid-template-columns: 1fr 1fr; }
}
