/* ============================================================
   TMF Membership — dashboard.css
   Custom admin dashboard — completely separate from WP styles
============================================================ */

/* ---- Full page mode (dashboard served as standalone HTML) ---- */
body.tmf-db-fullpage {
    margin: 0;
    padding: 0;
    background: #f0f2f5;
    overflow-x: hidden;
}

/* ---- Reset for dashboard scope ---- */
#tmf-dashboard * { box-sizing: border-box; }
#tmf-dashboard { display: flex; min-height: 100vh; background: #f0f2f5; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; font-size: 14px; color: #222; }

/* ---- Sidebar ---- */
.tmf-db-sidebar { width: 240px; min-width: 240px; background: #1a1a2e; display: flex; flex-direction: column; position: fixed; left: 0; top: 0; bottom: 0; z-index: 100; overflow-y: auto; transition: transform .3s; }
.tmf-db-logo { padding: 24px 20px 20px; border-bottom: 1px solid rgba(255,255,255,.08); }
.tmf-db-logo-img { max-height: 48px; max-width: 160px; width: auto; }
.tmf-db-logo-text { font-size: 28px; font-weight: 900; color: #c084fc; letter-spacing: 4px; }
.tmf-db-org-name { font-size: 11px; color: rgba(255,255,255,.4); margin-top: 4px; text-transform: uppercase; letter-spacing: 1px; }

.tmf-db-nav { flex: 1; padding: 12px 0; }
.tmf-db-nav-item { display: flex; align-items: center; gap: 10px; padding: 11px 20px; color: rgba(255,255,255,.65); text-decoration: none; font-size: 14px; font-weight: 500; transition: all .2s; position: relative; cursor: pointer; }
.tmf-db-nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.tmf-db-nav-item.active { background: rgba(107,44,145,.5); color: #fff; }
.tmf-db-nav-item.active::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: #c084fc; border-radius: 0 2px 2px 0; }
.tmf-db-nav-icon { font-size: 18px; min-width: 20px; text-align: center; }
.tmf-db-badge { background: #e74c3c; color: #fff; font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 10px; min-width: 20px; text-align: center; margin-left: auto; }

.tmf-db-sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,.08); }
.tmf-db-user { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tmf-db-user-name { color: rgba(255,255,255,.7); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tmf-db-logout-btn { background: rgba(255,255,255,.1); color: rgba(255,255,255,.7); border: none; padding: 5px 10px; border-radius: 6px; cursor: pointer; font-size: 12px; white-space: nowrap; transition: background .2s; }
.tmf-db-logout-btn:hover { background: rgba(255,255,255,.2); color: #fff; }

/* ---- Mobile Header ---- */
.tmf-db-mobile-header { display: none; position: fixed; top: 0; left: 0; right: 0; z-index: 99; background: #1a1a2e; padding: 12px 16px; align-items: center; gap: 12px; box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.tmf-db-menu-toggle { background: none; border: none; color: #fff; font-size: 22px; cursor: pointer; padding: 4px; }
.tmf-db-mobile-title { color: #fff; font-size: 16px; font-weight: 600; }

/* ---- Main content ---- */
.tmf-db-main { flex: 1; margin-left: 240px; padding: 0; min-height: 100vh; }

/* ---- Sections ---- */
.tmf-db-section { display: none; padding: 28px; max-width: 1200px; }
.tmf-db-section.active { display: block; animation: tmfDbFadeIn .2s ease; }
@keyframes tmfDbFadeIn { from { opacity:0; } to { opacity:1; } }

.tmf-db-section-header { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.tmf-db-section-header h1 { font-size: 22px; font-weight: 800; color: #1a1a2e; margin: 0; flex: 1; }
.tmf-db-section-desc { font-size: 13px; color: #888; margin: 0; width: 100%; }
.tmf-db-header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---- Search + filter ---- */
.tmf-db-search { padding: 8px 12px; border: 1px solid #ddd; border-radius: 8px; font-size: 13px; min-width: 200px; background: #fff; }
.tmf-db-search:focus { outline: none; border-color: #6b2c91; }
.tmf-db-filter { padding: 8px 12px; border: 1px solid #ddd; border-radius: 8px; font-size: 13px; background: #fff; cursor: pointer; }
.tmf-db-refresh-btn { padding: 8px 12px; background: #fff; border: 1px solid #ddd; border-radius: 8px; cursor: pointer; font-size: 16px; color: #888; transition: all .2s; }
.tmf-db-refresh-btn:hover { border-color: #6b2c91; color: #6b2c91; }

/* ---- Dashboard buttons ---- */
.tmf-db-btn { padding: 9px 18px; border-radius: 8px; border: 1px solid #ddd; background: #fff; font-size: 13px; font-weight: 600; cursor: pointer; transition: all .2s; color: #444; }
.tmf-db-btn:hover { border-color: #aaa; }
.tmf-db-btn-primary { background: #6b2c91; color: #fff; border-color: #6b2c91; }
.tmf-db-btn-primary:hover { background: #5a2278; }
.tmf-db-btn-large { padding: 12px 28px; font-size: 15px; }

.tmf-db-btn-sm { padding: 5px 10px; border-radius: 6px; border: 1px solid #ddd; background: #fff; font-size: 12px; font-weight: 600; cursor: pointer; transition: all .2s; color: #444; text-decoration: none; display: inline-block; }
.tmf-db-btn-sm:hover { border-color: #aaa; }
.tmf-db-btn-success { background: #27ae60; color: #fff; border-color: #27ae60; }
.tmf-db-btn-success:hover { background: #219a52; }
.tmf-db-btn-danger { background: #e74c3c; color: #fff; border-color: #e74c3c; }
.tmf-db-btn-danger:hover { background: #c0392b; }
.tmf-db-btn-info { background: #3498db; color: #fff; border-color: #3498db; }
.tmf-db-btn-info:hover { background: #2980b9; }

/* ---- Approval cards ---- */
.tmf-db-cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.tmf-db-approval-card { background: #fff; border-radius: 12px; box-shadow: 0 1px 8px rgba(0,0,0,.07); padding: 16px; display: flex; gap: 14px; align-items: flex-start; }
.tmf-db-approval-photo { width: 72px; min-width: 72px; height: 80px; border-radius: 8px; overflow: hidden; cursor: pointer; background: #f0f0f0; }
.tmf-db-approval-photo img { width: 100%; height: 100%; object-fit: cover; }
.tmf-db-no-photo { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 11px; color: #bbb; text-align: center; padding: 4px; }
.tmf-db-approval-info { flex: 1; min-width: 0; }
.tmf-db-approval-name { font-weight: 700; font-size: 15px; color: #1a1a2e; margin-bottom: 4px; }
.tmf-db-approval-meta { font-size: 12px; color: #666; margin-bottom: 2px; }
.tmf-db-approval-date { font-size: 11px; color: #aaa; margin-top: 4px; }
.tmf-db-approval-actions { display: flex; flex-direction: column; gap: 6px; }

/* ---- Table ---- */
.tmf-db-table-wrap { background: #fff; border-radius: 12px; box-shadow: 0 1px 8px rgba(0,0,0,.07); overflow: hidden; }
.tmf-db-table { width: 100%; border-collapse: collapse; }
.tmf-db-table thead { background: #f8f4ff; }
.tmf-db-table th { padding: 12px 14px; text-align: left; font-size: 12px; font-weight: 700; color: #666; text-transform: uppercase; letter-spacing: .5px; border-bottom: 2px solid #f0e8f7; white-space: nowrap; }
.tmf-db-table td { padding: 11px 14px; border-bottom: 1px solid #f5f5f5; vertical-align: middle; }
.tmf-db-table tr:last-child td { border-bottom: none; }
.tmf-db-table tr:hover td { background: #fafafa; }
.tmf-db-row-actions { display: flex; gap: 6px; align-items: center; }
.tmf-db-thumb { width: 42px; height: 48px; border-radius: 6px; overflow: hidden; background: #f0f0f0; }
.tmf-db-thumb img { width: 100%; height: 100%; object-fit: cover; cursor: pointer; }
.tmf-db-loading { padding: 40px; text-align: center; color: #bbb; }
.tmf-db-empty { padding: 40px; text-align: center; color: #bbb; font-style: italic; }

/* ---- Status badges ---- */
.tmf-db-status { padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; display: inline-block; }
.tmf-db-status-active { background: #eafaf1; color: #1e8449; }
.tmf-db-status-inactive { background: #fef9e7; color: #b7950b; }
.tmf-db-status-pending { background: #eaf4fb; color: #1a5276; }
.tmf-db-status-rejected { background: #fdedec; color: #922b21; }
.tmf-db-tag { padding: 3px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; background: #f0e8f7; color: #6b2c91; }
.tmf-db-link { color: #6b2c91; text-decoration: none; font-weight: 600; font-size: 13px; }

/* ---- Pagination ---- */
.tmf-db-pagination { padding: 16px; display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.tmf-db-page-btn { padding: 6px 12px; border: 1px solid #ddd; border-radius: 6px; background: #fff; cursor: pointer; font-size: 13px; }
.tmf-db-page-btn.active { background: #6b2c91; color: #fff; border-color: #6b2c91; }

/* ---- Modals ---- */
.tmf-db-modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 16px; }
.tmf-db-modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.5); }
.tmf-db-modal-content { position: relative; background: #fff; border-radius: 14px; max-width: 640px; width: 100%; max-height: 90vh; overflow-y: auto; box-shadow: 0 8px 40px rgba(0,0,0,.2); }
.tmf-db-modal-wide { max-width: 800px; }
.tmf-db-modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 16px; border-bottom: 1px solid #eee; }
.tmf-db-modal-header h2 { font-size: 18px; font-weight: 700; margin: 0; color: #1a1a2e; }
.tmf-db-modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: #aaa; padding: 4px; line-height: 1; }
.tmf-db-modal-close:hover { color: #333; }
.tmf-db-modal-body { padding: 20px 24px; }
.tmf-db-modal-actions { padding: 16px 24px; border-top: 1px solid #eee; display: flex; gap: 10px; justify-content: flex-end; }

/* ---- Member detail in modal ---- */
.tmf-db-detail-grid { display: grid; grid-template-columns: 100px 1fr; gap: 20px; }
.tmf-db-detail-section-title { grid-column: 1 / -1; font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.5px; color:#6b2c91; margin:10px 0 2px; padding-bottom:4px; border-bottom:1px solid #f0e8f7; }
.tmf-db-edit-section { font-size:13px; font-weight:700; color:#6b2c91; margin:20px 0 8px 0; padding-bottom:6px; border-bottom:2px solid #f0e8f7; }
.tmf-db-detail-photo img { width: 100px; height: 110px; object-fit: cover; border-radius: 8px; border: 2px solid #eee; }
.tmf-db-detail-row { display: flex; padding: 6px 0; border-bottom: 1px solid #f5f5f5; gap: 10px; }
.tmf-db-detail-label { min-width: 140px; font-weight: 600; font-size: 13px; color: #666; }

/* ---- Settings ---- */
.tmf-db-settings-wrap { max-width: 860px; }
.tmf-db-settings-group { background: #fff; border-radius: 12px; box-shadow: 0 1px 8px rgba(0,0,0,.06); padding: 22px 24px; margin-bottom: 20px; }
.tmf-db-settings-group h3 { font-size: 15px; font-weight: 700; color: #1a1a2e; margin: 0 0 18px; padding-bottom: 12px; border-bottom: 2px solid #f0e8f7; }
.tmf-db-field { margin-bottom: 14px; }
.tmf-db-field label { display: block; font-size: 12px; font-weight: 700; color: #555; margin-bottom: 5px; text-transform: uppercase; letter-spacing: .3px; }
.tmf-db-field .tmf-hint { font-weight: 400; text-transform: none; }
.tmf-db-input, .tmf-db-select, .tmf-db-textarea { width: 100%; padding: 9px 12px; border: 1px solid #ddd; border-radius: 8px; font-size: 13px; color: #222; background: #fff; box-sizing: border-box; }
.tmf-db-input:focus, .tmf-db-select:focus, .tmf-db-textarea:focus { outline: none; border-color: #6b2c91; box-shadow: 0 0 0 3px rgba(107,44,145,.1); }
.tmf-db-textarea { min-height: 100px; resize: vertical; }
.tmf-db-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tmf-hint-text { font-size: 11px; color: #aaa; margin: 4px 0 0; }
.tmf-hint-text code { background: #f5f5f5; padding: 2px 6px; border-radius: 4px; font-family: monospace; font-size: 11px; }
.tmf-db-settings-actions { padding: 8px 0 24px; }
.tmf-db-save-msg { padding: 12px 16px; border-radius: 8px; font-size: 13px; font-weight: 600; margin-bottom: 16px; }
.tmf-db-save-success { background: #eafaf1; color: #1e8449; }
.tmf-db-save-error { background: #fdedec; color: #922b21; }

/* ---- Lightbox ---- */
.tmf-db-lightbox { position: fixed; inset: 0; z-index: 2000; background: rgba(0,0,0,.85); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.tmf-db-lightbox img { max-width: 90vw; max-height: 85vh; border-radius: 8px; box-shadow: 0 4px 40px rgba(0,0,0,.5); }

/* ---- Toast ---- */
.tmf-toast { position: fixed; bottom: 24px; right: 24px; z-index: 9999; padding: 12px 20px; border-radius: 8px; font-size: 14px; font-weight: 600; box-shadow: 0 4px 20px rgba(0,0,0,.15); max-width: 320px; transform: translateY(20px); opacity: 0; transition: all .3s ease; pointer-events: none; }
.tmf-toast.tmf-toast-show { transform: translateY(0); opacity: 1; }
.tmf-toast-success { background: #1e8449; color: #fff; }
.tmf-toast-error { background: #922b21; color: #fff; }
.tmf-toast-info { background: #1a5276; color: #fff; }
.tmf-toast-info { background: #1a5276; color: #fff; }

/* ---- Responsive Dashboard ---- */
@media (max-width: 768px) {
    .tmf-db-sidebar { transform: translateX(-100%); }
    .tmf-db-sidebar.tmf-sidebar-open { transform: translateX(0); }
    .tmf-db-main { margin-left: 0; padding-top: 52px; }
    .tmf-db-mobile-header { display: flex; }
    .tmf-db-section { padding: 16px; }
    .tmf-db-cards-grid { grid-template-columns: 1fr; }
    .tmf-db-field-row { grid-template-columns: 1fr; }
    .tmf-db-table { font-size: 13px; }
    .tmf-db-table th, .tmf-db-table td { padding: 8px 10px; }
    .tmf-db-modal-content { max-height: 95vh; }
    .tmf-db-detail-grid { grid-template-columns: 1fr; }
}

/* ---- Overview stats ---- */
.tmf-db-stat-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(180px,1fr)); gap:16px; padding:4px 0 24px; }
.tmf-db-stat-card { background:#fff; border-radius:12px; box-shadow:0 1px 8px rgba(0,0,0,.07); padding:20px; text-align:center; }
.tmf-db-stat-icon { font-size:28px; margin-bottom:8px; }
.tmf-db-stat-num  { font-size:38px; font-weight:800; line-height:1; margin-bottom:6px; }
.tmf-db-stat-label{ font-size:13px; color:#666; }
.tmf-db-stat-month{ grid-column:1/-1; text-align:right; font-size:12px; color:#aaa; padding-top:4px; }

/* ---- Visit website link ---- */
.tmf-db-visit-site { display:block; font-size:11px; color:rgba(255,255,255,.4); text-decoration:none; margin-top:6px; transition:color .2s; }
.tmf-db-visit-site:hover { color:rgba(255,255,255,.8); }

/* ---- Rich text editor ---- */
.tmf-db-rich-toolbar { display:flex; gap:4px; flex-wrap:wrap; padding:6px 8px; background:#f5f5f5; border:1px solid #ddd; border-bottom:none; border-radius:6px 6px 0 0; }
.tmf-db-rich-toolbar button { padding:4px 10px; border:1px solid #ddd; border-radius:4px; background:#fff; cursor:pointer; font-size:13px; line-height:1.4; }
.tmf-db-rich-toolbar button:hover { background:#6b2c91; color:#fff; border-color:#6b2c91; }
.tmf-db-rich-editor { min-height:120px; max-height:220px; overflow-y:auto; padding:10px 12px; border:1px solid #ddd; border-radius:0 0 6px 6px; font-size:14px; line-height:1.7; color:#222; background:#fff; outline:none; }
.tmf-db-rich-editor:focus { border-color:#6b2c91; }
.tmf-db-rich-editor ul, .tmf-db-rich-editor ol { padding-left:20px; margin:8px 0; }

/* ---- Sub-nav items ---- */
.tmf-db-nav-sub { padding-left: 36px !important; font-size: 13px; opacity: 0.85; }
.tmf-db-nav-sub .tmf-db-nav-icon { font-size: 12px; }
.tmf-db-nav-sub.active { opacity: 1; }

/* ---- Approval tabs ---- */
.tmf-db-tabs { display:flex; gap:4px; margin-bottom:20px; border-bottom:2px solid #eee; padding-bottom:0; }
.tmf-db-tab { padding:10px 20px; border:none; background:none; cursor:pointer; font-size:14px; color:#666; border-bottom:3px solid transparent; margin-bottom:-2px; border-radius:6px 6px 0 0; transition:all .2s; }
.tmf-db-tab:hover { background:#f5f0f9; color:#6b2c91; }
.tmf-db-tab.active { color:#6b2c91; border-bottom-color:#6b2c91; font-weight:600; background:#f5f0f9; }
.tmf-db-tab-badge { display:inline-block; background:#e74c3c; color:#fff; border-radius:10px; padding:1px 7px; font-size:11px; margin-left:6px; }
