/* ─── Marketur AI Tools Dashboard ────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Syne:wght@600;700;800&family=DM+Sans:wght@300;400;500&display=swap');

:root {
    --mat-bg:       #0a0e1a;
    --mat-surface:  #111827;
    --mat-surface2: #1a2235;
    --mat-border:   rgba(255,255,255,0.07);
    --mat-cyan:     #00cec9;
    --mat-text:     #e8ecf4;
    --mat-muted:    #8898aa;
    --mat-radius:   16px;
    --mat-font:     'DM Sans', sans-serif;
    --mat-display:  'Syne', sans-serif;
}

.mat-dashboard-bleed {
    /* passthrough wrapper - no longer doing the bleed trick */
    display: block;
    width: 100%;
}

.mat-dashboard {
    background: var(--mat-bg);
    width: 100vw;
    max-width: none !important;
    min-height: 100vh;
    font-family: var(--mat-font);
    color: var(--mat-text);
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    overflow-x: hidden;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}

/* ─── Header ───────────────────────── */
.mat-header {
    background: linear-gradient(135deg, #0a0e1a 0%, #0f172a 100%);
    border-bottom: 1px solid var(--mat-border);
    padding: 28px 32px;
    position: relative;
    overflow: hidden;
}
.mat-header::before {
    content: '';
    position: absolute;
    top: -60px; right: -60px;
    width: 220px; height: 220px;
    background: radial-gradient(circle, rgba(0,206,201,0.15) 0%, transparent 70%);
    pointer-events: none;
}
.mat-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.mat-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}
.mat-logo {
    font-size: 32px;
    filter: drop-shadow(0 0 10px rgba(0,206,201,0.6));
}
.mat-title {
    font-family: var(--mat-display);
    font-size: 26px;
    font-weight: 800;
    margin: 0;
    color: #fff;
    line-height: 1;
    letter-spacing: -0.5px;
}
.mat-subtitle {
    font-size: 12px;
    color: var(--mat-muted);
    margin: 3px 0 0;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.mat-plan-badge {
    font-family: var(--mat-display);
    font-size: 12px;
    font-weight: 700;
    padding: 6px 16px;
    border-radius: 20px;
    letter-spacing: 1px;
    text-transform: uppercase;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.05);
    white-space: nowrap;
}
.mat-plan-agency, .mat-plan-professional { background: linear-gradient(135deg, #6c5ce7, #00cec9); border-color: transparent; color: #fff; }
.mat-plan-starter { background: rgba(0,206,201,0.15); border-color: rgba(0,206,201,0.3); color: var(--mat-cyan); }
.mat-plan-member  { background: rgba(108,92,231,0.15); border-color: rgba(108,92,231,0.3); color: #a78bfa; }
.mat-plan-free    { background: rgba(255,255,255,0.05); border-color: var(--mat-border); color: var(--mat-muted); }
.mat-plan-guest   { background: rgba(255,255,255,0.05); border-color: var(--mat-border); color: var(--mat-muted); }

/* ─── Grid ─────────────────────────── */
.mat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    padding: 32px;
    width: 100%;
    box-sizing: border-box;
    background: var(--mat-bg);
    isolation: isolate;
}

/* ─── Cards ────────────────────────── */
.mat-card {
    position: relative;
    border-radius: var(--mat-radius);
    background: var(--mat-surface);
    border: 1px solid var(--mat-border);
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    cursor: default;
}
.mat-card:not(.mat-card--locked):hover {
    border-color: rgba(0,206,201,0.35);
    box-shadow: 0 0 20px rgba(0,206,201,0.08), 0 4px 24px rgba(0,0,0,0.3);
}
.mat-card--locked { opacity: 0.65; }
.mat-card-glow {
    position: absolute;
    top: -80px; right: -80px;
    width: 200px; height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, color-mix(in srgb, var(--tool-color) 20%, transparent) 0%, transparent 70%);
    pointer-events: none;
    transition: opacity 0.3s ease;
    opacity: 0;
}
.mat-card:hover .mat-card-glow { opacity: 1; }
.mat-card-inner { padding: 24px; }
.mat-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}
.mat-icon { font-size: 28px; line-height: 1; }
.mat-badge {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.8px;
    padding: 3px 10px;
    border-radius: 20px;
    text-transform: uppercase;
}
.mat-badge--free   { background: rgba(0,206,201,0.15); color: var(--mat-cyan); border: 1px solid rgba(0,206,201,0.25); }
.mat-badge--locked { background: rgba(255,255,255,0.06); color: var(--mat-muted); border: 1px solid var(--mat-border); }
.mat-card-title {
    font-family: var(--mat-display);
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 6px;
    color: #fff;
    line-height: 1.2;
}
.mat-card-tagline {
    font-size: 13px;
    color: var(--mat-muted);
    line-height: 1.5;
    margin: 0 0 16px;
}
.mat-usage {
    margin-bottom: 18px;
}
.mat-usage-bar {
    height: 4px;
    background: rgba(255,255,255,0.07);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 5px;
}
.mat-usage-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
}
.mat-usage-label {
    font-size: 11px;
    color: var(--mat-muted);
    letter-spacing: 0.3px;
}
.mat-usage-unlimited { color: rgba(0,206,201,0.6); }

