/* Oppo redesign — Onboarding Campaigns page (Figma 168:1276) + New Campaign
 * slideout (Figma 173:5445).
 *
 * Renders the campaigns tab as a 3-up grid of "Cloud Governance Recommendations"
 * cards (Figma 171:2033) instead of the legacy table, and turns the +New
 * Campaign action into a right-side slideout with a 32-px close gutter
 * (Blue Lagoon 100 #1C3D5E) plus a 538-px form panel (#080323).
 *
 * All values are taken verbatim from Figma — no stitching, no guessing.
 */

/* ── Page header — Figma 172:3601 ───────────────────────────────────────── */
/* Header strip rendered by oppo-campaigns.js::renderHeader inside the view
 * body. Title left, "+ New Campaign" right, 1328 wide centred on the same
 * track as the cards grid, 16 px above. */
.oppo-campaigns-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    max-width: 1328px;
    margin: 0 auto 16px;
    width: 100%;
}

.oppo-campaigns-title {
    font: var(--oppo-type-h1);                /* Montserrat 600 24/32 */
    letter-spacing: 0;
    color: var(--oppo-sidebar-text);          /* Grey/Grey 20 #F3F4F6 */
    margin: 0;
}

/* Figma body pb-40 — leave 40 px of breathing room below the cards on
 * the campaigns canvas. The default `.oppo-main > main` padding is
 * `24px 32px`, so override the bottom only, scoped to campaigns. */
.oppo-shell:has(#content-area.oppo-campaigns-host) .oppo-main > main {
    padding-bottom: 40px;
}

/* Figma `_Button base` (Primary): bg #4A8CCA, border #4A8CCA, padding
 * 6 14, rounded 4, gap 8, font 600 14 (line-height auto), shadow xs. */
.oppo-campaigns-new-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    padding: 6px 14px;
    background: #4A8CCA;
    border: 1px solid #4A8CCA;
    color: #F3F4F6;                 /* --base-grey-20 */
    border-radius: 4px;
    box-shadow: 0 1px 2px 0 rgba(10, 13, 18, 0.05);
    font: 600 14px/1.2 var(--oppo-font-family);
    letter-spacing: 0;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.oppo-campaigns-new-btn:hover {
    background: #2E689E;            /* Blue Lagoon 90 — Figma hover variant */
    border-color: #2E689E;
}

.oppo-campaigns-new-btn .oppo-btn-icon {
    /* Figma "Icons" slot — 16×16 box with the plus vector centred at 20.83%
     * inset (the Figma export already bakes that proportion). */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    flex: none;
}

.oppo-campaigns-new-btn .oppo-btn-icon img {
    display: block;
    width: 11.33px;
    height: 11.33px;
}

/* ── Campaigns grid ─────────────────────────────────────────────────────── */
/* Figma 171:2576 (cards row) — 1328 wide, 3 × 432 cards + 2 × 16 gap. The
 * row sits centred within the 1680-wide body track, so we cap the grid at
 * 1328 and auto-margin it. Each card is fixed at 432 px so the doughnut
 * (227 fixed) and stats (max-width 400) stay visually aligned with the
 * header strip — without the cap, cards stretch with `1fr` and the header
 * grows wider than the stats below it, producing a noticeable misalignment. */
.oppo-campaigns-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 432px));
    gap: 16px;
    width: 100%;
    max-width: 1328px;
    margin: 0 auto;
    justify-content: center;
}

@media (max-width: 1100px) {
    .oppo-campaigns-grid { grid-template-columns: repeat(2, minmax(0, 432px)); }
}
@media (max-width: 720px) {
    .oppo-campaigns-grid { grid-template-columns: minmax(0, 432px); }
}

/* Card — Figma 171:2033: bg rgba(255,255,255,0.05), border #1C3D5E,
 * rounded 6, padding 16, gap 16, items centred. */
.oppo-camp-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #1C3D5E;
    border-radius: 6px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    color: #F3F4F6;
    text-align: left;
}

/* Header row — title fills, badge shrinks. */
.oppo-camp-card-header {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 16px;
    justify-content: flex-end;
}

