/* ============================================================
   AdChanger — Refined Dev-Tool Aesthetic
   Typography: Bricolage Grotesque (display) · Manrope (body) · JetBrains Mono (code)
   ============================================================ */

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Brand */
    --brand: #2546f0;          /* electric signal blue */
    --brand-dark: #1c33b8;
    --brand-deep: #0f1d6e;
    --brand-tint: #eef1ff;
    --brand-tint-2: #e0e6ff;

    /* Surfaces */
    --bg: #f6f5f1;             /* warm off-white */
    --bg-deep: #efece5;
    --surface: #ffffff;
    --surface-2: #fafaf7;

    /* Ink */
    --ink: #0b0d12;
    --ink-2: #2a2d34;
    --ink-3: #5a5e68;
    --ink-4: #8a8e98;
    --ink-5: #b8bcc4;

    /* Lines */
    --line: #e6e3da;
    --line-2: #efece5;
    --line-strong: #d4d0c4;

    /* Status */
    --success: #047857;
    --success-tint: #d1fae5;
    --warning: #b45309;
    --warning-tint: #fef3c7;
    --error: #b91c1c;
    --error-tint: #fee2e2;

    /* Effects */
    --radius-xs: 6px;
    --radius-sm: 10px;
    --radius: 14px;
    --radius-lg: 20px;
    --shadow-xs: 0 1px 0 rgba(11,13,18,0.04);
    --shadow-sm: 0 1px 2px rgba(11,13,18,0.05), 0 1px 0 rgba(11,13,18,0.03);
    --shadow: 0 4px 16px -8px rgba(11,13,18,0.10), 0 2px 4px -2px rgba(11,13,18,0.06);
    --shadow-lg: 0 24px 48px -16px rgba(11,13,18,0.18), 0 8px 16px -8px rgba(11,13,18,0.08);
    --shadow-brand: 0 8px 24px -8px rgba(37,70,240,0.35);

    /* Grid pattern */
    --grid: rgba(11,13,18,0.04);
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    background-image:
        linear-gradient(var(--grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid) 1px, transparent 1px);
    background-size: 32px 32px;
    background-position: -1px -1px;
    color: var(--ink);
    line-height: 1.55;
    letter-spacing: -0.005em;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 980px;
    margin: 0 auto;
    padding: 0 24px;
    width: 100%;
}

/* ============================================================
   HEADER
   ============================================================ */
.header {
    background: rgba(246, 245, 241, 0.82);
    backdrop-filter: saturate(160%) blur(12px);
    -webkit-backdrop-filter: saturate(160%) blur(12px);
    border-bottom: 1px solid var(--line);
    padding: 14px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-mark {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--ink);
    color: #fff;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px -4px rgba(11,13,18,0.4), inset 0 1px 0 rgba(255,255,255,0.08);
    position: relative;
}

.logo-mark svg { display: block; }

.logo-mark::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, transparent 60%, rgba(37,70,240,0.4));
    pointer-events: none;
}

.logo-text {
    font-family: 'Bricolage Grotesque', 'Manrope', sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -0.02em;
    font-variation-settings: "wdth" 90;
}

.logo-version {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 600;
    color: var(--brand);
    background: var(--brand-tint);
    padding: 3px 7px;
    border-radius: 999px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border: 1px solid var(--brand-tint-2);
}

.header-tag {
    color: var(--ink-3);
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-tag::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 3px var(--success-tint);
}

/* ============================================================
   STEPPER
   ============================================================ */
.stepper {
    border-bottom: 1px solid var(--line);
    background: var(--bg);
    padding: 18px 0;
}

.stepper-track {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    position: relative;
}

.stepper-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--ink-4);
    font-size: 13px;
    font-weight: 600;
    position: relative;
    padding-right: 12px;
}

.stepper-item:not(:last-child)::after {
    content: "";
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 1px;
    background: var(--line-strong);
}

.stepper-num {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--surface);
    border: 1.5px solid var(--line-strong);
    color: var(--ink-4);
    display: grid;
    place-items: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
    transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.stepper-label {
    letter-spacing: 0.01em;
}