/* ─── Buttons ──────────────────────── */
.mat-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 10px;
    font-family: var(--mat-font);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.18s ease;
    text-decoration: none;
    width: 100%;
    justify-content: center;
}
.mat-btn--run {
    background: linear-gradient(135deg, color-mix(in srgb, var(--tool-color) 70%, #000), var(--tool-color));
    color: #fff;
    box-shadow: 0 4px 14px -3px color-mix(in srgb, var(--tool-color) 40%, transparent);
}
.mat-btn--run:hover { filter: brightness(1.12); transform: translateY(-1px); }
.mat-btn--upgrade {
    background: rgba(255,255,255,0.05);
    color: var(--mat-muted);
    border: 1px solid var(--mat-border);
    text-align: center;
}
.mat-btn--upgrade:hover { background: rgba(255,255,255,0.09); color: var(--mat-text); text-decoration: none; }
.mat-btn--submit {
    background: linear-gradient(135deg, #00b09b, #00cec9);
    color: #fff;
    padding: 12px 28px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 12px;
    box-shadow: 0 4px 16px -4px rgba(0,206,201,0.4);
    min-width: 160px;
}
.mat-btn--submit:hover { filter: brightness(1.1); transform: translateY(-1px); }
.mat-btn--submit:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.mat-btn-ghost {
    background: transparent;
    color: var(--mat-muted);
    border: 1px solid var(--mat-border);
    padding: 10px 18px;
    border-radius: 10px;
    font-family: var(--mat-font);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.mat-btn-ghost:hover { background: rgba(255,255,255,0.05); color: var(--mat-text); }

/* ─── Modal ────────────────────────── */
.mat-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    align-items: center;
    justify-content: center;
}
.mat-modal.mat-modal--open { display: flex; }
.mat-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5,8,18,0.85);
    backdrop-filter: blur(4px);
}
.mat-modal-panel {
    position: relative;
    z-index: 1;
    background: var(--mat-surface);
    border: 1px solid var(--mat-border);
    border-radius: 20px;
    width: 96%;
    max-width: 1100px;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 64px rgba(0,0,0,0.7);
    animation: matSlideUp 0.28s cubic-bezier(.22,.68,0,1.2) forwards;
}
@media (max-width: 768px) {
    .mat-modal.mat-modal--open {
        align-items: stretch;
        justify-content: stretch;
    }
    .mat-modal-panel {
        width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
        max-height: 100% !important;
        border-radius: 0 !important;
        margin: 0;
        border: none !important;
        animation: none;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    .mat-modal-backdrop { display: none; }
    .mat-modal-header {
        padding: 12px 16px;
        position: sticky;
        top: 0;
        z-index: 10;
        background: var(--mat-surface);
        border-bottom: 1px solid var(--mat-border);
        flex-shrink: 0;
    }
    .mat-modal-body {
        padding: 14px 16px;
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        min-height: 0;
    }
    .mat-modal-footer {
        padding: 10px 16px;
        position: sticky;
        bottom: 0;
        background: var(--mat-surface);
        border-top: 1px solid var(--mat-border);
        flex-shrink: 0;
    }
    .mat-modal-icon { font-size: 20px; }
    .mat-modal-title { font-size: 16px; }
    .mat-modal-tagline { display: none; }
    /* Close button more prominent on mobile */
    .mat-modal-close {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }
}
.mat-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    -webkit-overflow-scrolling: touch;
}
@keyframes matSlideUp {
    from { opacity: 0; transform: translateY(30px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.mat-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 24px 24px 20px;
    border-bottom: 1px solid var(--mat-border);
    gap: 12px;
}
.mat-modal-title-row {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
    min-width: 0;
}
.mat-modal-icon { font-size: 30px; flex-shrink: 0; }
.mat-modal-title {
    font-family: var(--mat-display);
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    color: #fff;
    line-height: 1.2;
}
.mat-modal-tagline {
    font-size: 13px;
    color: var(--mat-muted);
    margin: 3px 0 0;
    line-height: 1.4;
}
.mat-modal-close {
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--mat-border);
    color: var(--mat-muted);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s ease;
}
.mat-modal-close:hover { background: rgba(255,255,255,0.1); color: #fff; }
.mat-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--mat-border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    align-items: center;
}

/* ─── Form Fields ──────────────────── */
.mat-field { margin-bottom: 18px; }
.mat-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--mat-muted);
    margin-bottom: 6px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    font-size: 11px;
}
.mat-input,
.mat-select,
.mat-textarea {
    width: 100%;
    background: var(--mat-bg) !important;
    border: 1px solid var(--mat-border);
    border-radius: 10px;
    color: var(--mat-text) !important;
    font-family: var(--mat-font);
    font-size: 14px;
    padding: 11px 14px;
    outline: none;
    transition: border-color 0.15s ease;
    box-sizing: border-box;
}
/* Also kill browser autofill white background */
.mat-input:-webkit-autofill,
.mat-input:-webkit-autofill:hover,
.mat-input:-webkit-autofill:focus,
.mat-textarea:-webkit-autofill {
    -webkit-box-shadow: 0 0 0px 1000px var(--mat-bg) inset !important;
    -webkit-text-fill-color: var(--mat-text) !important;
}
.mat-input:focus, .mat-select:focus, .mat-textarea:focus {
    border-color: rgba(0,206,201,0.5);
    box-shadow: 0 0 0 3px rgba(0,206,201,0.08);
}
.mat-select { appearance: none; cursor: pointer; }
.mat-textarea { min-height: 90px; resize: vertical; line-height: 1.5; }

