/* ===== Jade Theme for OpenClaw Admin ===== */

/* ---------- Google Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;600;700&display=swap');

/* ---------- CSS Variables ---------- */
:root {
    --jade-50:  #f0f7f2;
    --jade-100: #dceee1;
    --jade-200: #b8ddc3;
    --jade-300: #88c59b;
    --jade-400: #5ba874;
    --jade-500: #3d8b57;
    --jade-600: #2d6f43;
    --jade-700: #245937;
    --jade-800: #1e472d;
    --jade-900: #1a3b26;

    --sidebar-bg: linear-gradient(180deg, #1e472d 0%, #245937 50%, #1a3b26 100%);
    --sidebar-width: 240px;
    --sidebar-hover: rgba(255,255,255,0.08);
    --sidebar-active: rgba(255,255,255,0.15);

    --bg-main: #f4f8f5;
    --bg-card: #ffffff;
    --bg-card-hover: #f8fbf9;

    --text-primary: #1a2e22;
    --text-secondary: #5a6e62;
    --text-muted: #8a9b91;
    --text-on-dark: #e8f0eb;
    --text-on-dark-muted: rgba(255,255,255,0.55);

    --border-color: #d8e5dc;
    --border-light: #e8f0eb;

    --shadow-sm: 0 1px 3px rgba(30,71,45,0.06);
    --shadow-md: 0 4px 12px rgba(30,71,45,0.08);
    --shadow-lg: 0 8px 24px rgba(30,71,45,0.10);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;

    --transition: 0.2s ease;
}

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

body {
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.6;
}

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

/* ---------- Sidebar ---------- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    box-shadow: 2px 0 20px rgba(26,59,38,0.15);
}

.sidebar-brand {
    padding: 24px 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-brand .logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #fff;
}

.sidebar-brand .logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--jade-400), var(--jade-300));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.sidebar-brand .logo-text {
    font-weight: 700;
    font-size: 16px;
    letter-spacing: 0.5px;
}

.sidebar-brand .logo-sub {
    font-size: 11px;
    color: var(--text-on-dark-muted);
    margin-top: -2px;
}

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

.nav-section-title {
    padding: 16px 20px 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-on-dark-muted);
    text-transform: uppercase;
    letter-spacing: 1.2px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--text-on-dark);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 400;
    transition: all var(--transition);
    border-left: 3px solid transparent;
    margin: 1px 0;
}

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

.sidebar-nav a.active {
    background: var(--sidebar-active);
    border-left-color: var(--jade-300);
    color: #fff;
    font-weight: 500;
}

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

.sidebar-nav a.active .nav-icon,
.sidebar-nav a:hover .nav-icon {
    opacity: 1;
}

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

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-user .avatar {
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, var(--jade-400), var(--jade-300));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
}

.sidebar-user .user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user .user-name {
    font-size: 13px;
    font-weight: 500;
    color: #fff;
    line-height: 1.3;
}

.sidebar-user .user-role {
    font-size: 11px;
    color: var(--text-on-dark-muted);
}

.sidebar-logout {
    color: var(--text-on-dark-muted);
    text-decoration: none;
    font-size: 16px;
    padding: 4px;
    border-radius: 6px;
    transition: all var(--transition);
}

.sidebar-logout:hover {
    color: #fff;
    background: rgba(255,255,255,0.1);
}

/* ---------- Main Content ---------- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.content-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-light);
    padding: 20px 32px;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.content-header h4 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.content-body {
    padding: 24px 32px;
}

/* ---------- Login Page (no sidebar) ---------- */
.login-page {
    min-height: 100vh;
    display: flex;
    background: linear-gradient(135deg, var(--jade-700) 0%, var(--jade-800) 50%, var(--jade-900) 100%);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(91,168,116,0.15) 0%, transparent 70%);
    border-radius: 50%;
}

.login-page::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(136,197,155,0.1) 0%, transparent 70%);
    border-radius: 50%;
}

.login-container {
    width: 100%;
    max-width: 420px;
    margin: auto;
    padding: 20px;
    position: relative;
    z-index: 1;
}

.login-card {
    background: rgba(255,255,255,0.97);
    border-radius: var(--radius-lg);
    padding: 40px 36px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    backdrop-filter: blur(20px);
}

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

.login-logo .icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--jade-500), var(--jade-400));
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    color: #fff;
    margin-bottom: 14px;
    box-shadow: 0 4px 16px rgba(61,139,87,0.3);
}

.login-logo h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.login-logo p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 4px 0 0;
}

/* ---------- Cards ---------- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    background: var(--jade-50);
    border-bottom: 1px solid var(--border-light);
    font-weight: 600;
    font-size: 14px;
    color: var(--jade-700);
    padding: 14px 20px;
}

.card-body {
    padding: 20px;
}

/* ---------- Stats Cards ---------- */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--jade-400);
    border-radius: 0 4px 4px 0;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-card .stat-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.stat-card .stat-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-card .stat-value small {
    font-size: 13px;
    font-weight: 400;
    color: var(--text-muted);
}