/* Active state via body data-attribute */
body[data-active-step="upload"] .stepper-item[data-step="1"],
body[data-active-step="processing"] .stepper-item[data-step="2"],
body[data-active-step="results"] .stepper-item[data-step="3"],
body[data-active-step="download"] .stepper-item[data-step="4"] {
    color: var(--ink);
}
body[data-active-step="upload"] .stepper-item[data-step="1"] .stepper-num,
body[data-active-step="processing"] .stepper-item[data-step="2"] .stepper-num,
body[data-active-step="results"] .stepper-item[data-step="3"] .stepper-num,
body[data-active-step="download"] .stepper-item[data-step="4"] .stepper-num {
    background: var(--ink);
    border-color: var(--ink);
    color: #fff;
    transform: scale(1.05);
    box-shadow: 0 6px 16px -6px rgba(11,13,18,0.4);
}

/* Completed state */
body[data-active-step="processing"] .stepper-item[data-step="1"] .stepper-num,
body[data-active-step="results"]    .stepper-item[data-step="1"] .stepper-num,
body[data-active-step="results"]    .stepper-item[data-step="2"] .stepper-num,
body[data-active-step="download"]   .stepper-item[data-step="1"] .stepper-num,
body[data-active-step="download"]   .stepper-item[data-step="2"] .stepper-num,
body[data-active-step="download"]   .stepper-item[data-step="3"] .stepper-num {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

body[data-active-step="processing"] .stepper-item[data-step="1"],
body[data-active-step="results"]    .stepper-item[data-step="1"],
body[data-active-step="results"]    .stepper-item[data-step="2"],
body[data-active-step="download"]   .stepper-item[data-step="1"],
body[data-active-step="download"]   .stepper-item[data-step="2"],
body[data-active-step="download"]   .stepper-item[data-step="3"] {
    color: var(--brand-dark);
}

/* ============================================================
   MAIN
   ============================================================ */
.main {
    flex: 1;
    padding: 40px 0 56px;
}

.step {
    display: none;
    animation: stepIn 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.step.active { display: block; }

@keyframes stepIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   CARD
   ============================================================ */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 36px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    position: relative;
}

.card-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    color: var(--brand);
    background: var(--brand-tint);
    padding: 4px 10px;
    border-radius: 999px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 14px;
    border: 1px solid var(--brand-tint-2);
}

.card-title {
    font-family: 'Bricolage Grotesque', 'Manrope', sans-serif;
    font-size: 32px;
    font-weight: 600;
    color: var(--ink);
    line-height: 1.1;
    letter-spacing: -0.03em;
    margin-bottom: 10px;
    font-variation-settings: "wdth" 95;
}

.card-subtitle {
    color: var(--ink-3);
    font-size: 15px;
    margin-bottom: 28px;
    max-width: 60ch;
}

.success-card { text-align: center; }

.success-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 20px;
    border-radius: 50%;
    background: var(--success-tint);
    color: var(--success);
    display: grid;
    place-items: center;
    font-size: 36px;
    box-shadow: 0 0 0 8px rgba(4,120,87,0.06);
    animation: pop 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes pop {
    0%   { transform: scale(0.6); opacity: 0; }
    60%  { transform: scale(1.08); }
    100% { transform: scale(1); opacity: 1; }
}

.success-card .card-title { text-align: center; }
.success-card .card-subtitle { margin-left: auto; margin-right: auto; }

/* ============================================================
   UPLOAD AREA
   ============================================================ */
.upload-area {
    border: 1.5px dashed var(--line-strong);
    border-radius: var(--radius);
    padding: 56px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
    background: var(--surface-2);
    position: relative;
    overflow: hidden;
}

.upload-area::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 30% 20%, rgba(37,70,240,0.05), transparent 50%),
        radial-gradient(circle at 70% 80%, rgba(37,70,240,0.04), transparent 50%);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.upload-area:hover, .upload-area.dragover {
    border-color: var(--brand);
    background: var(--brand-tint);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.upload-area:hover::before, .upload-area.dragover::before {
    opacity: 1;
}

.upload-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    border-radius: 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    display: grid;
    place-items: center;
    color: var(--brand);
    box-shadow: var(--shadow-sm);
    transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.upload-area:hover .upload-icon,
.upload-area.dragover .upload-icon {
    transform: translateY(-3px) scale(1.05);
    border-color: var(--brand);
}

.upload-icon svg { display: block; }

.upload-text strong {
    display: block;
    font-family: 'Bricolage Grotesque', sans-serif;
    font-size: 19px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 4px;
    letter-spacing: -0.01em;
}

.upload-text span {
    color: var(--ink-3);
    font-size: 14px;
}

.upload-hint {
    margin-top: 14px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--ink-4);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--surface);
    padding: 5px 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
}