/* ─── Spinner ──────────────────────── */
.mat-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.25);
    border-top-color: #fff;
    border-radius: 50%;
    animation: matSpin 0.6s linear infinite;
    display: inline-block;
    vertical-align: middle;
}
@keyframes matSpin { to { transform: rotate(360deg); } }

/* ─── Result Area ──────────────────── */
.mat-result-area { animation: matFadeIn 0.4s ease forwards; }
@keyframes matFadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.mat-score-ring {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0 0 24px;
}
.mat-score-circle {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 3px solid var(--mat-cyan);
    box-shadow: 0 0 30px rgba(0,206,201,0.2), inset 0 0 30px rgba(0,206,201,0.04);
    margin-bottom: 10px;
}
.mat-score-num {
    font-family: var(--mat-display);
    font-size: 34px;
    font-weight: 800;
    color: #fff;
    line-height: 1;
}
.mat-score-label {
    font-size: 11px;
    color: var(--mat-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.mat-verdict {
    font-family: var(--mat-display);
    font-size: 15px;
    font-weight: 700;
    color: var(--mat-cyan);
    text-align: center;
    margin-bottom: 6px;
}
.mat-summary {
    font-size: 14px;
    color: var(--mat-muted);
    text-align: center;
    line-height: 1.6;
    margin-bottom: 24px;
}

.mat-section-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}
.mat-section-card {
    background: var(--mat-bg);
    border: 1px solid var(--mat-border);
    border-radius: 12px;
    padding: 14px;
}
.mat-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.mat-section-name {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--mat-muted);
}
.mat-section-score {
    font-family: var(--mat-display);
    font-size: 18px;
    font-weight: 700;
    color: #fff;
}
.mat-mini-bar {
    height: 3px;
    background: rgba(255,255,255,0.07);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}
