/* =========================================================
   EWI Partner Manager — Frontend Styles v2.0
   Covers: Apply Form · Partner Dashboard · Info Panel
   Uses CSS custom properties so it adapts to any theme's
   --accent / --bg / --bg-alt / --border / --text variables.
   Dark-first; light-mode overrides via .light-mode body class.
========================================================= */

/* ── Base resets scoped to plugin elements ─────────────────── */
.ewi-apply-wrap *,
.ewi-partner-dash * {
    box-sizing: border-box;
}

/* ═══════════════════════════════════════════════════════════
   1. APPLY PAGE LAYOUT
═══════════════════════════════════════════════════════════ */

.ewi-apply-wrap {
    display: grid;
    grid-template-columns: 1fr 0.9fr;
    gap: 40px;
    align-items: start;
    max-width: 100%;
    margin: 0;
    padding-top: 32px;
}

.ewi-apply-main  { min-width: 0; }
.ewi-apply-info  { padding-top: 40px; }

/* ── Apply header ────────────────────────────────────────── */

.ewi-apply-header {
    margin-bottom: 28px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border, rgba(255,255,255,.08));
}

.ewi-apply-header__title {
    margin: 0 0 8px;
    font-size: clamp(1.8rem, 1.2rem + 1.5vw, 2.4rem);
    color: var(--text, #fff);
    font-weight: 700;
    line-height: 1.15;
}

.ewi-apply-header__sub {
    margin: 0;
    font-size: 15px;
    color: var(--text-muted, #8fa8c8);
    line-height: 1.6;
}

/* ── Apply form ──────────────────────────────────────────── */

.ewi-apply-form {
    max-width: 680px;
}

.ewi-apply-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.ewi-apply-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ewi-apply-field--full {
    grid-column: 1 / -1;
    margin-bottom: 4px;
}

.ewi-apply-field label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted, #a8a8a8);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.ewi-apply-field .req {
    color: #ff5a5a;
    margin-left: 2px;
}

.ewi-apply-field input,
.ewi-apply-field textarea,
.ewi-apply-field select {
    padding: 12px 16px;
    background: var(--bg-alt, #1a1a1a);
    border: 1px solid var(--border, rgba(255,255,255,.1));
    border-radius: 8px;
    color: var(--text, #e6e6e6);
    font-size: 14px;
    font-family: inherit;
    transition: border-color .15s;
    width: 100%;
}

.ewi-apply-field input:focus,
.ewi-apply-field textarea:focus {
    outline: none;
    border-color: var(--accent, #4da3ff);
    box-shadow: 0 0 0 3px rgba(77,163,255,.12);
}

.ewi-apply-field input::placeholder,
.ewi-apply-field textarea::placeholder {
    color: var(--text-muted, #555);
}

.ewi-apply-field small {
    font-size: 12px;
    color: var(--text-muted, #888);
}

/* Subdomain inline domain label */
.ewi-apply-subdomain {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ewi-apply-subdomain input { flex: 1; }

.ewi-apply-subdomain span {
    font-size: 13px;
    color: var(--text-muted, #888);
    white-space: nowrap;
    flex-shrink: 0;
}

/* Submit button */
.ewi-apply-submit {
    display: inline-flex;
    align-items: center;
    padding: 13px 32px;
    background: var(--accent, #4da3ff);
    color: #040c1a;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    transition: filter .15s, transform .1s;
    margin-top: 8px;
}

.ewi-apply-submit:hover  { filter: brightness(1.08); }
.ewi-apply-submit:active { transform: scale(.98); }

/* Error / success states */
.ewi-apply-error {
    background: rgba(255,90,90,.1);
    border: 1px solid rgba(255,90,90,.3);
    border-radius: 8px;
    padding: 12px 16px;
    color: #ff5a5a;
    margin-bottom: 16px;
    font-size: 14px;
}

.ewi-apply-success {
    text-align: center;
    padding: 60px 20px;
}

.ewi-apply-success__icon {
    font-size: 52px;
    margin-bottom: 16px;
}

.ewi-apply-success h2 {
    color: var(--text, #fff);
    margin: 0 0 12px;
}

.ewi-apply-success p {
    color: var(--text-muted, #8fa8c8);
    font-size: 15px;
    line-height: 1.6;
}

/* ── Apply info panel ────────────────────────────────────── */

.ewi-apply-info__inner {
    background: linear-gradient(135deg, #080e1a, #0d1526);
    border: 1px solid rgba(77,163,255,.2);
    border-radius: 16px;
    padding: 32px;
    position: sticky;
    top: 90px;
}

.ewi-apply-info__title {
    margin: 0 0 20px;
    font-size: 1.2rem;
    color: #fff;
    font-weight: 700;
}

.ewi-apply-info__list {
    list-style: none;
    margin: 0 0 28px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.ewi-apply-info__list li {
    font-size: 14px;
    color: #8fa8c8;
    line-height: 1.6;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,.05);
}

.ewi-apply-info__list li:first-child { padding-top: 0; }
.ewi-apply-info__list li:last-child  { border-bottom: none; padding-bottom: 0; }
.ewi-apply-info__list li strong      { color: #e8eefc; }

.ewi-apply-info__stats {
    display: grid;
    grid-template-columns: repeat(3,1fr);
    gap: 10px;
    margin-bottom: 24px;
    padding: 16px;
    background: rgba(77,163,255,.06);
    border: 1px solid rgba(77,163,255,.15);
    border-radius: 10px;
}

.ewi-apply-info__stat {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.ewi-apply-info__stat strong {
    font-size: 1.1rem;
    font-weight: 700;
    color: #4da3ff;
    line-height: 1;
}

.ewi-apply-info__stat span {
    font-size: 11px;
    color: #8fa8c8;
}

.ewi-apply-info__cta p {
    font-size: 13px;
    color: #8fa8c8;
    margin: 0 0 10px;
}

.ewi-apply-info__btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: #25d366;
    color: #fff;
    border-radius: 8px;
    font-weight: 700;
    font-size: 13px;
    text-decoration: none;
    transition: filter .15s;
}

.ewi-apply-info__btn:hover {
    filter: brightness(1.08);
    text-decoration: none;
    color: #fff;
}

/* ═══════════════════════════════════════════════════════════
   2. PARTNER DASHBOARD
═══════════════════════════════════════════════════════════ */

.ewi-partner-dash {
    max-width: 900px;
    margin: 0 auto;
}

/* ── Dashboard header card ───────────────────────────────── */

.ewi-pd-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    padding: 20px 24px;
    background: var(--bg-alt, #111);
    border: 1px solid var(--border, rgba(255,255,255,.08));
    border-radius: 12px;
}

.ewi-pd-logo {
    height: 50px;
    width: auto;
    border-radius: 8px;
    flex-shrink: 0;
}

.ewi-pd-title {
    margin: 0 0 4px;
    font-size: 1.4rem;
    color: var(--text, #fff);
    line-height: 1.2;
}

/* Status badge */
.ewi-pd-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}

.ewi-pd-status--active   { background: rgba(76,175,114,.15);  color: #4caf72; }
.ewi-pd-status--pending  { background: rgba(255,211,122,.15); color: #ffd37a; }
.ewi-pd-status--inactive { background: rgba(255,255,255,.06); color: #888; }

/* Pending approval notice */
.ewi-pd-notice {
    padding: 16px 20px;
    background: rgba(255,211,122,.08);
    border: 1px solid rgba(255,211,122,.2);
    border-radius: 10px;
    color: #ffd37a;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 20px;
}

/* ── Stats row ───────────────────────────────────────────── */

.ewi-pd-stats {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.ewi-pd-stat {
    background: var(--bg-alt, #111);
    border: 1px solid var(--border, rgba(255,255,255,.08));
    border-radius: 10px;
    padding: 16px 12px;
    text-align: center;
    transition: border-color .15s;
}

.ewi-pd-stat:hover {
    border-color: rgba(77,163,255,.3);
}

.ewi-pd-stat__icon  { font-size: 20px; margin-bottom: 6px; }
.ewi-pd-stat__value { font-size: 1.3rem; font-weight: 700; color: var(--accent, #4da3ff); line-height: 1; }
.ewi-pd-stat__label { font-size: 11px; color: var(--text-muted, #888); margin-top: 4px; }

/* ── Section wrapper ─────────────────────────────────────── */

.ewi-pd-section {
    background: var(--bg-alt, #111);
    border: 1px solid var(--border, rgba(255,255,255,.08));
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 16px;
}

.ewi-pd-section h3 {
    margin: 0 0 16px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-muted, #888);
    text-transform: uppercase;
    letter-spacing: .06em;
}

/* ── Monthly bar chart ───────────────────────────────────── */

.ewi-pd-bars {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    height: 80px;
}

.ewi-pd-bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    gap: 6px;
}

.ewi-pd-bar-wrap {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: flex-end;
}

.ewi-pd-bar {
    width: 100%;
    min-height: 4px;
    background: var(--accent, #4da3ff);
    border-radius: 4px 4px 0 0;
    opacity: .75;
    transition: opacity .15s;
    cursor: default;
}

.ewi-pd-bar:hover { opacity: 1; }

.ewi-pd-bar-label {
    font-size: 11px;
    color: var(--text-muted, #888);
    text-align: center;
}

/* ── Copy link cards ─────────────────────────────────────── */

.ewi-pd-links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.ewi-pd-link-card {
    background: var(--bg-alt, #111);
    border: 1px solid var(--border, rgba(255,255,255,.08));
    border-radius: 10px;
    padding: 16px;
}

.ewi-pd-link-card label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted, #888);
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: 8px;
}

.ewi-pd-copy {
    display: flex;
    gap: 6px;
}

.ewi-pd-copy input {
    flex: 1;
    min-width: 0;
    padding: 8px 10px;
    background: var(--bg, #0d0d0d);
    border: 1px solid var(--border, rgba(255,255,255,.08));
    border-radius: 6px;
    color: var(--text, #fff);
    font-size: 12px;
    font-family: 'Courier New', monospace;
}

.ewi-pd-copy button {
    padding: 8px 14px;
    background: var(--accent, #4da3ff);
    color: #040c1a;
    border: none;
    border-radius: 6px;
    font-weight: 700;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: filter .15s;
}

.ewi-pd-copy button:hover { filter: brightness(1.08); }

.ewi-pd-link-card small {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-muted, #888);
}

/* ── Payout settings form ────────────────────────────────── */

.ewi-pd-payout-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ewi-pd-payout-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.ewi-pd-payout-grid label,
.ewi-pd-payout-form label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted, #888);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 6px;
}

.ewi-pd-payout-grid input,
.ewi-pd-payout-grid select {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg, #0d0d0d);
    border: 1px solid var(--border, rgba(255,255,255,.1));
    border-radius: 8px;
    color: var(--text, #e6e6e6);
    font-size: 14px;
    font-family: inherit;
    transition: border-color .15s;
}

.ewi-pd-payout-grid input:focus,
.ewi-pd-payout-grid select:focus {
    outline: none;
    border-color: var(--accent, #4da3ff);
    box-shadow: 0 0 0 3px rgba(77,163,255,.12);
}

.ewi-pd-save-btn {
    align-self: flex-start;
    padding: 10px 24px;
    background: var(--accent, #4da3ff);
    color: #040c1a;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: filter .15s;
}

.ewi-pd-save-btn:hover { filter: brightness(1.08); }

/* ── Referral table ──────────────────────────────────────── */

.ewi-pd-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -4px;
    padding: 0 4px;
}

.ewi-pd-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.ewi-pd-table th {
    text-align: left;
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted, #888);
    text-transform: uppercase;
    letter-spacing: .05em;
    border-bottom: 1px solid var(--border, rgba(255,255,255,.08));
    white-space: nowrap;
}

.ewi-pd-table td {
    padding: 10px 12px;
    color: var(--text, #ddd);
    border-bottom: 1px solid var(--border, rgba(255,255,255,.04));
    vertical-align: middle;
}

.ewi-pd-table tbody tr:last-child td { border-bottom: none; }
.ewi-pd-table tbody tr:hover td     { background: rgba(255,255,255,.02); }

/* Status badges */
.ewi-pd-badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    text-transform: capitalize;
}

.ewi-pd-badge--pending { background: rgba(255,211,122,.12); color: #ffd37a; }
.ewi-pd-badge--paid    { background: rgba(76,175,114,.12);  color: #4caf72; }
.ewi-pd-badge--click   { background: rgba(255,255,255,.06); color: #888; }

.ewi-pd-click {
    font-size: 11px;
    color: #888;
    font-style: italic;
}

/* Empty state */
.ewi-pd-empty {
    text-align: center;
    padding: 32px;
    color: var(--text-muted, #888);
    font-size: 14px;
}

/* ── Info footer block ───────────────────────────────────── */

.ewi-pd-info {
    padding: 14px 18px;
    background: rgba(77,163,255,.06);
    border: 1px solid rgba(77,163,255,.2);
    border-radius: 10px;
    font-size: 14px;
    color: var(--text-muted, #8fa8c8);
    margin-top: 4px;
}

.ewi-pd-info p      { margin: 4px 0; }
.ewi-pd-info a      { color: var(--accent, #4da3ff); }
.ewi-pd-info strong { color: var(--text, #ddd); }

/* ═══════════════════════════════════════════════════════════
   3. POWERED-BY BADGE
═══════════════════════════════════════════════════════════ */

.ewi-powered-by {
    font-size: 11px;
    color: var(--text-muted, #888);
    text-align: center;
    padding: 12px 8px;
}

.ewi-powered-by a { color: var(--accent, #4da3ff); text-decoration: none; }
.ewi-powered-by a:hover { text-decoration: underline; }

.ewi-partner-logo { height: 40px; width: auto; }

/* ═══════════════════════════════════════════════════════════
   4. LIGHT MODE OVERRIDES
═══════════════════════════════════════════════════════════ */

body.light-mode .ewi-apply-field input,
body.light-mode .ewi-apply-field textarea,
body.light-mode .ewi-apply-field select {
    background: #fff;
    color: #1a1a1a;
    border-color: rgba(0,0,0,.15);
}

body.light-mode .ewi-apply-field input::placeholder,
body.light-mode .ewi-apply-field textarea::placeholder { color: #aaa; }

body.light-mode .ewi-apply-header__title { color: #1a1a1a; }
body.light-mode .ewi-apply-header        { border-color: rgba(0,0,0,.1); }
body.light-mode .ewi-apply-success h2    { color: #1a1a1a; }

body.light-mode .ewi-pd-header,
body.light-mode .ewi-pd-stat,
body.light-mode .ewi-pd-link-card,
body.light-mode .ewi-pd-section {
    background: #fff;
    border-color: rgba(0,0,0,.1);
}

body.light-mode .ewi-pd-title { color: #1a1a1a; }

body.light-mode .ewi-pd-copy input,
body.light-mode .ewi-pd-payout-grid input,
body.light-mode .ewi-pd-payout-grid select {
    background: #f5f5f5;
    color: #1a1a1a;
    border-color: rgba(0,0,0,.12);
}

body.light-mode .ewi-pd-table th { color: #555; border-color: rgba(0,0,0,.1); }
body.light-mode .ewi-pd-table td { color: #1a1a1a; border-color: rgba(0,0,0,.06); }
body.light-mode .ewi-pd-table tbody tr:hover td { background: rgba(0,0,0,.02); }

/* ═══════════════════════════════════════════════════════════
   5. RESPONSIVE
═══════════════════════════════════════════════════════════ */

@media (max-width: 900px) {
    .ewi-pd-stats { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
    .ewi-apply-wrap        { grid-template-columns: 1fr; }
    .ewi-apply-info        { padding-top: 0; }
    .ewi-apply-info__inner { position: static; }
}

@media (max-width: 640px) {
    .ewi-apply-grid     { grid-template-columns: 1fr; }
    .ewi-apply-subdomain { flex-wrap: wrap; }
    .ewi-pd-stats       { grid-template-columns: 1fr 1fr; }
    .ewi-pd-links       { grid-template-columns: 1fr; }
    .ewi-pd-payout-grid { grid-template-columns: 1fr; }
    .ewi-pd-bars        { height: 60px; }
    .ewi-pd-header      { flex-wrap: wrap; }
    .ewi-pd-stat__value { font-size: 1.1rem; }
}

/* ═══════════════════════════════════════════════════════════
   6. HIDE WP PAGE TITLE ON PARTNER PAGES
   Add your page IDs here
═══════════════════════════════════════════════════════════ */

.page-id-2650 .entry-title,
.page-id-2650 .page-title,
.page-id-2650 h1.entry-title,
.page-id-2652 .entry-title,
.page-id-2652 .page-title,
.page-id-2652 h1.entry-title {
    display: none !important;
}