/* ─── Design Tokens ───────────────────────────────────────── */
:root {
    --color-bg: #f0f2f5;
    --color-surface: #ffffff;
    --color-border: #e8e8e8;
    --color-text-primary: #1a1a2e;
    --color-text-secondary: #6b7280;
    --color-text-muted: #9ca3af;

    --color-blue: #3b82f6;
    --color-blue-light: #eff6ff;
    --color-blue-border: #bfdbfe;

    --color-green: #10b981;
    --color-green-light: #ecfdf5;

    --color-emerald: #059669;
    --color-emerald-light: #d1fae5;

    --color-purple: #8b5cf6;
    --color-purple-light: #f5f3ff;

    --color-danger: #ef4444;
    --color-danger-light: #fef2f2;
    --color-danger-border: #fecaca;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);

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

/* ─── Reset ───────────────────────────────────────────────── */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; background: var(--color-bg); color: #333; }
a { color: var(--color-blue); text-decoration: none; }

/* ─── Top Bar ─────────────────────────────────────────────── */
.top-bar { background: #fff; border-bottom: 1px solid #e0e0e0; padding: 0 32px; height: 64px; display: flex; align-items: center; justify-content: space-between; box-shadow: 0 2px 4px rgba(0,0,0,0.04); position: sticky; top: 0; z-index: 100; }
.top-bar h1 { font-size: 20px; font-weight: 600; color: #1a1a1a; }
.burger-btn { display: none; flex-direction: column; gap: 4px; background: none; border: none; cursor: pointer; padding: 8px; z-index: 101; }
.burger-btn span { width: 24px; height: 2px; background: #262626; transition: all 0.3s; border-radius: 2px; }
.burger-btn.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.burger-btn.active span:nth-child(2) { opacity: 0; }
.burger-btn.active span:nth-child(3) { transform: rotate(-45deg) translate(7px, -7px); }
.top-bar-nav { display: flex; align-items: center; gap: 8px; }
.nav-link { padding: 8px 16px; border-radius: 6px; font-size: 14px; font-weight: 500; color: #595959; text-decoration: none; transition: all 0.2s; }
.nav-link:hover { background: #f5f5f5; color: #1890ff; }

/* ─── Buttons ─────────────────────────────────────────────── */
.btn { padding: 10px 20px; border: none; border-radius: 6px; font-size: 14px; font-weight: 500; cursor: pointer; transition: all 0.2s; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; }
.btn-primary { background: #1890ff; color: white; }
.btn-primary:hover { background: #0077ea; }
.btn-success { background: #52c41a; color: white; }
.btn-success:hover { background: #3fa714; }
.btn-danger { background: #ff4d4f; color: white; }
.btn-danger:hover { background: #d9363e; }
.btn-default { background: #ffffff; color: #595959; border: 1px solid #d9d9d9; }
.btn-default:hover { background: #fafafa; border-color: #bfbfbf; }
.btn-logout { margin-left: 8px; background: #fff; border: 1px solid #d9d9d9; color: #595959; }
.btn-logout:hover { background: #fff1f0; border-color: #ffccc7; color: #ff4d4f; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.icon { width: 18px; height: 18px; flex-shrink: 0; }

/* ─── Main Panel ──────────────────────────────────────────── */
.main-panel { max-width: 1280px; margin: 32px auto; padding: 0 32px; display: flex; flex-direction: column; gap: 24px; }

/* ─── Panel Card ──────────────────────────────────────────── */
.panel-card { background: var(--color-surface); border-radius: var(--radius-md); padding: 24px; box-shadow: var(--shadow-sm); }

/* ─── Section Card ────────────────────────────────────────── */
.section-card { background: var(--color-surface); border-radius: var(--radius-md); padding: 24px; box-shadow: var(--shadow-sm); }
.section-title { font-size: 13px; font-weight: 700; color: var(--color-text-secondary); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--color-border); display: flex; align-items: center; gap: 8px; }
.section-title svg { width: 18px; height: 18px; color: var(--color-text-muted); flex-shrink: 0; }

/* ─── Skeleton Loading ────────────────────────────────────── */
.skeleton { position: relative; color: transparent !important; background: #e5e7eb; border-radius: 4px; overflow: hidden; min-width: 60px; min-height: 1.2em; display: inline-block; }
.skeleton::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent); animation: shimmer 1.5s infinite; }
@keyframes shimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

/* ─── Badge ───────────────────────────────────────────────── */
.badge { display: inline-block; padding: 3px 9px; border-radius: 4px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-admin { background: #fff0f6; color: #c41d7f; }
.badge-distributor { background: #f9f0ff; color: #722ed1; }
.badge-partner { background: #e6f7ff; color: #1890ff; }
.badge-member { background: #f5f5f5; color: #595959; }
.badge-pending { background: #fff7e6; color: #fa8c16; }
.badge-done { background: #f6ffed; color: #389e0d; }
.badge-confirmed { background: #f6ffed; color: #389e0d; }
.badge-distributed { background: #e6f7ff; color: #1890ff; }

/* ─── Form ────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 13px; font-weight: 500; color: #595959; }
.form-input { padding: 9px 12px; border: 1px solid #d9d9d9; border-radius: 6px; font-size: 14px; transition: all 0.2s; background: #fff; width: 100%; }
.form-input:focus { outline: none; border-color: #1890ff; box-shadow: 0 0 0 2px rgba(24,144,255,0.1); }
.form-select { padding: 9px 12px; border: 1px solid #d9d9d9; border-radius: 6px; font-size: 14px; color: #595959; background: #fff; cursor: pointer; transition: all 0.2s; width: 100%; }
.form-select:focus { outline: none; border-color: #1890ff; box-shadow: 0 0 0 2px rgba(24,144,255,0.1); }
.form-textarea { resize: vertical; min-height: 80px; font-family: inherit; }

/* ─── Table ───────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th, .data-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #f0f0f0; }
.data-table th { background: #fafafa; font-weight: 600; color: #595959; font-size: 13px; }
.data-table tr:hover { background: #fafafa; }

/* ─── Toast ───────────────────────────────────────────────── */
.toast-container { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 8px; z-index: 9999; pointer-events: none; }
.toast { padding: 12px 20px; border-radius: 8px; font-size: 14px; font-weight: 500; color: #fff; box-shadow: 0 4px 16px rgba(0,0,0,0.18); opacity: 0; transform: translateY(10px); transition: opacity 0.25s, transform 0.25s; pointer-events: auto; max-width: 320px; word-break: break-word; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { background: #52c41a; }
.toast-error { background: #ff4d4f; }
.toast-info { background: #1890ff; }

/* ─── Modal ───────────────────────────────────────────────── */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.4); z-index: 1000; align-items: center; justify-content: center; }
.modal-overlay.open { display: flex; }
.modal-card { background: #fff; border-radius: 10px; padding: 28px; width: 100%; max-width: 420px; box-shadow: 0 8px 32px rgba(0,0,0,0.2); margin: 16px; }
.modal-title { font-size: 18px; font-weight: 700; color: #262626; margin-bottom: 4px; }
.modal-subtitle { font-size: 13px; color: #595959; margin-bottom: 20px; }
.modal-form { display: flex; flex-direction: column; gap: 14px; margin-bottom: 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ─── Pagination ──────────────────────────────────────────── */
.pagination { padding: 24px; display: flex; justify-content: center; align-items: center; gap: 8px; border-top: 1px solid #f0f0f0; }
.pagination-numbers { display: flex; gap: 4px; align-items: center; }
.pagination-btn { padding: 8px 12px; border: 1px solid #d9d9d9; background: white; border-radius: 6px; cursor: pointer; transition: all 0.2s; font-size: 14px; color: #595959; min-width: 40px; }
.pagination-btn:hover:not(:disabled) { border-color: #1890ff; color: #1890ff; }
.pagination-btn:disabled { cursor: not-allowed; opacity: 0.4; }
.pagination-btn.active { background: #1890ff; color: white; border-color: #1890ff; }
.pagination-ellipsis { padding: 8px 4px; color: #595959; font-size: 14px; }

/* ─── Messages ────────────────────────────────────────────── */
.msg-error { color: #ff4d4f; margin-bottom: 12px; font-size: 13px; }
.msg-success { color: #52c41a; margin-bottom: 12px; font-size: 13px; }
.empty-state { padding: 60px 24px; text-align: center; color: #595959; }
.loading { padding: 40px; text-align: center; color: #595959; }

/* ─── Data Row (legacy compat) ────────────────────────────── */
.data-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #f0f0f0; }
.data-label { color: var(--color-text-secondary); font-size: 14px; }
.data-value { color: var(--color-text-primary); font-weight: 500; font-size: 14px; }

/* ─── Responsive: 1200px ──────────────────────────────────── */
@media (max-width: 1200px) {
    .main-panel { padding: 0 24px; margin: 28px auto; }
}

/* ─── Responsive: 1024px ──────────────────────────────────── */
@media (max-width: 1024px) {
    .main-panel { padding: 0 20px; margin: 24px auto; }
    .top-bar { padding: 0 20px; }
    .top-bar h1 { font-size: 18px; }
    .top-bar-nav { gap: 6px; }
    .nav-link { padding: 8px 12px; font-size: 13px; }
}

/* ─── Responsive: 768px ───────────────────────────────────── */
@media (max-width: 768px) {
    .top-bar { padding: 0 20px; position: relative; }
    .burger-btn { display: flex; }
    .top-bar-nav {
        position: fixed; top: 64px; right: -100%; width: 280px;
        height: calc(100vh - 64px); background: #fff;
        flex-direction: column; align-items: stretch; gap: 0;
        padding: 20px; box-shadow: -2px 0 8px rgba(0,0,0,0.1);
        transition: right 0.3s; overflow-y: auto; z-index: 200;
    }
    .top-bar-nav.show { right: 0; }
    .nav-link { width: 100%; text-align: left; padding: 14px 16px; font-size: 15px; border-radius: 8px; margin-bottom: 8px; }
    .btn-logout { width: 100%; margin-left: 0; margin-top: 12px; justify-content: center; padding: 14px 16px; }

    .main-panel { padding: 0 16px; margin: 20px auto; gap: 16px; }

    .toast-container { bottom: 12px; right: 12px; left: 12px; }
    .toast { max-width: 100%; }

    .modal-card { padding: 20px; max-width: 100%; margin: 12px; }
    .modal-actions { flex-direction: column; }
    .modal-actions .btn { width: 100%; justify-content: center; }

    .pagination { padding: 14px; gap: 6px; }
    .pagination-numbers { flex-wrap: wrap; gap: 4px; }
    .pagination-btn { min-width: 34px; padding: 7px 10px; font-size: 13px; }
}

/* ─── Responsive: 480px ───────────────────────────────────── */
@media (max-width: 480px) {
    .top-bar { height: 50px; padding: 0 12px; }
    .top-bar h1 { font-size: 15px; }
    .top-bar-nav { top: 50px; height: calc(100vh - 50px); width: 240px; }
    .main-panel { padding: 0 8px; margin: 10px auto; }
    .section-card { padding: 16px; }
    .panel-card { padding: 16px; }
}