.mat-mini-fill { height: 100%; border-radius: 3px; }
.mat-section-finding { font-size: 12px; color: var(--mat-muted); line-height: 1.5; margin-bottom: 4px; }
.mat-section-fix { font-size: 12px; color: rgba(0,206,201,0.8); line-height: 1.5; }
.mat-section-fix::before { content: '→ '; }

.mat-list-block {
    background: var(--mat-bg);
    border: 1px solid var(--mat-border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 14px;
}
.mat-list-title {
    font-family: var(--mat-display);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--mat-cyan);
    margin-bottom: 10px;
}
.mat-list-item {
    font-size: 13px;
    color: var(--mat-text);
    line-height: 1.5;
    padding: 5px 0;
    border-bottom: 1px solid var(--mat-border);
    display: flex;
    gap: 8px;
}
.mat-list-item:last-child { border-bottom: none; }
.mat-list-item-bullet { flex-shrink: 0; margin-top: 2px; }

/* verdict colors */
.mat-verdict--green { color: #00b894; }
.mat-verdict--yellow { color: #fdcb6e; }
.mat-verdict--red { color: #e17055; }
.mat-score-circle--green { border-color: #00b894; box-shadow: 0 0 30px rgba(0,184,148,0.2); }
.mat-score-circle--yellow { border-color: #fdcb6e; box-shadow: 0 0 30px rgba(253,203,110,0.2); }
.mat-score-circle--red { border-color: #e17055; box-shadow: 0 0 30px rgba(225,112,85,0.2); }

/* Offer cards */
.mat-offer-card {
    background: var(--mat-bg);
    border: 1px solid var(--mat-border);
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
}
.mat-offer-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, #6c5ce7, #00cec9);
}
.mat-offer-tier {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--mat-cyan);
    margin-bottom: 4px;
}
.mat-offer-name {
    font-family: var(--mat-display);
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
}
.mat-offer-tagline {
    font-size: 13px;
    color: var(--mat-muted);
    margin-bottom: 14px;
    line-height: 1.5;
}
.mat-offer-headline {
    font-size: 15px;
    font-weight: 600;
    color: var(--mat-text);
    line-height: 1.4;
    margin-bottom: 12px;
    padding: 12px;
    background: rgba(255,255,255,0.04);
    border-radius: 8px;
    border-left: 3px solid #6c5ce7;
}
.mat-offer-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.mat-offer-tag {
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 20px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--mat-border);
    color: var(--mat-muted);
}
.mat-copy-btn {
    background: rgba(0,206,201,0.1);
    border: 1px solid rgba(0,206,201,0.2);
    color: var(--mat-cyan);
    padding: 5px 14px;
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
    font-family: var(--mat-font);
    transition: all 0.15s ease;
    float: right;
}
.mat-copy-btn:hover { background: rgba(0,206,201,0.2); }
.mat-copy-btn.copied { color: #00b894; border-color: rgba(0,184,148,0.3); }

.mat-opening-line {
    font-size: 13px;
    color: var(--mat-muted);
    font-style: italic;
    line-height: 1.5;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--mat-border);
}

/* ─── Error ────────────────────────── */
.mat-error {
    background: rgba(225,112,85,0.08);
    border: 1px solid rgba(225,112,85,0.25);
    border-radius: 12px;
    padding: 16px 20px;
    color: #e17055;
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
}

/* ─── Responsive ───────────────────── */
@media (max-width: 600px) {
    .mat-grid { padding: 16px; gap: 14px; }
    .mat-header { padding: 20px 16px; }

    /* Modal handled by dedicated mobile block above */
    .mat-section-grid { grid-template-columns: 1fr; }
}

/* ─── Stats Bar ─────────────────────────────────────────── */
.mat-stats-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    border-bottom: 1px solid var(--mat-border);
    background: rgba(255,255,255,0.02);
    flex-wrap: wrap;
}
.mat-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 18px;
    border-right: 1px solid var(--mat-border);
    flex: 1;
    min-width: 100px;
}
.mat-stat:last-child { border-right: none; }
.mat-stat-num {
    font-family: var(--mat-display);
    font-size: 24px;
    font-weight: 800;
    color: var(--mat-cyan);
    line-height: 1;
    letter-spacing: -1px;
}
.mat-stat--total .mat-stat-num {
    font-size: 30px;
    background: linear-gradient(135deg, var(--mat-cyan), #a29bfe);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.mat-stat--total {
    border-right: 2px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.015);
}
.mat-stat--score .mat-stat-num { color: #fdcb6e; }
.mat-stat-label {
    font-size: 10px;
    color: var(--mat-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
    white-space: nowrap;
}

/* ─── Save Button ───────────────────────────────────────── */
.mat-btn--save {
    background: rgba(0,206,201,0.1);
    border: 1px solid rgba(0,206,201,0.3);
    color: var(--mat-cyan);
    padding: 10px 20px;
    border-radius: 10px;
    font-family: var(--mat-font);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}
.mat-btn--save:hover { background: rgba(0,206,201,0.2); }
.mat-btn--save.saved {
    background: rgba(0,184,148,0.1);
    border-color: rgba(0,184,148,0.3);
    color: #00b894;
    cursor: default;
}

/* ─── Saved Results Section ─────────────────────────────── */
.mat-saved-section {
    padding: 32px 32px 40px;
    border-top: 1px solid var(--mat-border);
    background: var(--mat-bg);
}
.mat-saved-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}
.mat-saved-title {
    font-family: var(--mat-display);
    font-size: 18px;
    font-weight: 700;
    color: var(--mat-text);
    margin: 0;
}
.mat-saved-count {
    font-size: 12px;
    color: var(--mat-muted);
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--mat-border);
    padding: 2px 10px;
    border-radius: 20px;
}
.mat-saved-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}
.mat-saved-loading,
.mat-saved-empty {
    grid-column: 1 / -1;
    color: var(--mat-muted);
    font-size: 13px;
    text-align: center;
    padding: 32px;
    border: 1px dashed var(--mat-border);
    border-radius: var(--mat-radius);
}
.mat-saved-empty strong { color: var(--mat-text); }
.mat-saved-card {
    background: var(--mat-surface);
    border: 1px solid var(--mat-border);
    border-radius: var(--mat-radius);
    padding: 16px;
    transition: border-color 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.mat-saved-card:hover { border-color: rgba(255,255,255,0.14); }
.mat-saved-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}
.mat-saved-tool-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--mat-text);
    margin-bottom: 3px;
}
.mat-saved-inputs {
    font-size: 12px;
    color: var(--mat-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}
.mat-saved-metric {
    font-family: var(--mat-display);
    font-size: 16px;
    font-weight: 800;
    white-space: nowrap;
    flex-shrink: 0;
}
.mat-saved-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 10px;
    border-top: 1px solid var(--mat-border);
}
.mat-saved-date {
    font-size: 11px;
    color: var(--mat-muted);
}
.mat-saved-actions { display: flex; gap: 6px; }
.mat-saved-view-btn,
.mat-saved-del-btn {
    border: 1px solid var(--mat-border);
    background: transparent;
    color: var(--mat-muted);
    font-family: var(--mat-font);
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.mat-saved-view-btn:hover { border-color: rgba(0,206,201,0.4); color: var(--mat-cyan); }
.mat-saved-del-btn:hover  { border-color: rgba(225,112,85,0.4); color: #e17055; }

@media (max-width: 600px) {
    .mat-stats-bar {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        justify-content: flex-start;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .mat-stats-bar::-webkit-scrollbar { display: none; }
    .mat-stat {
        flex-shrink: 0;
        min-width: 110px;
        padding: 12px 14px;
        border-bottom: none;
    }
    .mat-saved-section { padding: 20px 16px; }
    .mat-saved-grid { grid-template-columns: 1fr; }
}

/* ─── AI Scanner Section ────────────────────────────────── */
.mat-scanner-section {
    position: relative;
    width: 100%;
    height: 220px;
    overflow: hidden;
    background: var(--mat-bg);
    border-top: 1px solid var(--mat-border);
}
.mat-scanner-canvas {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
}
.mat-scanner-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    pointer-events: none;
}
.mat-scanner-core {
    position: relative;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.mat-scanner-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(0,206,201,0.4);
    animation: mat-ring-pulse 3s ease-in-out infinite;
}
.mat-scanner-ring--1 { width: 80px;  height: 80px;  animation-delay: 0s;    border-color: rgba(0,206,201,0.5); }
.mat-scanner-ring--2 { width: 110px; height: 110px; animation-delay: 0.6s;  border-color: rgba(108,92,231,0.4); }
.mat-scanner-ring--3 { width: 145px; height: 145px; animation-delay: 1.2s;  border-color: rgba(0,206,201,0.2); }
@keyframes mat-ring-pulse {
    0%   { transform: scale(0.8); opacity: 0.8; }
    50%  { transform: scale(1.1); opacity: 0.3; }
    100% { transform: scale(0.8); opacity: 0.8; }
}
.mat-scanner-pulse {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: radial-gradient(circle, #00cec9, #6c5ce7);
    box-shadow: 0 0 20px rgba(0,206,201,0.8), 0 0 40px rgba(0,206,201,0.4);
    animation: mat-core-glow 2s ease-in-out infinite;
}
@keyframes mat-core-glow {
    0%, 100% { box-shadow: 0 0 20px rgba(0,206,201,0.8), 0 0 40px rgba(0,206,201,0.4); }
    50%       { box-shadow: 0 0 30px rgba(108,92,231,0.9), 0 0 60px rgba(108,92,231,0.5); }
}
.mat-scanner-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.mat-scanner-label {
    font-family: var(--mat-display);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 4px;
    color: rgba(255,255,255,0.3);
    text-transform: uppercase;
}
.mat-scanner-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    letter-spacing: 2px;
    color: var(--mat-cyan);
    text-transform: uppercase;
}
.mat-scanner-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--mat-cyan);
    box-shadow: 0 0 8px var(--mat-cyan);
    animation: mat-dot-blink 1.5s ease-in-out infinite;
}
@keyframes mat-dot-blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.2; }
}

