@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ── CSS Isolation wrapper — prevents Elementor/theme conflicts ── */
.utl-portal * { box-sizing: border-box; font-family: 'Inter', system-ui, sans-serif; }
.utl-portal a { text-decoration: none; }

/* ── Portal layout ─────────────────────────────────────────────── */
.utl-portal {
    display: flex;
    gap: 0;
    min-height: 500px;
    border-radius: 18px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 20px 60px rgba(0,0,0,.09);
    background: var(--utl-dash-bg, #f8fafc);
    font-family: 'Inter', system-ui, sans-serif;
}

/* ── Sidebar ───────────────────────────────────────────────────── */
.utl-sidebar {
    width: 240px;
    flex-shrink: 0;
    background: linear-gradient(170deg, color-mix(in srgb, var(--utl-primary,#4f46e5) 60%, #000) 0%, var(--utl-primary,#4f46e5) 60%, color-mix(in srgb, var(--utl-primary,#4f46e5) 80%, #fff) 100%);
    display: flex;
    flex-direction: column;
    padding: 0;
    position: relative;
}
.utl-sidebar::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 120px;
    background: rgba(0,0,0,.15);
    pointer-events: none;
}
.utl-sidebar-brand {
    padding: 24px 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,.1);
}
.utl-sidebar-brand-name {
    font-size: 15px;
    font-weight: 800;
    color: #fff;
    margin: 0 0 2px;
    letter-spacing: -.3px;
}
.utl-sidebar-brand-sub {
    font-size: 11px;
    color: rgba(255,255,255,.55);
    font-weight: 500;
}
.utl-sidebar-aff {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.utl-sidebar-aff-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, color-mix(in srgb, var(--utl-primary,#4f46e5) 60%, #fff), color-mix(in srgb, var(--utl-primary,#4f46e5) 60%, #c084fc));
    display: flex; align-items: center; justify-content: center;
    font-size: 17px; font-weight: 800; color: #fff;
    margin-bottom: 10px;
}
.utl-sidebar-aff-name  { font-size: 13px; font-weight: 700; color: #fff; }
.utl-sidebar-aff-slug  { font-size: 11px; color: rgba(255,255,255,.55); font-family: monospace; }
.utl-sidebar-aff-tier  { margin-top: 8px; display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: rgba(255,255,255,.12); color: #e0e7ff; }

/* ── Sidebar nav ───────────────────────────────────────────────── */
.utl-sidebar-nav { flex: 1; padding: 10px 10px; overflow-y: auto; }
.utl-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 600;
    color: rgba(255,255,255,.7);
    cursor: pointer;
    transition: background .15s, color .15s;
    margin-bottom: 3px;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    user-select: none;
}
.utl-nav-item:hover  { background: rgba(255,255,255,.1); color: #fff; }
.utl-nav-item.active { background: rgba(255,255,255,.18); color: #fff; font-weight: 700; }
.utl-nav-item .utl-nav-icon { font-size: 16px; flex-shrink: 0; }
.utl-nav-badge { margin-left: auto; background: #ef4444; color: #fff; font-size: 10px; font-weight: 800; padding: 1px 7px; border-radius: 999px; }

/* ── Sidebar stats strip ───────────────────────────────────────── */
.utl-sidebar-stats { padding: 14px 16px 18px; position: relative; z-index: 1; }
.utl-sidebar-stat  { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.utl-sidebar-stat-label { font-size: 11px; color: rgba(255,255,255,.5); font-weight: 600; }
.utl-sidebar-stat-val   { font-size: 13px; font-weight: 800; color: #fff; }

/* ── Content area ──────────────────────────────────────────────── */
.utl-content {
    flex: 1;
    min-width: 0;
    background: #f8fafc;
    overflow: hidden;
}
.utl-content-inner { padding: 28px 28px 36px; }

/* ── Content header bar ────────────────────────────────────────── */
.utl-content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 18px;
    border-bottom: 1px solid #e2e8f0;
}
.utl-content-title { font-size: 20px; font-weight: 800; color: #0f172a; margin: 0; }
.utl-content-sub   { font-size: 13px; color: #64748b; margin: 3px 0 0; }
.utl-status-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 14px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.utl-status-pill.approved { background: #dcfce7; color: #166534; }
.utl-status-pill.pending  { background: #fef3c7; color: #92400e; }

/* ── Tab panels ────────────────────────────────────────────────── */
.utl-tab-panel { display: none; }
.utl-tab-panel.active { display: block; }

/* ── KPI grid ──────────────────────────────────────────────────── */
.utl-kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 14px; margin-bottom: 24px; }
.utl-kpi-card {
    background: #fff; border-radius: 14px; padding: 18px 16px;
    border: 1px solid #e2e8f0; position: relative; overflow: hidden;
    transition: transform .2s, box-shadow .2s;
    animation: utlFadeUp .4s ease both;
}
.utl-kpi-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,.08); }
.utl-kpi-card::before { content:''; position:absolute; top:0;left:0;right:0;height:3px; background:linear-gradient(90deg, var(--utl-primary,#4f46e5), color-mix(in srgb, var(--utl-primary,#4f46e5) 60%, #c084fc)); border-radius:14px 14px 0 0; }
.utl-kpi-card.green::before { background:linear-gradient(90deg,#10b981,#34d399); }
.utl-kpi-card.amber::before { background:linear-gradient(90deg,#f59e0b,#fbbf24); }
.utl-kpi-card.sky::before   { background:linear-gradient(90deg,#0ea5e9,#38bdf8); }
.utl-kpi-icon  { font-size: 22px; margin-bottom: 10px; }
.utl-kpi-label { font-size: 11px; font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }
.utl-kpi-value { font-size: 24px; font-weight: 800; color: #0f172a; line-height: 1; }
.utl-kpi-trend { font-size: 11px; font-weight: 600; margin-top: 6px; }
.utl-kpi-trend.up  { color: #059669; }
.utl-kpi-trend.neu { color: #94a3b8; }

/* ── Cards ─────────────────────────────────────────────────────── */
.utl-card { background: #fff; border-radius: 14px; padding: 22px; border: 1px solid #e2e8f0; margin-bottom: 20px; }
.utl-card-title { font-size: 15px; font-weight: 700; color: #0f172a; margin: 0 0 4px; }
.utl-card-sub   { font-size: 12px; color: #64748b; margin: 0 0 18px; }

/* ── Link box ──────────────────────────────────────────────────── */
.utl-link-row   { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.utl-link-input { flex: 1; min-width: 200px; background: #f1f5f9; border: 2px solid transparent; padding: 11px 14px; border-radius: 8px; font-family: monospace; font-size: 13px; color: #334155; transition: .2s; }
.utl-link-input:focus { outline: none; border-color: #cbd5e1; }
.utl-btn { display: inline-block; background: var(--utl-btn-bg, #6366f1); color: var(--utl-btn-text, #fff); border: none; padding: 12px 22px; border-radius: 8px; font-weight: 700; cursor: pointer; transition: transform .2s, filter .2s; font-size: 14px; white-space: nowrap; }
.utl-btn:hover { transform: translateY(-2px); filter: brightness(1.08); }
.utl-btn-sm { background: #0f172a; color: #fff; border: none; padding: 10px 18px; border-radius: 8px; font-weight: 700; cursor: pointer; font-size: 13px; transition: .2s; white-space: nowrap; }
.utl-btn-sm:hover { background: #334155; }
.utl-btn-green  { background: #10b981; }
.utl-btn-wa     { background: #25D366; }
.utl-btn-fb     { background: #1877F2; }
.utl-btn-tw     { background: #000; }

/* ── Form inputs ───────────────────────────────────────────────── */
.utl-input { width: 100%; padding: 11px 14px; border: 2px solid #e2e8f0; border-radius: 8px; font-size: 14px; transition: border-color .2s; background: #fff; }
.utl-input:focus { outline: none; border-color: var(--utl-primary, #4f46e5); }
.utl-label { display: block; font-weight: 600; font-size: 13px; color: #374151; margin-bottom: 6px; }
.utl-form-row { margin-bottom: 16px; }
.utl-form-group { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: 16px; }

/* ── Notices ────────────────────────────────────────────────────── */
.utl-notice { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-size: 14px; font-weight: 500; }
.utl-notice.success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.utl-notice.error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.utl-notice.warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }

/* ── Chart card ─────────────────────────────────────────────────── */
.utl-chart-card { background: #fff; border-radius: 14px; padding: 22px; border: 1px solid #e2e8f0; margin-bottom: 20px; }
.utl-chart-title { font-size: 14px; font-weight: 700; color: #0f172a; margin: 0 0 16px; }

/* ── Campaign product cards ─────────────────────────────────────── */
.utl-campaigns-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px,1fr)); gap: 16px; margin-bottom: 20px; }
.utl-campaign-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; padding: 16px; }

/* ── Product catalog ─────────────────────────────────────────────── */
.utl-catalog-controls { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.utl-search-wrap { position: relative; flex: 1; min-width: 200px; }
.utl-search-wrap svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #94a3b8; }
#utlCatalogSearch { width: 100%; padding: 11px 12px 11px 38px; border: 2px solid #e2e8f0; border-radius: 10px; font-size: 14px; transition: border-color .2s; }
#utlCatalogSearch:focus { outline: none; border-color: var(--utl-primary,#4f46e5); }
#utlCatFilter { padding: 11px 14px; border: 2px solid #e2e8f0; border-radius: 10px; font-size: 14px; min-width: 160px; cursor: pointer; }
#utlCatFilter:focus { outline: none; }
.utl-product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 14px; }
.utl-prod-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; overflow: hidden; transition: transform .2s, box-shadow .2s; }
.utl-prod-card:hover { transform: translateY(-3px); box-shadow: 0 10px 28px rgba(0,0,0,.09); border-color: var(--utl-primary,#4f46e5); }
.utl-prod-img-wrap { position: relative; height: 140px; background: #f8fafc; overflow: hidden; }
.utl-prod-img-wrap img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.utl-prod-card:hover .utl-prod-img-wrap img { transform: scale(1.05); }
.utl-prod-img-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 44px; color: #cbd5e1; }
.utl-prod-cat-badge { position: absolute; top: 8px; left: 8px; background: var(--utl-primary,#4f46e5); color: #fff; font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.utl-prod-qr-overlay { position: absolute; top: 8px; right: 8px; background: rgba(255,255,255,.95); border-radius: 6px; padding: 3px; opacity: 0; transition: opacity .2s; }
.utl-prod-card:hover .utl-prod-qr-overlay { opacity: 1; }
.utl-prod-body { padding: 12px; }
.utl-prod-name { font-size: 13px; font-weight: 700; color: #0f172a; margin: 0 0 4px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.utl-prod-price { font-size: 14px; font-weight: 800; color: var(--utl-primary,#4f46e5); margin: 0 0 10px; }
.utl-prod-link-row { display: flex; gap: 5px; }
.utl-prod-link-input { flex: 1; font-size: 10px; font-family: monospace; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 6px; padding: 6px 8px; color: #475569; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; min-width: 0; }
.utl-copy-btn { background: var(--utl-primary,#4f46e5); color: #fff; border: none; border-radius: 6px; padding: 6px 10px; font-size: 11px; font-weight: 700; cursor: pointer; transition: .2s; flex-shrink: 0; }
.utl-copy-btn.copied { background: #10b981; }
.utl-prod-share-row { display: flex; gap: 4px; margin-top: 7px; }
.utl-share-btn { flex: 1; text-align: center; padding: 5px 4px; border-radius: 5px; font-size: 10px; font-weight: 700; text-decoration: none; color: #fff; }
.utl-catalog-empty { grid-column: 1/-1; text-align: center; padding: 40px 20px; color: #64748b; }
.utl-skeleton-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(200px,1fr)); gap: 14px; }
.utl-skeleton-card { background: #f1f5f9; border-radius: 12px; height: 260px; animation: utlPulse 1.4s ease-in-out infinite; }
.utl-pagination { display: flex; gap: 6px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.utl-page-btn { padding: 7px 14px; border: 1px solid #e2e8f0; border-radius: 7px; font-size: 12px; font-weight: 600; background: #fff; cursor: pointer; color: #334155; transition: .15s; }
.utl-page-btn:hover { border-color: var(--utl-primary,#4f46e5); color: var(--utl-primary,#4f46e5); }
.utl-page-btn.active { background: var(--utl-primary,#4f46e5); border-color: var(--utl-primary,#4f46e5); color: #fff; }
.utl-catalog-count { font-size: 12px; color: #64748b; font-weight: 600; margin-left: auto; }

/* ── Mobile: hamburger toggle ────────────────────────────────────── */
.utl-mobile-bar { display: none; background: var(--utl-primary, #4f46e5); padding: 14px 18px; align-items: center; justify-content: space-between; }
.utl-mobile-bar-title { font-size: 15px; font-weight: 800; color: #fff; }
.utl-hamburger { background: rgba(255,255,255,.15); border: none; border-radius: 8px; padding: 8px 10px; cursor: pointer; color: #fff; font-size: 18px; line-height: 1; }
.utl-sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 999; }
.utl-sidebar-overlay.open { display: block; }
.utl-sidebar.mobile-open { transform: translateX(0) !important; z-index: 1000; }

/* ── Animations ─────────────────────────────────────────────────── */
@keyframes utlFadeUp { from{opacity:0;transform:translateY(14px)} to{opacity:1;transform:translateY(0)} }
@keyframes utlPulse  { 0%,100%{opacity:1} 50%{opacity:.5} }

/* ── Creative / marketing assets ───────────────────────────────── */
.utl-creatives-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(240px,1fr)); gap: 16px; }
.utl-creative-card  { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 14px; }

/* ── Elementor isolation: reset common overrides ─────────────────── */
.utl-portal h1,.utl-portal h2,.utl-portal h3,.utl-portal h4,.utl-portal h5 { font-family:'Inter',system-ui,sans-serif; line-height:1.2; }
.utl-portal input,.utl-portal select,.utl-portal textarea,.utl-portal button { font-family:'Inter',system-ui,sans-serif; }
.utl-portal input[type=text],.utl-portal input[type=email],.utl-portal input[type=password],.utl-portal input[type=number],.utl-portal input[type=url] { -webkit-appearance:none; appearance:none; }

/* Force our bundled Font Awesome 6 to win over any theme overrides */
.utl-portal i.fa-solid, .utl-portal i.fas, .utl-portal i.fa-solid:before, .utl-portal i.fas:before,
.utl-sidebar i.fa-solid, .utl-sidebar i.fas, .utl-sidebar i.fa-solid:before, .utl-sidebar i.fas:before { font-family: "Font Awesome 6 Free" !important; font-weight: 900 !important; }

.utl-portal i.fa-regular, .utl-portal i.far, .utl-portal i.fa-regular:before, .utl-portal i.far:before,
.utl-sidebar i.fa-regular, .utl-sidebar i.far, .utl-sidebar i.fa-regular:before, .utl-sidebar i.far:before { font-family: "Font Awesome 6 Free" !important; font-weight: 400 !important; }

.utl-portal i.fa-brands, .utl-portal i.fab, .utl-portal i.fa-brands:before, .utl-portal i.fab:before,
.utl-sidebar i.fa-brands, .utl-sidebar i.fab, .utl-sidebar i.fa-brands:before, .utl-sidebar i.fab:before { font-family: "Font Awesome 5 Brands" !important; font-weight: 400 !important; }

/* ══════════════════════════════════════════════════
   RESPONSIVE — AFFILIATE PORTAL
   ══════════════════════════════════════════════════ */

/* ── Tablet & Mobile (≤ 900px) ────────────────────────────── */
@media (max-width: 900px) {

    /* Remove fixed portal height — let content determine height */
    .utl-portal {
        display: block !important;
        min-height: 0 !important;
        height: auto !important;
        border-radius: 0;
        border-left: none;
        border-right: none;
        box-shadow: none;
    }

    /* Sidebar: slide-in drawer from left */
    .utl-sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        width: 280px !important;
        transform: translateX(-100%);
        transition: transform .28s cubic-bezier(.4,0,.2,1);
        z-index: 1100 !important;
        border-radius: 0 16px 16px 0;
        box-shadow: 4px 0 24px rgba(0,0,0,.18);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .utl-sidebar.mobile-open {
        transform: translateX(0) !important;
    }

    /* Mobile top bar: sticky, always visible */
    .utl-mobile-bar {
        display: flex;
        position: sticky;
        top: 0;
        z-index: 1050;
        box-shadow: 0 2px 8px rgba(0,0,0,.15);
    }

    /* Overlay backdrop */
    .utl-sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.55);
        z-index: 1000;
        backdrop-filter: blur(2px);
        -webkit-backdrop-filter: blur(2px);
    }
    .utl-sidebar-overlay.open { display: block; }

    /* Content: full width, no left margin */
    .utl-content {
        width: 100%;
        min-width: 0;
        /* No padding-top needed as mobile-bar is sticky ABOVE portal */
    }
    .utl-content-inner { padding: 16px 14px 32px; }

    /* Content header: stack on small screens */
    .utl-content-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        margin-bottom: 16px;
        padding-bottom: 14px;
    }
    .utl-content-title { font-size: 18px; }

    /* KPI grid: 2 columns */
    .utl-kpi-row { grid-template-columns: repeat(2,1fr); gap: 10px; margin-bottom: 16px; }
    .utl-kpi-value { font-size: 22px; }
    .utl-kpi-card  { padding: 14px 12px; }

    /* Product grid: 2 columns minimum */
    .utl-product-grid { grid-template-columns: repeat(auto-fill,minmax(150px,1fr)); gap: 10px; }
    .utl-prod-img-wrap { height: 110px; }

    /* Creatives: single column */
    .utl-creatives-grid { grid-template-columns: 1fr; }

    /* Campaign cards */
    .utl-campaigns-grid { grid-template-columns: 1fr; }

    /* Link row: stack */
    .utl-link-row { flex-direction: column; }
    .utl-link-input { min-width: 0; width: 100%; }

    /* Form groups: single column */
    .utl-form-group { grid-template-columns: 1fr; }

    /* Chart card: tighter */
    .utl-chart-card { padding: 16px; }

    /* Catalog controls: stack */
    .utl-catalog-controls { flex-direction: column; }
    .utl-search-wrap { min-width: 0; }
    #utlCatalogSearch { width: 100%; }
    #utlCatFilter { width: 100%; }

    /* Pagination: smaller buttons */
    .utl-page-btn { padding: 6px 10px; font-size: 11px; }
}

/* ── Small mobile (≤ 420px) ──────────────────────── */
@media (max-width: 420px) {
    .utl-kpi-row    { grid-template-columns: 1fr 1fr; gap: 8px; }
    .utl-kpi-value  { font-size: 20px; }
    .utl-kpi-card   { padding: 12px 10px; }
    .utl-kpi-icon   { font-size: 18px; margin-bottom: 6px; }
    .utl-content-inner { padding: 12px 10px 28px; }

    .utl-product-grid { grid-template-columns: 1fr 1fr; }
    .utl-prod-name  { font-size: 12px; }
    .utl-prod-price { font-size: 13px; }

    .utl-btn  { padding: 11px 16px; font-size: 13px; }
    .utl-btn-sm { padding: 9px 14px; font-size: 12px; }
}