/* File selected pill */
.file-selected {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin-top: 16px;
    animation: stepIn 0.3s ease;
}

.file-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--brand-tint);
    color: var(--brand);
    display: grid;
    place-items: center;
    flex-shrink: 0;
    font-size: 20px;
}

.file-info { flex: 1; min-width: 0; }

.file-name {
    font-weight: 600;
    color: var(--ink);
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--ink-4);
    margin-top: 2px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 22px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.005em;
    cursor: pointer;
    transition: all 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
    text-decoration: none;
    line-height: 1;
    white-space: nowrap;
    user-select: none;
}

.btn-primary {
    background: var(--ink);
    color: #fff;
    border-color: var(--ink);
    box-shadow: 0 4px 12px -4px rgba(11,13,18,0.3), inset 0 1px 0 rgba(255,255,255,0.1);
}

.btn-primary:hover {
    background: var(--brand);
    border-color: var(--brand);
    transform: translateY(-1px);
    box-shadow: var(--shadow-brand);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--surface);
    color: var(--ink);
    border-color: var(--line-strong);
}

.btn-secondary:hover {
    background: var(--surface-2);
    border-color: var(--ink-4);
    transform: translateY(-1px);
}

.btn-large {
    padding: 14px 28px;
    font-size: 15px;
    width: 100%;
    margin-top: 18px;
    border-radius: 12px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    border: none;
    color: var(--ink-4);
    cursor: pointer;
    border-radius: 8px;
    display: grid;
    place-items: center;
    transition: all 0.15s;
    flex-shrink: 0;
}

.btn-icon:hover {
    background: var(--line-2);
    color: var(--ink);
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
}

/* ============================================================
   INFO BOX
   ============================================================ */
.info-box {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px 26px;
    box-shadow: var(--shadow-xs);
    position: relative;
}

.info-box::before {
    content: "";
    position: absolute;
    left: 0;
    top: 22px;
    bottom: 22px;
    width: 3px;
    background: var(--brand);
    border-radius: 0 3px 3px 0;
}

.info-box h3 {
    font-family: 'Bricolage Grotesque', sans-serif;
    color: var(--ink);
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 14px;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-box h3::before {
    content: "→";
    color: var(--brand);
    font-weight: 600;
}

.info-box ol {
    padding-left: 22px;
    color: var(--ink-2);
    counter-reset: step;
    list-style: none;
}

.info-box ol li {
    margin: 8px 0;
    font-size: 14px;
    counter-increment: step;
    position: relative;
    padding-left: 4px;
}

.info-box ol li::before {
    content: counter(step);
    position: absolute;
    left: -22px;
    top: 1px;
    width: 18px;
    height: 18px;
    background: var(--brand-tint);
    color: var(--brand);
    border-radius: 50%;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 700;
    display: grid;
    place-items: center;
}

.info-box code,
code {
    background: var(--ink);
    color: #d4ddff;
    padding: 2px 8px;
    border-radius: 5px;
    font-size: 12px;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
    letter-spacing: -0.02em;
}

/* ============================================================
   PROGRESS
   ============================================================ */
.progress-container {
    margin-top: 28px;
    padding: 20px 22px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.progress-bar {
    height: 8px;
    background: var(--line-2);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 14px;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--brand) 0%, #4a6cff 50%, var(--brand) 100%);
    background-size: 200% 100%;
    transition: width 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    border-radius: 999px;
    position: relative;
    animation: shimmer 2s linear infinite;
}

.progress-fill::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: sweep 1.4s linear infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: 0 0; }
}

@keyframes sweep {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--ink-3);
    font-size: 13px;
}

#progressPercent {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    color: var(--ink);
    font-size: 14px;
}

#progressMessage {
    font-style: italic;
}

/* ============================================================
   TABS
   ============================================================ */
.tabs {
    display: flex;
    gap: 4px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    padding: 4px;
    border-radius: 12px;
    margin-bottom: 24px;
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: thin;
}

.tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    cursor: pointer;
    color: var(--ink-3);
    font-weight: 600;
    font-size: 13px;
    border-radius: 8px;
    white-space: nowrap;
    transition: all 0.18s;
    background: transparent;
    border: none;
    font-family: inherit;
}