/* ─── Spreadsheet Preview (in modal) ────────────────────── */
.mat-sheet-dl-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #00b894, #00cec9);
    border: none;
    color: #fff;
    font-family: var(--mat-font);
    font-size: 13px;
    font-weight: 700;
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    transition: opacity 0.15s ease;
}
.mat-sheet-dl-btn:hover { opacity: 0.85; }
.mat-sheet-preview-wrap {
    overflow-x: auto;
    border: 1px solid var(--mat-border);
    border-radius: 10px;
    max-height: 360px;
    overflow-y: auto;
}
.mat-sheet-preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    white-space: nowrap;
}
.mat-sheet-preview-table thead th {
    background: var(--mat-surface2);
    color: var(--mat-cyan);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid var(--mat-border);
    position: sticky;
    top: 0;
    white-space: nowrap;
}
.mat-sheet-preview-table tbody tr {
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.mat-sheet-preview-table tbody tr:hover { background: rgba(255,255,255,0.03); }
.mat-sheet-preview-table tbody tr:nth-child(even) { background: rgba(255,255,255,0.015); }
.mat-sheet-preview-table td {
    padding: 7px 12px;
    color: var(--mat-text);
    max-width: 200px;
    white-space: normal;
    word-break: break-word;
    vertical-align: top;
    border-right: 1px solid rgba(255,255,255,0.03);
}

/* ─── Agency Hunter — 2-column grid in wide modal ─────── */
#mat-result-area .mat-agency-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
    gap: 14px;
}

