/* ============================================================================
   JAWANDA Ads Dashboard — Styles
   ============================================================================ */

.jad-wrap {
    max-width: 1280px;
    margin: 0 auto;
    padding: 16px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Sarabun", sans-serif;
    color: #1d2327;
}
.jad-wrap *, .jad-wrap *::before, .jad-wrap *::after { box-sizing: border-box; }

/* ===== Header ===== */
.jad-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 12px;
    border-bottom: 2px solid #e2e4e7;
    padding-bottom: 14px;
    margin-bottom: 18px;
}
.jad-title {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    line-height: 1.2;
}
.jad-badge {
    display: inline-block;
    background: #ff6b35;
    color: #fff;
    font-size: 12px;
    padding: 3px 9px;
    border-radius: 12px;
    margin-left: 6px;
    vertical-align: middle;
    font-weight: 600;
}
.jad-subtitle { margin: 4px 0 0; color: #555; font-size: 13px; }
.jad-fetched-at { color: #888; font-size: 12px; }

/* ===== Buttons ===== */
.jad-btn {
    display: inline-block;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s ease;
    font-size: 13px;
}
.jad-btn-primary { background: #2271b1; color: #fff; }
.jad-btn-primary:hover { background: #135e96; }
.jad-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ===== Targets Banner ===== */
.jad-targets-banner {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    background: linear-gradient(90deg, #fff7ed, #fef3c7);
    border: 1px solid #fbbf24;
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 18px;
    font-size: 13px;
}
.jad-target-item {
    color: #78350f;
    padding-right: 12px;
    border-right: 1px solid #fbbf2480;
}
.jad-target-item:last-child { border-right: none; }

/* ===== Tabs ===== */
.jad-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid #e2e4e7;
    margin-bottom: 18px;
    flex-wrap: wrap;
}
.jad-tab {
    background: none;
    border: none;
    padding: 10px 18px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all .15s;
}
.jad-tab:hover { color: #2271b1; background: #f0f6fb; border-radius: 6px 6px 0 0; }
.jad-tab.active { color: #2271b1; border-bottom-color: #2271b1; font-weight: 700; }

.jad-tab-mini {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #334155;
    padding: 5px 12px;
    border-radius: 14px;
    font-size: 12px;
    cursor: pointer;
    transition: all .15s;
}
.jad-tab-mini:hover { background: #e2e8f0; }
.jad-tab-mini.active { background: #2271b1; color: #fff; border-color: #2271b1; }

/* ===== KPI Grid ===== */
.jad-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}
.jad-kpi-card {
    background: #fff;
    border: 1px solid #e2e4e7;
    border-radius: 10px;
    padding: 16px;
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
    position: relative;
    overflow: hidden;
}
.jad-kpi-card::before {
    content: '';
    position: absolute;
    left: 0; top: 0;
    width: 4px; height: 100%;
    background: #94a3b8;
}
.jad-kpi-card.jad-good::before { background: #22c55e; }
.jad-kpi-card.jad-warn::before { background: #f59e0b; }
.jad-kpi-card.jad-bad::before  { background: #ef4444; }

.jad-kpi-label {
    font-size: 12px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: .04em;
    font-weight: 600;
    margin-bottom: 6px;
}
.jad-kpi-value {
    font-size: 28px;
    font-weight: 800;
    color: #1d2327;
    line-height: 1.1;
    margin-bottom: 6px;
}
.jad-kpi-target {
    font-size: 11px;
    color: #888;
}
.jad-kpi-status {
    position: absolute;
    top: 12px;
    right: 14px;
    font-size: 18px;
}
.jad-kpi-card.jad-good .jad-kpi-status::before { content: '✅'; }
.jad-kpi-card.jad-warn .jad-kpi-status::before { content: '⚠️'; }
.jad-kpi-card.jad-bad  .jad-kpi-status::before { content: '🚨'; }

/* ===== Charts ===== */
.jad-charts-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}
.jad-chart-card {
    background: #fff;
    border: 1px solid #e2e4e7;
    border-radius: 10px;
    padding: 16px;
}
.jad-chart-card h3 {
    margin: 0 0 12px;
    font-size: 15px;
    color: #1d2327;
}

/* ===== Decision Table ===== */
.jad-decision-card {
    background: #fff;
    border: 1px solid #e2e4e7;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 22px;
}
.jad-decision-card h3 {
    margin: 0 0 12px;
    font-size: 15px;
}
.jad-decision-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.jad-decision-table th, .jad-decision-table td {
    text-align: left;
    padding: 10px;
    border-bottom: 1px solid #f0f0f1;
}
.jad-decision-table th {
    background: #f8fafc;
    font-weight: 600;
    color: #475569;
}
.jad-action-tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}
.jad-action-tag.jad-action-kill     { background: #fee2e2; color: #991b1b; }
.jad-action-tag.jad-action-optimize { background: #fef3c7; color: #92400e; }
.jad-action-tag.jad-action-scale    { background: #dcfce7; color: #166534; }
.jad-action-tag.jad-action-maintain { background: #e0e7ff; color: #3730a3; }

/* ===== Tasks ===== */
.jad-tasks-card {
    background: #fff;
    border: 1px solid #e2e4e7;
    border-radius: 10px;
    padding: 16px;
}
.jad-tasks-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 10px;
}
.jad-tasks-header h3 { margin: 0; font-size: 16px; }
.jad-progress-summary {
    display: flex;
    gap: 14px;
    font-size: 13px;
    color: #475569;
}
.jad-progress-summary b { color: #1d2327; }

.jad-tasks-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
}

.jad-task-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.jad-task-row {
    display: grid;
    grid-template-columns: 50px 110px 1fr 130px;
    gap: 12px;
    align-items: center;
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13px;
    border-left: 4px solid #94a3b8;
}
.jad-task-row.jad-status-done    { border-left-color: #22c55e; background: #f0fdf4; opacity: .85; }
.jad-task-row.jad-status-doing   { border-left-color: #3b82f6; background: #eff6ff; }
.jad-task-row.jad-status-blocked { border-left-color: #ef4444; background: #fef2f2; }

.jad-task-id { font-weight: 700; color: #2271b1; }
.jad-task-week { font-size: 11px; color: #64748b; }
.jad-task-text { color: #1d2327; }
.jad-task-text small { display: block; color: #64748b; margin-top: 3px; font-size: 11px; }

.jad-status-select {
    padding: 5px 8px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: #fff;
    font-size: 12px;
    cursor: pointer;
}

/* ===== Tags ===== */
.jad-phase-tag {
    background: #eef2ff;
    color: #4338ca;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}
.jad-priority-tag {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
}
.jad-priority-high { background: #fee2e2; color: #991b1b; }
.jad-priority-med  { background: #fef3c7; color: #92400e; }
.jad-priority-low  { background: #e0e7ff; color: #3730a3; }

/* ===== Admin pages extras ===== */
.jad-progress-banner {
    display: flex;
    gap: 24px;
    background: linear-gradient(90deg, #f0fdf4, #dcfce7);
    border: 1px solid #86efac;
    border-radius: 10px;
    padding: 16px 20px;
    margin: 18px 0;
    flex-wrap: wrap;
}
.jad-progress-stat {
    font-size: 14px;
    color: #166534;
}
.jad-stat-num {
    font-size: 24px;
    font-weight: 800;
    margin-right: 4px;
}
.jad-progress-pct {
    font-size: 28px;
    font-weight: 800;
    color: #15803d;
}

.jad-task-table .jad-task-expected { color: #64748b; font-size: 12px; }

/* ===== Loading ===== */
.jad-loading {
    text-align: center;
    padding: 40px;
    color: #888;
    grid-column: 1 / -1;
}

/* ===== Help page ===== */
.jad-help-page h2 { margin-top: 24px; color: #2271b1; border-bottom: 2px solid #e2e4e7; padding-bottom: 6px; }
.jad-help-page pre { background: #f6f7f7; padding: 12px; border-radius: 6px; }
.jad-help-page code { background: #f0f0f1; padding: 2px 6px; border-radius: 4px; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .jad-task-row { grid-template-columns: 1fr; gap: 6px; }
    .jad-charts-row { grid-template-columns: 1fr; }
    .jad-decision-table { font-size: 11px; }
    .jad-decision-table th, .jad-decision-table td { padding: 6px; }
}