.tab.active {
    color: var(--ink);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.tab:hover:not(.active) {
    color: var(--ink);
    background: rgba(255,255,255,0.5);
}

.tab-badge {
    display: inline-grid;
    place-items: center;
    background: var(--ink);
    color: #fff;
    border-radius: 999px;
    padding: 0 7px;
    min-width: 20px;
    height: 20px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 700;
}

.tab:not(.active) .tab-badge {
    background: var(--ink-5);
}

.tab-pane { display: none; }
.tab-pane.active { display: block; animation: stepIn 0.3s ease; }

/* ============================================================
   BULK REPLACE
   ============================================================ */
.bulk-replace {
    background: linear-gradient(135deg, var(--brand-tint) 0%, var(--surface) 100%);
    border: 1px solid var(--brand-tint-2);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}

.bulk-replace::before {
    content: "";
    position: absolute;
    top: -20px;
    right: -20px;
    width: 80px;
    height: 80px;
    background: radial-gradient(circle, rgba(37,70,240,0.15), transparent 70%);
    pointer-events: none;
}

.bulk-replace-title {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-weight: 600;
    color: var(--brand-deep);
    margin-bottom: 14px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    letter-spacing: -0.01em;
}

.bulk-replace-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.bulk-replace-old,
.bulk-replace-input {
    flex: 1;
    min-width: 200px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    background: var(--surface);
    transition: all 0.15s;
}

.bulk-replace-old {
    color: var(--ink-3);
    background: var(--surface-2);
}

.bulk-replace-input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(37,70,240,0.15);
}

/* ============================================================
   DETECTION CARDS
   ============================================================ */
.detection-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 12px;
    transition: all 0.2s;
    position: relative;
}

.detection-card:hover {
    border-color: var(--line-strong);
    box-shadow: var(--shadow-sm);
}

.detection-card.is-test {
    border-color: var(--warning);
    background: linear-gradient(135deg, var(--warning-tint) 0%, var(--surface) 30%);
}

.detection-card.is-test::before {
    content: "";
    position: absolute;
    left: -1px;
    top: 12px;
    bottom: 12px;
    width: 3px;
    background: var(--warning);
    border-radius: 0 3px 3px 0;
}

.detection-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 8px;
}

.detection-type {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-weight: 600;
    color: var(--ink);
    font-size: 15px;
    letter-spacing: -0.01em;
}

.detection-badge {
    display: inline-flex;
    align-items: center;
    background: var(--brand-tint);
    color: var(--brand-deep);
    padding: 3px 9px;
    border-radius: 999px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border: 1px solid var(--brand-tint-2);
}

.detection-badge.test {
    background: var(--warning-tint);
    color: var(--warning);
    border-color: rgba(180,83,9,0.2);
}

.detection-old {
    background: var(--ink);
    color: #c5d0ff;
    padding: 10px 12px;
    border-radius: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    margin: 10px 0;
    word-break: break-all;
    border: 1px solid rgba(255,255,255,0.06);
    position: relative;
}

.detection-old::before {
    content: "OLD";
    position: absolute;
    top: 8px;
    right: 10px;
    font-size: 9px;
    color: rgba(197,208,255,0.4);
    font-weight: 700;
    letter-spacing: 0.1em;
}

.detection-input {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    margin-top: 4px;
    background: var(--surface-2);
    transition: all 0.15s;
    color: var(--ink);
}

.detection-input:focus {
    outline: none;
    border-color: var(--brand);
    background: var(--surface);
    box-shadow: 0 0 0 3px rgba(37,70,240,0.15);
}

.detection-input.invalid {
    border-color: var(--error);
    background: var(--error-tint);
}

.detection-input.valid {
    border-color: var(--success);
    background: var(--success-tint);
}

.detection-meta {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--ink-4);
    margin-top: 10px;
    word-break: break-all;
    line-height: 1.5;
}

/* ============================================================
   WARNINGS / ERRORS
   ============================================================ */
.warning-box {
    background: var(--warning-tint);
    border: 1px solid rgba(180,83,9,0.2);
    border-left: 3px solid var(--warning);
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    color: var(--warning);
    font-size: 14px;
    font-weight: 500;
}

.warning-box strong { font-weight: 700; }

.error-box {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--ink);
    color: #fff;
    padding: 14px 18px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 420px;
    z-index: 1000;
    animation: slideIn 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    border: 1px solid rgba(255,255,255,0.08);
    font-size: 14px;
}

@keyframes slideIn {
    from { transform: translateX(440px); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

.error-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--error);
    display: grid;
    place-items: center;
    flex-shrink: 0;
    font-size: 14px;
}