/* ─── Keyword Planner UI ────────────────────────────────── */
.mat-kw-hero {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--mat-surface2);
    border: 1px solid var(--mat-border);
    border-radius: var(--mat-radius);
    overflow: hidden;
    margin-bottom: 20px;
}
.mat-kw-metric {
    flex: 1;
    padding: 16px 12px;
    text-align: center;
    border-right: 1px solid var(--mat-border);
}
.mat-kw-metric:last-child { border-right: none; }
.mat-kw-metric-val {
    font-family: var(--mat-display);
    font-size: 22px;
    font-weight: 800;
    color: var(--mat-text);
    line-height: 1;
    margin-bottom: 4px;
}
.mat-kw-metric-lbl {
    font-size: 10px;
    color: var(--mat-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}
.mat-kw-section {
    margin-bottom: 20px;
}
.mat-kw-section-title {
    font-family: var(--mat-display);
    font-size: 13px;
    font-weight: 700;
    color: var(--mat-text);
    letter-spacing: 0.3px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--mat-border);
}
.mat-kw-serp-table,
.mat-kw-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.mat-kw-serp-table thead th,
.mat-kw-table thead th {
    background: var(--mat-surface2);
    color: var(--mat-muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 7px 10px;
    text-align: left;
    border-bottom: 1px solid var(--mat-border);
}
.mat-kw-serp-table tbody tr,
.mat-kw-table tbody tr {
    border-bottom: 1px solid rgba(255,255,255,0.04);
    transition: background 0.1s;
}
.mat-kw-serp-table tbody tr:hover,
.mat-kw-table tbody tr:hover { background: rgba(255,255,255,0.03); }
.mat-kw-serp-table td,
.mat-kw-table td {
    padding: 8px 10px;
    color: var(--mat-muted);
    vertical-align: middle;
}
.mat-kw-pos {
    font-family: var(--mat-display);
    font-weight: 800;
    color: var(--mat-cyan) !important;
    width: 30px;
    text-align: center;
}
@media (max-width: 600px) {
    .mat-kw-hero { flex-wrap: wrap; }
    .mat-kw-metric { min-width: 33%; border-bottom: 1px solid var(--mat-border); }
    .mat-kw-metric-val { font-size: 16px; }
    /* Hide less critical columns on mobile */
    .mat-kw-table thead th:nth-child(4),
    .mat-kw-table td:nth-child(4),
    .mat-kw-table thead th:nth-child(5),
    .mat-kw-table td:nth-child(5) { display: none; }
    .mat-kw-serp-table thead th:nth-child(4),
    .mat-kw-serp-table td:nth-child(4) { display: none; }
    .mat-kw-serp-table td, .mat-kw-table td { padding: 6px 6px; font-size: 11px; }
    .mat-kw-serp-table thead th, .mat-kw-table thead th { padding: 5px 6px; font-size: 9px; }
    /* Agency hunter 2-col → 1-col */
    #mat-result-area .mat-agency-grid { grid-template-columns: 1fr; }
    /* Stats bar */
    .mat-offer-meta { flex-wrap: wrap; gap: 4px; }
}

/* ─── Mobile close button with label ──────────────────────── */
.mat-close-label { display: none; }
@media (max-width: 768px) {
    .mat-modal-close {
        display: flex;
        align-items: center;
        gap: 5px;
        width: auto !important;
        padding: 6px 12px;
        border-radius: 8px;
        font-size: 13px;
    }
    .mat-close-label { display: inline; font-size: 13px; }
    .mat-close-icon { font-size: 14px; }
}

/* ─── Mobile form compaction ──────────────────────── */
@media (max-width: 768px) {
    .mat-field { margin-bottom: 12px; }
    .mat-label { margin-bottom: 5px; font-size: 12px; }
    .mat-input, .mat-select, .mat-textarea { padding: 10px 12px; font-size: 14px; }
    .mat-modal-body { padding: 14px; }
    /* Make sure footer button is always visible */
    #mat-modal-footer { flex-shrink: 0; }
}