.oppo-camp-card-title {
    flex: 1 0 0;
    min-width: 0;
    font: var(--oppo-type-h3);     /* 600 14/24 */
    letter-spacing: 0;
    color: #F3F4F6;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Outline badge — Figma 172:3572: padding 2 4, rounded 4, gap 4, status
 * label coloured per state (Active = Green100 #5AB891). */
.oppo-camp-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 4px;
    border-radius: 4px;
    font: 500 12px/16px var(--oppo-font-family);
    letter-spacing: 0;
    flex: none;
}

.oppo-camp-badge-dot {
    width: 8px;
    height: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.oppo-camp-badge-dot::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.oppo-camp-badge--active   { color: #5AB891; }   /* Green100 */
.oppo-camp-badge--planned  { color: #4A8CCA; }   /* Blue Lagoon 80 */
.oppo-camp-badge--warning  { color: #FCC354; }   /* Yellow100 — pending/in progress */
.oppo-camp-badge--danger   { color: #F8485E; }   /* Red40 — failed/error */
.oppo-camp-badge--ended    { color: #757575; }   /* Grey60 */
.oppo-camp-badge--tbd      { color: #C4C4C4; }   /* Grey40 */

/* Doughnut chart slot — Figma 171:3308 / 171:3309: 227×227 with absolute-
 * positioned centre text (40px SemiBold "X/Y" + 12 Medium subtitle). */
.oppo-camp-doughnut {
    position: relative;
    width: 227px;
    height: 227px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.oppo-camp-doughnut svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);     /* start arc at 12 o'clock */
}

.oppo-camp-doughnut-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    pointer-events: none;
}

.oppo-camp-doughnut-value {
    font: 600 40px/48px var(--oppo-font-family);
    letter-spacing: 0;
    color: #F3F4F6;
}

.oppo-camp-doughnut-label {
    font: 500 12px/16px var(--oppo-font-family);
    letter-spacing: 0;
    color: #C4C4C4;
}

/* Stats stack (success threshold + timeline) — Figma 172:3569: gap 8,
 * 400-px wide; separators are 1-px lines in #1C3D5E. */
.oppo-camp-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    max-width: 400px;
}

.oppo-camp-stat-sep {
    height: 1px;
    width: 100%;
    background: #1C3D5E;
    border: 0;
    margin: 0;
}

.oppo-camp-stat-row {
    display: flex;
    gap: 8px;
    align-items: baseline;
    width: 100%;
    font: var(--oppo-type-h3);     /* 600 14/24 */
    letter-spacing: 0;
    color: #F3F4F6;
}

.oppo-camp-stat-row > .label {
    flex: 1 0 0;
    min-width: 0;
}

/* Timeline block. */
.oppo-camp-timeline {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
}

.oppo-camp-timeline-title {
    font: var(--oppo-type-h3);
    letter-spacing: 0;
    color: #F3F4F6;
}

.oppo-camp-timeline-bar {
    background: #1C3D5E;
    border-radius: 300px;
    overflow: hidden;
    height: 10px;
    width: 100%;
}

.oppo-camp-timeline-bar > .fill {
    background: #5AB891;
    height: 100%;
    border-radius: 300px;
    transition: width 0.3s ease;
}

.oppo-camp-timeline-dates {
    display: flex;
    justify-content: space-between;
    font: 500 12px/16px var(--oppo-font-family);
    letter-spacing: 0;
    color: #C4C4C4;
    white-space: nowrap;
}

/* "View All Campaign Clients" footer link. */
.oppo-camp-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: transparent;
    border: 0;
    padding: 0;
    font: var(--oppo-type-block-l);   /* 500 14/24 */
    letter-spacing: 0;
    color: #4A8CCA;
    cursor: pointer;
}

.oppo-camp-link:hover { text-decoration: underline; }

.oppo-camp-link img {
    width: 16px;
    height: 16px;
    display: block;
}

/* Per-card menu (edit / delete) — small kebab in the header slot. */
.oppo-camp-menu {
    position: relative;
    display: inline-flex;
    flex: none;
}

.oppo-camp-menu-trigger {
    background: transparent;
    border: 0;
    color: #C4C4C4;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    font-size: 18px;
    line-height: 1;
}

.oppo-camp-menu-trigger:hover { background: rgba(255,255,255,0.05); }

.oppo-camp-menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: #080323;
    border: 1px solid #1C3D5E;
    border-radius: 4px;
    min-width: 140px;
    padding: 4px;
    display: none;
    z-index: 50;
}

.oppo-camp-menu.is-open .oppo-camp-menu-dropdown { display: block; }

.oppo-camp-menu-item {
    display: block;
    width: 100%;
    text-align: left;
    background: transparent;
    border: 0;
    padding: 6px 10px;
    border-radius: 3px;
    color: #F3F4F6;
    font: 500 12px/16px var(--oppo-font-family);
    cursor: pointer;
}

.oppo-camp-menu-item:hover { background: #1E1845; }
.oppo-camp-menu-item--danger { color: #F8485E; }

/* ── Card delete button — Figma 151:1067 (trash glyph 12.44×16) ────────
 * Icon-only square button visible on the card header for ADMIN /
 * campaign-owner roles. Default: transparent, Red40 (#F8485E) glyph
 * (the SVG uses var(--fill-0, …) with that fallback). Hover: subtle
 * red wash to signal destructive intent. Click triggers the existing
 * window.deleteCampaign(id) confirm flow. */
.oppo-camp-delete-btn {
    appearance: none;
    width: 36px;
    height: 36px;
    flex: none;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #F8485E;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}
.oppo-camp-delete-btn img {
    display: block;
    width: 12.44px;
    height: 16px;
}
.oppo-camp-delete-btn:hover {
    background: rgba(248, 72, 94, 0.10);
    border-color: rgba(248, 72, 94, 0.40);
}
.oppo-camp-delete-btn:focus-visible {
    outline: 2px solid #F8485E;
    outline-offset: 1px;
}

/* Empty-state for an empty campaigns list. */
.oppo-camp-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 64px 16px;
    color: #C4C4C4;
    font: var(--oppo-type-block-l);
}

/* ── Slideout (New / Edit campaign) — Figma 173:5445 ────────────────────── */
.oppo-slideout {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: none;
    pointer-events: none;
}

.oppo-slideout.is-open { display: block; pointer-events: auto; }

.oppo-slideout-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.oppo-slideout-panel {
    /* Figma slideout: 570 total = 32 close gutter + 538 form panel.
     * Anchored to the right edge, full viewport height. */
    position: absolute;
    top: 0;
    right: 0;
    height: 100vh;
    width: 570px;
    max-width: 100vw;
    display: flex;
    align-items: stretch;
    box-shadow: -16px 0 48px rgba(0, 0, 0, 0.4);
    transform: translateX(100%);
    transition: transform 0.25s ease;
}

.oppo-slideout.is-open .oppo-slideout-panel { transform: translateX(0); }

/* 32-px close gutter (Blue Lagoon 100 #1C3D5E). */
.oppo-slideout-close {
    width: 32px;
    flex: none;
    background: #1C3D5E;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 0;
    border: 0;
    cursor: pointer;
}

.oppo-slideout-close .icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.oppo-slideout-close .icon img {
    width: 16px;
    height: 16px;
    display: block;
}

/* 538-px form panel (#080323), padding-top 24, padding-x 24, gap 24. */
.oppo-slideout-form {
    flex: 1 0 0;
    min-width: 0;
    background: #080323;
    padding: 24px 24px 0;
    display: flex;
    flex-direction: column;
    gap: 24px;
    overflow-y: auto;
}

.oppo-slideout-title {
    font: 600 18px/1 var(--oppo-font-family);
    letter-spacing: 0;
    color: #F3F4F6;
    margin: 0;
}

.oppo-slideout-content {
    flex: 1 0 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.oppo-slideout-fieldgroup {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.oppo-slideout-row {
    display: flex;
    gap: 8px;
    width: 100%;
}

.oppo-slideout-row > .oppo-field { flex: 1 0 0; min-width: 0; }

/* Field label + input — Figma 6449:2365 / 6449:2367. Label is BODY (M)
 * Highlighted (600 12/16); input is bg #080323, border #3C3C3A, rounded 4,
 * padding 6 12, value text 14 Medium #F3F4F6. */
.oppo-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.oppo-field-label {
    font: 600 12px/16px var(--oppo-font-family);
    letter-spacing: 0;
    color: #F3F4F6;
}

.oppo-field-input {
    background: #080323;
    border: 1px solid #3C3C3A;
    border-radius: 4px;
    padding: 6px 12px;
    color: #F3F4F6;
    font: 500 14px/24px var(--oppo-font-family);
    letter-spacing: 0;
    box-shadow: 0 1px 2px 0 rgba(10, 13, 18, 0.05);
    outline: none;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 8px;
}

.oppo-field-input:focus,
.oppo-field-input:focus-within {
    border-color: #4A8CCA;
    box-shadow: 0 0 0 3px rgba(74, 140, 202, 0.25);
}

/* Native input/select reset to inherit the styled wrapper above. */
.oppo-field-input > input,
.oppo-field-input > select,
.oppo-field-input > textarea {
    flex: 1 0 0;
    min-width: 0;
    background: transparent;
    border: 0;
    color: inherit;
    font: inherit;
    outline: none;
    padding: 0;
    appearance: none;
    -webkit-appearance: none;
}

.oppo-field-input > select { cursor: pointer; }
.oppo-field-input > input[type="date"]::-webkit-calendar-picker-indicator {
    /* Hide the native indicator; the Figma calendar icon sits in the row. */
    opacity: 0;
    width: 0;
    margin: 0;
    padding: 0;
}

.oppo-field-input .oppo-field-trailing {
    width: 16px;
    height: 16px;
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.oppo-field-input .oppo-field-trailing img {
    width: 16px;
    height: 16px;
    display: block;
}

/* Chevron-down for selects (the Figma icon viewBox is 12×7, 20-px slot). */
.oppo-field-input .oppo-field-trailing--chevron {
    width: 20px;
    height: 20px;
}

.oppo-field-input .oppo-field-trailing--chevron img {
    width: 10px;
    height: 6px;
}

.oppo-field-divider {
    height: 1px;
    background: #1C3D5E;
    border: 0;
    margin: 0;
    width: 100%;
}

/* Footer — border-top #1C3D5E, padding 16 0; Save (primary blue), Cancel
 * (outline grey60), Delete (right-aligned, red text + trash icon). */
.oppo-slideout-footer {
    border-top: 1px solid #1C3D5E;
    padding: 16px 0;
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: auto;
    position: sticky;
    bottom: 0;
    background: #080323;
}

.oppo-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 36px;
    border-radius: 4px;
    font: 600 14px/24px var(--oppo-font-family);
    letter-spacing: 0;
    cursor: pointer;
    border: 1px solid transparent;
    box-sizing: border-box;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.oppo-btn--primary {
    background: #4A8CCA;
    border-color: #4A8CCA;
    color: #F3F4F6;                 /* --base-grey-20 */
    padding: 6px 14px;
    box-shadow: 0 1px 2px 0 rgba(10, 13, 18, 0.05);
}
.oppo-btn--primary:hover { background: #2E689E; border-color: #2E689E; }

.oppo-btn--outline {
    background: transparent;
    border-color: #3C3C3A;          /* --base-grey-100 (input border) */
    color: #C4C4C4;
    padding: 6px 12px;
}
.oppo-btn--outline:hover { color: #F3F4F6; border-color: #757575; }

.oppo-btn--danger-text {
    background: transparent;
    border: 0;
    color: #F8485E;
    padding: 6px 0;
    margin-left: auto;        /* push to the far right per Figma */
}

.oppo-btn--danger-text img {
    width: 12.44px;
    height: 16px;
    display: block;
}

.oppo-btn--danger-text:hover { color: #F3F4F6; }