.error-box .btn-icon {
    color: rgba(255,255,255,0.7);
    margin-left: auto;
}

.error-box .btn-icon:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

/* ============================================================
   ACTIONS
   ============================================================ */
.actions {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--line);
    flex-wrap: wrap;
}

.actions .btn {
    flex: 1;
    min-width: 150px;
    margin-top: 0;
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
    border-top: 1px solid var(--line);
    background: var(--bg-deep);
    padding: 28px 0;
    margin-top: auto;
}

.footer .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.footer p {
    color: var(--ink-3);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.footer-version {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--ink-4);
    background: var(--surface);
    padding: 3px 8px;
    border-radius: 5px;
    border: 1px solid var(--line);
}

.footer a {
    color: var(--ink);
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px solid var(--line-strong);
    padding-bottom: 1px;
    transition: border-color 0.15s;
}

.footer a:hover {
    border-color: var(--brand);
    color: var(--brand);
}

/* ============================================================
   STATS BAR (overview pills above the tabs)
   ============================================================ */
.stats-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}

.stats-bar:empty { display: none; }

.stat-pill {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    padding: 8px 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-2);
    box-shadow: var(--shadow-xs);
    transition: transform 0.15s;
}

.stat-pill .stat-num {
    font-family: 'JetBrains Mono', monospace;
    font-size: 15px;
    font-weight: 700;
    color: var(--ink);
    transition: color 0.2s;
}

.stat-pill .stat-label {
    color: var(--ink-3);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.01em;
}

.stat-pill-primary {
    background: var(--ink);
    border-color: var(--ink);
    color: #fff;
}
.stat-pill-primary .stat-num { color: #fff; }
.stat-pill-primary .stat-label { color: rgba(255,255,255,0.75); }

.stat-pill-sdk {
    background: var(--brand-tint);
    border-color: var(--brand-tint-2);
}
.stat-pill-sdk .stat-num { color: var(--brand-deep); }

.stat-pill-orange {
    background: #fff4ee;
    border-color: #ffd4c0;
}
.stat-pill-orange .stat-num { color: #c2410c; }

.stat-pill-warning {
    background: var(--warning-tint);
    border-color: rgba(180,83,9,0.2);
}
.stat-pill-warning .stat-num { color: var(--warning); }

.stat-pill-success {
    background: var(--success-tint);
    border-color: rgba(4,120,87,0.2);
}
.stat-pill-success .stat-num { color: var(--success); }

.stat-pill-muted {
    background: var(--surface-2);
    border-color: var(--line);
}
.stat-pill-muted .stat-num { color: var(--ink-3); }

/* ============================================================
   PER-PANE TOOLBAR (search + filter chips)
   ============================================================ */
.pane-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.pane-search {
    flex: 1;
    min-width: 220px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    font-size: 13px;
    font-family: inherit;
    color: var(--ink);
    transition: border-color 0.15s;
}

.pane-search:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(37,70,240,0.1);
}

.pane-search::placeholder {
    color: var(--ink-4);
}

.pane-filters {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.filter-chip {
    padding: 6px 12px;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-3);
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
}

.filter-chip:hover {
    background: var(--surface-2);
    color: var(--ink);
    border-color: var(--ink-4);
}

.filter-chip.active {
    background: var(--ink);
    border-color: var(--ink);
    color: #fff;
}

.filter-chip-warning.active {
    background: var(--warning);
    border-color: var(--warning);
    color: #fff;
}

.pane-toolbar-count {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--ink-4);
    margin-left: auto;
    padding-left: 8px;
}

@media (max-width: 600px) {
    .pane-toolbar { flex-direction: column; align-items: stretch; }
    .pane-search { min-width: 0; }
    .pane-toolbar-count { margin-left: 0; }
}


.profile-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 16px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.profile-bar:empty {
    display: none;
}

.profile-bar-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.profile-bar-icon {
    font-size: 18px;
}

.profile-bar-text {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
    min-width: 0;
}

.profile-bar-text strong {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-size: 14px;
    color: var(--ink);
    font-weight: 600;
    letter-spacing: -0.01em;
}

.profile-bar-status {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--ink-4);
    transition: opacity 0.2s;
}

.profile-bar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.profile-bar-actions .btn {
    padding: 7px 14px;
    font-size: 12px;
    font-weight: 600;
}

.profile-preset-select {
    padding: 7px 30px 7px 12px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--surface) url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%235a5e68' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E") no-repeat right 10px center;
    background-size: 9px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-2);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    transition: border-color 0.15s, background-color 0.15s;
    max-width: 200px;
}

