/* ==========================================================================
   Discount Rules Module Overlay (#79)
   Scoped to .dsr-shell — does NOT alter global selectors.
   Same brand-green pill family as products_services.css.
   ========================================================================== */

.dsr-shell {
    --dsr-radius: 14px;
    --dsr-divider: 1px dashed color-mix(in srgb, var(--brand-green) 22%, transparent);
    --dsr-elev: 0 1px 0 rgba(0,0,0,.04), 0 6px 18px rgba(0,0,0,.04);
    color: var(--text-primary);
}

.dsr-shell .dsr-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.5rem 1rem;
    margin-bottom: 1rem;
    background: var(--surface-1);
    border-radius: var(--dsr-radius);
    box-shadow: var(--dsr-elev);
    border-bottom: var(--dsr-divider);
}
.dsr-shell .dsr-page-header h1 { font-size: 1.4rem; margin: 0 0 .25rem; color: var(--text-primary); }
.dsr-shell .dsr-page-header .dsr-subtitle { font-size: .875rem; color: var(--text-secondary); margin: 0; }

.dsr-shell .dsr-pill {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    background: var(--brand-green);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 7px 18px;
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,.1);
    text-decoration: none;
}
.dsr-shell .dsr-pill:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0,0,0,.15);
    background: color-mix(in srgb, var(--brand-green) 88%, black);
    color: #fff;
}
.dsr-shell .dsr-pill:active { transform: translateY(0); }

.dsr-shell .dsr-card {
    background: var(--surface-1);
    border-radius: var(--dsr-radius);
    box-shadow: var(--dsr-elev);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.dsr-shell .dsr-table-wrap {
    border-radius: var(--dsr-radius);
    overflow: hidden;
    background: var(--surface-1);
    box-shadow: var(--dsr-elev);
}
.dsr-shell .dsr-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 0;
}
.dsr-shell .dsr-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--surface-2, #f1f3f5);
    color: var(--text-secondary);
    font-size: .72rem;
    letter-spacing: .055em;
    text-transform: uppercase;
    font-weight: 700;
    padding: .85rem 1rem;
    border-bottom: 1px solid var(--border-1, #e3e6ea);
    box-shadow: inset 0 -1px 0 rgba(0,0,0,.04);
    text-align: left;
}
.dsr-shell .dsr-table tbody td {
    padding: .85rem 1rem;
    border-bottom: 1px dashed var(--border-1, #eef0f3);
    vertical-align: middle;
    font-size: .9rem;
}
.dsr-shell .dsr-table tbody tr { transition: background .15s ease; }
.dsr-shell .dsr-table tbody tr:hover {
    background: color-mix(in srgb, var(--brand-green) 4%, transparent);
}
.dsr-shell .dsr-table tbody tr:last-child td { border-bottom: none; }

/* Pills */
.dsr-shell .dsr-tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .03em;
    line-height: 1.4;
    white-space: nowrap;
}
.dsr-shell .dsr-tag.is-active   { background: rgba(40,167,69,.12); color: #1e7d34; }
.dsr-shell .dsr-tag.is-inactive { background: rgba(108,117,125,.15); color: #5a6268; }
.dsr-shell .dsr-tag.is-expired  { background: rgba(220,53,69,.14); color: #b02a37; }
.dsr-shell .dsr-tag.is-required { background: rgba(255,193,7,.18); color: #8a6d00; }
.dsr-shell .dsr-tag.is-auto     { background: rgba(13,110,253,.10); color: #0a58ca; }

/* Cross-link to product (Applies To) */
.dsr-shell .dsr-product-link {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    padding: 3px 10px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--brand-green) 10%, transparent);
    color: var(--brand-green);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: .72rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s ease, transform .15s ease;
}
.dsr-shell .dsr-product-link:hover {
    background: color-mix(in srgb, var(--brand-green) 20%, transparent);
    transform: translateY(-1px);
    color: var(--brand-green);
}
.dsr-shell .dsr-product-link.is-all {
    background: rgba(108,117,125,.12);
    color: #5a6268;
    cursor: default;
}
.dsr-shell .dsr-product-link.is-all:hover { transform: none; }

.dsr-shell .dsr-actions {
    display: inline-flex;
    gap: .35rem;
    justify-content: flex-end;
}
.dsr-shell .dsr-icon-btn {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid var(--border-1, #dee2e6);
    background: var(--surface-1);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all .15s ease;
    font-size: .85rem;
}
.dsr-shell .dsr-icon-btn:hover {
    background: var(--brand-green);
    color: #fff;
    border-color: var(--brand-green);
    transform: translateY(-1px);
}
.dsr-shell .dsr-icon-btn.is-danger:hover { background: #dc3545; border-color: #dc3545; }

@media (max-width: 640px) {
    .dsr-shell .dsr-page-header { flex-direction: column; align-items: stretch; }
    .dsr-shell .dsr-table thead th,
    .dsr-shell .dsr-table tbody td { padding: .65rem .6rem; font-size: .82rem; }
}

[data-theme="dark"] .dsr-shell .dsr-table thead th {
    background: rgba(255,255,255,.04);
    color: var(--text-secondary);
}

@media (prefers-reduced-motion: reduce) {
    .dsr-shell .dsr-pill,
    .dsr-shell .dsr-icon-btn,
    .dsr-shell .dsr-product-link,
    .dsr-shell .dsr-table tbody tr { transition: none; }
}

@media print {
    .dsr-shell .dsr-pill,
    .dsr-shell .dsr-actions { display: none !important; }
    .dsr-shell .dsr-table thead th { background: #fff !important; color: #000 !important; }
}

/* ── Apply-Discount-To-Payment modal ─────────────────────────────────────── */
.dsr-apply-list {
    max-height: 420px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: .6rem;
    padding: .25rem;
}
.dsr-apply-row {
    border: 1px solid var(--border-1, #e3e6ea);
    border-radius: 12px;
    padding: .85rem 1rem;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, transform .15s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}
.dsr-apply-row:hover {
    background: color-mix(in srgb, var(--brand-green) 6%, transparent);
    border-color: var(--brand-green);
    transform: translateY(-1px);
}
.dsr-apply-row.is-selected {
    background: color-mix(in srgb, var(--brand-green) 10%, transparent);
    border-color: var(--brand-green);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand-green) 28%, transparent);
}
.dsr-apply-row .dsr-apply-name { font-weight: 600; color: var(--text-primary); }
.dsr-apply-row .dsr-apply-meta { font-size: .76rem; color: var(--text-secondary); margin-top: .2rem; }
.dsr-apply-row .dsr-apply-amt {
    text-align: right;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-weight: 700;
    color: #b02a37;
}
.dsr-apply-row .dsr-apply-final { font-size: .72rem; color: var(--text-secondary); font-weight: 500; }
.dsr-apply-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: .9rem;
}
