/* ── Links page ──────────────────────────────────────────────────────────── */

.links-main {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 1.25rem 5rem;
}

/* Hero */
.links-hero {
    text-align: center;
    padding: 3.5rem 1rem 2.5rem;
    position: relative;
}

.links-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 0%, rgba(252, 92, 108, 0.08) 0%, transparent 70%);
    pointer-events: none;
}

.links-eyebrow {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--primary-color, #fc5c6c);
    margin: 0 0 14px;
}

.links-headline {
    font-size: clamp(1.9rem, 5vw, 2.8rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: #111;
    margin: 0 0 16px;
}

.links-sub {
    font-size: 1rem;
    color: #666;
    line-height: 1.7;
    max-width: 480px;
    margin: 0 auto 24px;
}

.links-hero-badges {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
}

.links-hero-badges span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #555;
    background: #f5f5f5;
    border: 1px solid #e8e8e8;
    border-radius: 999px;
    padding: 5px 14px;
}

.links-hero-badges span i {
    color: var(--primary-color, #fc5c6c);
}

/* Auth gate */
.links-gate {
    text-align: center;
    padding: 3rem 1rem;
    border: 1.5px dashed #e0e0e0;
    border-radius: 14px;
    margin-bottom: 2rem;
}

.links-gate-icon {
    font-size: 2.2rem;
    color: #ccc;
    margin-bottom: 1rem;
    display: block;
}

.links-gate p {
    color: #555;
    margin-bottom: 1.25rem;
    font-size: 1rem;
}

.links-gate-btns {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* Buttons */
.links-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: var(--primary-color, #fc5c6c);
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    padding: 11px 22px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
}

.links-btn-primary:hover {
    background: #e84756;
}

.links-btn-outline {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: transparent;
    color: var(--primary-color, #fc5c6c);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 10px 20px;
    border: 1.5px solid var(--primary-color, #fc5c6c);
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.links-btn-outline:hover {
    background: rgba(252, 92, 108, 0.06);
}

.links-icon-btn {
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    color: #555;
    font-size: 0.9rem;
    transition: background 0.15s;
    flex-shrink: 0;
}

.links-icon-btn:hover {
    background: #ebebeb;
}

/* Card */
.links-card {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 14px;
    padding: 2rem;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
    margin-bottom: 1.5rem;
}

.links-card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #111;
    margin: 0 0 1.5rem;
}

/* Fields */
.links-field {
    margin-bottom: 1.1rem;
}

.links-field label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #444;
    margin-bottom: 5px;
}

.links-required {
    color: var(--primary-color, #fc5c6c);
}

.links-optional {
    font-weight: 400;
    color: #999;
}

.links-input {
    width: 100%;
    padding: 10px 13px;
    border: 1.5px solid #ddd;
    border-radius: 8px;
    font-size: 0.95rem;
    color: #222;
    background: #fafafa;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
}

.links-input:focus {
    outline: none;
    border-color: var(--primary-color, #fc5c6c);
    box-shadow: 0 0 0 3px rgba(252, 92, 108, 0.12);
    background: #fff;
}

/* Slug row */
.slug-row {
    display: flex;
    align-items: center;
    border: 1.5px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background: #fafafa;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.slug-row:focus-within {
    border-color: var(--primary-color, #fc5c6c);
    box-shadow: 0 0 0 3px rgba(252, 92, 108, 0.12);
}

.slug-prefix {
    padding: 10px 10px 10px 13px;
    font-size: 0.88rem;
    color: #888;
    white-space: nowrap;
    user-select: none;
    background: transparent;
}

.slug-input {
    flex: 1;
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    border-radius: 0;
    padding-left: 2px;
}

.slug-input:focus {
    outline: none;
}

/* UTM toggle */
.utm-section {
    margin-bottom: 1.1rem;
    border: 1px solid #e8e8e8;
    border-radius: 10px;
    overflow: hidden;
}

.utm-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 14px;
    background: #f8f8f8;
    border: none;
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 600;
    color: #444;
    text-align: left;
    transition: background 0.12s;
}

.utm-toggle:hover {
    background: #f0f0f0;
}

.utm-toggle i:first-child {
    color: var(--primary-color, #fc5c6c);
}

.utm-chevron {
    margin-left: auto;
    transition: transform 0.2s;
    color: #aaa;
    font-size: 0.8rem;
}

.utm-chevron.open {
    transform: rotate(90deg);
}

.utm-fields {
    padding: 1rem 1rem 0.25rem;
    border-top: 1px solid #e8e8e8;
}

.utm-hint {
    font-size: 0.8rem;
    color: #888;
    margin: 0 0 1rem;
    line-height: 1.5;
}

.utm-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 12px;
}

.utm-grid .links-field:last-child:nth-child(odd) {
    grid-column: 1 / -1;
}

/* UTM preview */
.utm-preview {
    background: #f3f4f6;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 1.1rem;
}

.utm-preview-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #888;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.utm-preview-url {
    font-size: 0.82rem;
    color: #333;
    word-break: break-all;
    font-family: 'Courier New', monospace;
    line-height: 1.5;
}

/* Error */
.links-error {
    background: #fff0f0;
    border: 1px solid #ffc5c5;
    color: #c0392b;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

/* Create button */
.links-create-btn {
    width: 100%;
    justify-content: center;
    font-size: 1rem;
    padding: 13px;
}

/* Success card */
.links-success {
    background: #f0fdf4;
    border: 1.5px solid #86efac;
    border-radius: 14px;
    padding: 1.5rem 1.75rem;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 1.5rem;
}
.links-success[hidden] { display: none; }

.links-success-icon {
    color: #22c55e;
    font-size: 1.6rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.links-success-body {
    flex: 1;
    min-width: 0;
}

.links-success-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #16a34a;
    margin: 0 0 6px;
}

.links-success-url {
    font-size: 1rem;
    font-weight: 700;
    color: #111;
    word-break: break-all;
    margin: 0 0 10px;
}

.links-success-url-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.links-success-open-btn {
    font-size: 0.82rem;
    padding: 6px 12px;
}

.links-another-btn {
    font-size: 0.85rem;
    padding: 7px 14px;
}

/* ── Usage meter ─────────────────────────────────────────────────────────── */

.links-usage-meter {
    margin-bottom: 1rem;
}

.links-usage-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.links-usage-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #666;
}

.links-usage-upgrade {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--primary-color, #fc5c6c);
    text-decoration: none;
}

.links-usage-upgrade:hover { text-decoration: underline; }

.links-usage-track {
    height: 6px;
    background: #eee;
    border-radius: 999px;
    overflow: hidden;
}

.links-usage-bar {
    height: 100%;
    border-radius: 999px;
    transition: width 0.4s ease, background 0.3s;
}

/* Limit banner */
.links-limit-banner[hidden] { display: none; }
.links-limit-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff7ed;
    border: 1.5px solid #fed7aa;
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 0.85rem;
    color: #7c2d12;
    margin-bottom: 1rem;
}

.links-limit-banner i {
    font-size: 1.1rem;
    color: #f97316;
    flex-shrink: 0;
}

.links-limit-banner div { flex: 1; line-height: 1.5; }

.links-limit-upgrade-btn {
    font-size: 0.82rem;
    padding: 8px 14px;
    white-space: nowrap;
    flex-shrink: 0;
    text-decoration: none;
}

/* ── Edit modal ──────────────────────────────────────────────────────────── */

.edit-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.edit-modal-overlay[hidden] { display: none; }

.edit-modal {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.edit-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem 0;
}

.edit-modal-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #111;
    margin: 0;
}

.edit-modal-close {
    background: none;
    border: none;
    font-size: 1rem;
    color: #aaa;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
}

.edit-modal-close:hover { color: #333; background: #f5f5f5; }

.edit-modal-slug-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 1.5rem;
    background: #f8f8f8;
    margin: 1rem 0 0;
    border-top: 1px solid #f0f0f0;
    border-bottom: 1px solid #f0f0f0;
}

.edit-modal-slug-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #999;
    white-space: nowrap;
}

.edit-modal-slug {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--primary-color, #fc5c6c);
    word-break: break-all;
}

.edit-modal-body {
    padding: 1.25rem 1.5rem 1.5rem;
}

.edit-utm-heading {
    font-size: 0.82rem;
    font-weight: 700;
    color: #555;
    margin: 0.5rem 0 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.edit-utm-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0 12px;
}

.edit-save-btn {
    width: 100%;
    justify-content: center;
    margin-top: 0.5rem;
}

/* QR modal */
.qr-modal {
    max-width: 380px;
}

.qr-modal-body {
    padding: 1.25rem 1.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.qr-modal-url {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--primary-color, #fc5c6c);
    word-break: break-all;
    text-align: center;
    margin: 0;
}

.qr-modal-canvas-wrap {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 10px;
    padding: 14px;
    line-height: 0;
}

.qr-modal-canvas-wrap canvas {
    display: block;
    width: 260px;
    height: 260px;
}

.qr-modal-download {
    width: 100%;
    justify-content: center;
    text-decoration: none;
}

/* Stats modal */
.stats-modal { max-width: 480px; }

.stats-modal-body {
    padding: 1.25rem 1.5rem 1.5rem;
}

.stats-upgrade-prompt { margin: 0; }

.stats-period-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 1rem;
    background: #f0f0f4;
    padding: 4px;
    border-radius: 10px;
}

.stats-period-tab {
    flex: 1;
    padding: 8px 4px;
    border: none;
    background: transparent;
    border-radius: 7px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    color: #666;
    transition: background 0.18s, color 0.18s, box-shadow 0.18s;
}

.stats-period-tab:hover { background: #fff; color: var(--primary-color, #fc5c6c); }

.stats-period-tab.active {
    background: #fff;
    color: var(--primary-color, #fc5c6c);
    box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}

.stats-chart-wrap {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 10px;
    padding: 1rem;
}

.stats-empty-state {
    text-align: center;
    font-size: 0.85rem;
    color: #999;
    margin: 0.75rem 0 0;
}

/* Menu link badge + cross-link + replace-PDF field */
.link-row-menu-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--primary-color, #fc5c6c);
    background: rgba(252, 92, 108, 0.1);
    border-radius: 999px;
    padding: 2px 8px;
    vertical-align: middle;
}

.links-menu-crosslink {
    font-size: 0.85rem;
    color: #888;
    margin: 10px 0 0;
}

.links-menu-crosslink a { color: var(--primary-color, #fc5c6c); font-weight: 600; text-decoration: none; }
.links-menu-crosslink a:hover { text-decoration: underline; }

.edit-menu-replace-hint {
    font-size: 0.78rem;
    color: #999;
    margin: 6px 0 0;
}

[data-theme="dark"] .edit-modal { background: #1e1e2a; }
[data-theme="dark"] .edit-modal-title { color: #e8e8f0; }
[data-theme="dark"] .edit-modal-slug-row { background: #161620; border-color: #2e2e3e; }

@media (max-width: 540px) {
    .edit-utm-grid { grid-template-columns: 1fr; }
}

/* Links list */
.links-list-section {
    margin-top: 2rem;
}

.links-list-header {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 1rem;
}

.links-list-header h2 {
    font-size: 1.15rem;
    font-weight: 700;
    color: #111;
    margin: 0;
}

.links-count {
    font-size: 0.8rem;
    color: #999;
}

.links-table-wrap {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Link row card */
.link-row {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    padding: 1rem 1.25rem;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: start;
    gap: 10px;
    transition: box-shadow 0.15s;
}

.link-row:hover {
    box-shadow: 0 3px 12px rgba(0,0,0,0.07);
}

.link-row-left {
    min-width: 0;
}

.link-row-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: #222;
    margin: 0 0 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.link-row-short {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--primary-color, #fc5c6c);
    text-decoration: none;
    margin-bottom: 4px;
}

.link-row-short:hover {
    text-decoration: underline;
}

.link-row-dest {
    font-size: 0.78rem;
    color: #999;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    display: block;
}

.link-row-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.link-row-clicks {
    font-size: 0.8rem;
    font-weight: 600;
    color: #555;
}

.link-row-clicks i {
    color: var(--primary-color, #fc5c6c);
    margin-right: 3px;
}

.link-row-date {
    font-size: 0.78rem;
    color: #bbb;
}

.link-row-utm-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 6px;
}

.utm-tag {
    font-size: 0.72rem;
    font-weight: 600;
    background: #f0f0f0;
    color: #666;
    border-radius: 4px;
    padding: 2px 7px;
}

.link-row-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.links-empty {
    text-align: center;
    padding: 2.5rem 1rem;
    color: #bbb;
    font-size: 0.95rem;
}

.links-empty i {
    display: block;
    font-size: 2rem;
    margin-bottom: 0.75rem;
    color: #ddd;
}

/* Dark mode */
[data-theme="dark"] .links-headline { color: #e8e8f0; }
[data-theme="dark"] .links-sub { color: #888; }
[data-theme="dark"] .links-card { background: #1e1e2a; border-color: #2e2e3e; }
[data-theme="dark"] .links-input { background: #161620; border-color: #2e2e3e; color: #e0e0e8; }
[data-theme="dark"] .utm-toggle { background: #1a1a24; color: #ccc; }
[data-theme="dark"] .utm-fields { border-top-color: #2e2e3e; }
[data-theme="dark"] .utm-preview { background: #1a1a24; border-color: #2e2e3e; }
[data-theme="dark"] .utm-preview-url { color: #ccc; }
[data-theme="dark"] .link-row { background: #1e1e2a; border-color: #2e2e3e; }
[data-theme="dark"] .link-row-title { color: #e0e0e8; }
[data-theme="dark"] .stats-period-tabs { background: #16161f; }
[data-theme="dark"] .stats-period-tab.active { background: #262633; }
[data-theme="dark"] .stats-chart-wrap { background: #fff; }
[data-theme="dark"] .link-row-menu-badge { background: rgba(252, 92, 108, 0.18); }

/* Responsive */
@media (max-width: 540px) {
    .links-card { padding: 1.25rem; }
    .utm-grid { grid-template-columns: 1fr; }
    .utm-grid .links-field:last-child:nth-child(odd) { grid-column: auto; }
}