.profile-preset-select:hover {
    border-color: var(--ink-4);
    background-color: var(--surface-2);
}

.profile-preset-select:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(37,70,240,0.12);
}

/* ============================================================
   SMARTLINK BULK REPLACE (variant of bulk-replace)
   ============================================================ */
.bulk-replace.smartlink-bulk {
    background: linear-gradient(135deg, #fff4ee 0%, var(--surface) 100%);
    border-color: #ffd4c0;
}

.bulk-replace.smartlink-bulk::before {
    background: radial-gradient(circle, rgba(255,87,34,0.12), transparent 70%);
}

.bulk-replace.smartlink-bulk .bulk-replace-title {
    color: #c2410c;
}

.smartlink-bulk-input.valid {
    border-color: var(--success);
    background: var(--success-tint);
}

.smartlink-bulk-input.invalid {
    border-color: var(--error);
}

/* Rotation textarea */
.rotation-textarea {
    width: 100%;
    min-height: 88px;
    padding: 12px 14px;
    margin-top: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    line-height: 1.5;
    color: var(--ink);
    resize: vertical;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.rotation-textarea:focus {
    outline: none;
    border-color: #c2410c;
    box-shadow: 0 0 0 3px rgba(255,87,34,0.12);
}

.rotation-textarea::placeholder {
    color: var(--ink-5);
    font-size: 11.5px;
}

/* Strategy / coverage row */
.rotation-controls {
    display: flex;
    gap: 12px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.rotation-control {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--ink-3);
    font-weight: 600;
}

.rotation-control > span {
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
}

.rotation-control select {
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--surface);
    font-family: 'Manrope', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    cursor: pointer;
    transition: border-color 0.15s;
}

.rotation-control select:focus {
    outline: none;
    border-color: #c2410c;
}

/* Distribution preview */
.rotation-preview {
    display: none;
    margin-top: 12px;
    padding: 10px 12px;
    background: rgba(255,255,255,0.6);
    border: 1px solid #ffd4c0;
    border-radius: var(--radius-sm);
    font-size: 12px;
}

.rotation-preview.active {
    display: block;
}

.preview-summary {
    font-weight: 600;
    color: var(--ink-2);
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px dashed #ffd4c0;
}

.preview-coverage {
    color: #c2410c;
}

.preview-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.preview-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    padding: 4px 0;
}

.preview-url {
    color: var(--ink-3);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.preview-weight {
    background: var(--ink-2);
    color: #fff;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 10px;
    margin-left: 4px;
}

.preview-count {
    color: #c2410c;
    font-weight: 700;
    flex-shrink: 0;
    background: rgba(255,87,34,0.08);
    padding: 2px 8px;
    border-radius: 999px;
}

.rotation-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px;
}

@media (max-width: 600px) {
    .profile-bar {
        flex-direction: column;
        align-items: stretch;
    }
    .profile-bar-actions {
        justify-content: stretch;
    }
    .profile-bar-actions .btn {
        flex: 1;
    }
}



/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 720px) {
    .container { padding: 0 16px; }

    .card { padding: 24px 20px; }
    .card-title { font-size: 26px; }

    .header { padding: 12px 0; }
    .header .container {
        flex-direction: row;
        align-items: center;
    }
    .header-tag { display: none; }

    .stepper { padding: 14px 0; }
    .stepper-track { gap: 0; }
    .stepper-item {
        font-size: 0;
        padding-right: 8px;
        justify-content: center;
    }
    .stepper-item .stepper-label { display: none; }
    .stepper-item:not(:last-child)::after {
        position: relative;
        right: auto;
        top: auto;
        transform: none;
        flex: 1;
        width: auto;
        margin-left: 8px;
    }

    .upload-area { padding: 36px 16px; }
    .upload-text strong { font-size: 17px; }

    .actions { flex-direction: column; }
    .actions .btn { width: 100%; }

    .error-box {
        left: 16px;
        right: 16px;
        bottom: 16px;
        max-width: none;
    }

    .footer .container { justify-content: center; text-align: center; }
}

@media (max-width: 480px) {
    .card-title { font-size: 23px; }
    .logo-version { display: none; }
}

/* ============================================================
   PRINT
   ============================================================ */
@media print {
    body { background: #fff; }
    .header, .footer, .stepper, .actions, .upload-area { display: none; }
}