.stat-card.accent-green::before { background: var(--jade-400); }
.stat-card.accent-blue::before { background: #4E97D1; }
.stat-card.accent-amber::before { background: #D4A053; }
.stat-card.accent-red::before { background: #C76B6B; }

/* ---------- Tables ---------- */
.table-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.table {
    margin: 0;
    font-size: 13.5px;
}

.table thead th {
    background: var(--jade-50);
    border-bottom: 2px solid var(--border-color);
    color: var(--jade-700);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 16px;
    white-space: nowrap;
}

.table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
    color: var(--text-primary);
}

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

.table tbody tr:hover {
    background: var(--bg-card-hover);
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
    --bs-table-bg-type: transparent;
}

/* ---------- Badges ---------- */
.badge {
    font-weight: 500;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 20px;
    letter-spacing: 0.3px;
}

.badge-pending {
    background: #FFF3E0;
    color: #E65100;
}

.badge-success {
    background: var(--jade-100);
    color: var(--jade-700);
}

.badge-danger {
    background: #FDEAEA;
    color: #C62828;
}

.badge-info {
    background: #E3F2FD;
    color: #1565C0;
}

/* ---------- Buttons ---------- */
.btn-primary {
    background: var(--jade-500);
    border-color: var(--jade-500);
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 13.5px;
    padding: 8px 20px;
    transition: all var(--transition);
}

.btn-primary:hover {
    background: var(--jade-600);
    border-color: var(--jade-600);
    box-shadow: 0 2px 8px rgba(45,111,67,0.25);
}

.btn-outline-primary {
    color: var(--jade-600);
    border-color: var(--jade-400);
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 13.5px;
}

.btn-outline-primary:hover {
    background: var(--jade-500);
    border-color: var(--jade-500);
}

.btn-secondary {
    background: #edf2ee;
    border-color: #edf2ee;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 13.5px;
}

.btn-secondary:hover {
    background: #dfe6e0;
    border-color: #dfe6e0;
    color: var(--text-primary);
}

.btn-sm {
    padding: 4px 12px;
    font-size: 12.5px;
    border-radius: var(--radius-sm);
}

.btn-action {
    background: var(--jade-50);
    color: var(--jade-600);
    border: 1px solid var(--jade-200);
    border-radius: var(--radius-sm);
    padding: 4px 12px;
    font-size: 12.5px;
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition);
}

.btn-action:hover {
    background: var(--jade-100);
    color: var(--jade-700);
    border-color: var(--jade-300);
}

/* ---------- Forms ---------- */
.form-control, .form-select {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    padding: 8px 14px;
    transition: all var(--transition);
    color: var(--text-primary);
}

.form-control:focus, .form-select:focus {
    border-color: var(--jade-400);
    box-shadow: 0 0 0 3px rgba(91,168,116,0.15);
}

.form-label {
    font-weight: 500;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-text {
    font-size: 12px;
    color: var(--text-muted);
}

.form-check-input:checked {
    background-color: var(--jade-500);
    border-color: var(--jade-500);
}

.form-check-input:focus {
    box-shadow: 0 0 0 3px rgba(91,168,116,0.15);
    border-color: var(--jade-400);
}

.text-danger {
    font-size: 12.5px;
}

/* ---------- Alerts ---------- */
.alert {
    border: none;
    border-radius: var(--radius-md);
    padding: 14px 20px;
    font-size: 13.5px;
    font-weight: 500;
}

.alert-success {
    background: var(--jade-100);
    color: var(--jade-800);
}

.alert-danger {
    background: #FDEAEA;
    color: #C62828;
}

/* ---------- Filter Bar ---------- */
.filter-bar {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-bar .form-select {
    width: auto;
    min-width: 140px;
    font-size: 13px;
    padding: 6px 12px;
}

/* ---------- Detail View ---------- */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 32px;
}

.detail-item {
    padding: 8px 0;
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.detail-item .label {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    min-width: 80px;
}

.detail-item .value {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

/* ---------- Commission Info ---------- */
.commission-box {
    background: var(--jade-50);
    border: 1px solid var(--jade-200);
    border-radius: var(--radius-md);
    padding: 20px;
}

.commission-box .title {
    font-size: 13px;
    font-weight: 600;
    color: var(--jade-700);
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--jade-200);
}

.commission-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 14px;
}

.commission-row .label { color: var(--text-secondary); }
.commission-row .value { font-weight: 600; color: var(--text-primary); }

.commission-row.total {
    border-top: 1px solid var(--jade-200);
    margin-top: 8px;
    padding-top: 12px;
}

.commission-row.total .label { color: var(--jade-700); font-weight: 600; }
.commission-row.total .value { color: var(--jade-700); font-size: 18px; }

/* ---------- Pagination ---------- */
.pagination {
    gap: 4px;
}

.page-link {
    border: 1px solid var(--border-color);
    color: var(--jade-600);
    border-radius: var(--radius-sm) !important;
    font-size: 13px;
    padding: 6px 12px;
}

.page-item.active .page-link {
    background: var(--jade-500);
    border-color: var(--jade-500);
}

/* ---------- Empty State ---------- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.4;
}

.empty-state p {
    font-size: 14px;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .main-content { margin-left: 0; }
    .content-body { padding: 16px; }
    .detail-grid { grid-template-columns: 1fr; }
}
