/* ============================================================
   代理商 - 管理后台样式
   色系：石板灰 + 暖灰 专业中性风格
   ============================================================ */

:root {
    --sidebar-width: 320px;
    --color-primary: #B8860B;
    --color-primary-hover: #8B6914;
    --color-accent: #D4A843;
    --color-success: #16a34a;
    --color-danger: #dc2626;
    --color-warning: #d97706;
    --color-info: #8B7355;
    --color-bg: #FFF9F0;
    --color-sidebar-bg: #1A0F0A;
    --color-sidebar-text: #C4A882;
    --color-sidebar-hover: rgba(184,134,11,0.15);
    --color-sidebar-active: rgba(184,134,11,0.25);
    --color-text: #2C1810;
    --color-text-muted: #8B7355;
    --color-border: #E8D5A3;
    --radius: 10px;
    --radius-sm: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 14px;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { color: var(--color-primary-hover); }

/* ---------- Login ---------- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1A0F0A 0%, #2C1810 100%);
}

.login-box {
    background: #FFF9F0;
    padding: 40px;
    border-radius: var(--radius);
    width: 400px;
    max-width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    border: 1px solid rgba(184,134,11,0.2);
}

.login-box h1 {
    text-align: center;
    font-size: 22px;
    margin-bottom: 8px;
    color: #2C1810;
}

.login-box p {
    text-align: center;
    color: var(--color-text-muted);
    margin-bottom: 28px;
    font-size: 14px;
}

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

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 14px;
    color: #475569;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(51,65,85,0.1);
}

.form-group textarea {
    min-height: 120px;
    resize: vertical;
}

.form-group .help-text {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-top: 4px;
}

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

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 24px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-hover); }

.btn-success { background: var(--color-success); color: #fff; }
.btn-success:hover { background: #15803d; }

.btn-danger { background: var(--color-danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }

.btn-warning { background: var(--color-warning); color: #fff; }
.btn-warning:hover { background: #b45309; }

.btn-secondary { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
.btn-secondary:hover { background: #e2e8f0; }

.btn-info { background: #3b82f6; color: #fff; }
.btn-info:hover { background: #2563eb; }

.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; }

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

.admin-sidebar {
    width: var(--sidebar-width);
    background: var(--color-sidebar-bg);
    color: #fff;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 100;
}

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

.sidebar-header h2 {
    font-size: 16px;
    color: #fff;
}

.sidebar-header p {
    font-size: 12px;
    color: var(--color-sidebar-text);
    margin-top: 4px;
}

.sidebar-nav {
    padding: 12px 0;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: var(--color-sidebar-text);
    font-size: 14px;
    transition: all 0.2s;
    text-decoration: none;
}

.sidebar-nav a:hover {
    background: var(--color-sidebar-hover);
    color: #fff;
}

.sidebar-nav a.active {
    background: var(--color-sidebar-active);
    color: #fff;
}

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

.admin-main {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 24px;
    min-height: 100vh;
}

.admin-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    background: #FFF9F0;
    padding: 16px 24px;
    border-radius: var(--radius);
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    border: 1px solid #E8D5A3;
}

.admin-topbar h2 {
    font-size: 18px;
    color: #2C1810;
}

.admin-topbar .user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: #64748b;
}

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

.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.stat-card .stat-number {
    font-size: 32px;
    font-weight: 700;
    color: #2C1810;
}

.stat-card .stat-label {
    font-size: 14px;
    color: #8B7355;
    margin-top: 4px;
}

.stat-card .stat-icon {
    font-size: 28px;
    float: right;
    opacity: 0.4;
}

/* ---------- Data Table ---------- */
.data-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    overflow: hidden;
    margin-bottom: 24px;
}

.data-card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.data-card-header h3 {
    font-size: 16px;
    color: #2C1810;
}

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

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #f1f5f9;
    font-size: 14px;
}

.data-table th {
    background: #F5EDD6;
    font-weight: 600;
    color: #8B7355;
    font-size: 13px;
    text-transform: uppercase;
}

.data-table tr:hover td {
    background: #f8fafc;
}

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

/* admin-table 兼容（用于 agent-reviews, agent-applications 等页面） */
table.admin-table {
    width: 100%;
    border-collapse: collapse;
}
table.admin-table th,
table.admin-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #f1f5f9;
    font-size: 14px;
}
table.admin-table th {
    background: #F5EDD6;
    font-weight: 600;
    color: #8B7355;
    font-size: 13px;
    text-transform: uppercase;
}
table.admin-table tr:hover td {
    background: #f8fafc;
}

/* ---------- Badge ---------- */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success { background: #dcfce7; color: #15803d; }
.badge-danger { background: #fee2e2; color: #b91c1c; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #f1f5f9; color: #475569; }

/* ---------- Alert ---------- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 16px;
}

.alert-success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.alert-danger { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: #FFF9F0; color: #8B7355; border: 1px solid #E8D5A3; }

/* ---------- Modal ---------- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-box {
    background: #fff;
    border-radius: var(--radius);
    padding: 30px;
    width: 500px;
    max-width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal-box h3 {
    margin-bottom: 20px;
}

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

/* ---------- Image Preview ---------- */
.image-preview {
    max-width: 200px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    margin-top: 8px;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .admin-sidebar {
        width: 60px;
    }
    .admin-sidebar .sidebar-header h2,
    .admin-sidebar .sidebar-header p,
    .admin-sidebar .sidebar-nav a span {
        display: none;
    }
    .admin-main {
        margin-left: 60px;
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .data-table {
        font-size: 12px;
    }
    .data-table th,
    .data-table td {
        padding: 8px;
    }
}
