/* ============================================================
   SATS Resource Manager – Frontend Styles
   Brand: dark navy header, teal/blue accents (matches sats.org.za)
   ============================================================ */

/* ── Wrapper ─────────────────────────────────────────────── */
.sats-rm-wrapper {
    font-family: inherit;
    max-width: 900px;
    margin: 0 auto;
}

/* ── Search bar  ─────────────────────────────────────────────
   Styled to match Divi 4 form inputs on sats.org.za:
   Open Sans, 52px tall, 2px solid border, no border-radius,
   uppercase tracking on placeholder, accent on focus.
   ──────────────────────────────────────────────────────────── */
.sats-rm-search-wrap {
    position: relative;
    margin-bottom: 28px;
}
.sats-rm-search-wrap svg {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: #1a2640;
    pointer-events: none;
    opacity: .55;
    transition: opacity .2s;
}
.sats-rm-search-wrap:focus-within svg {
    opacity: 1;
    color: #0a7cba;
}
.sats-rm-search {
    width: 100%;
    box-sizing: border-box;
    /* Divi-style: tall, 2px border, zero radius, generous left pad */
    height: 52px;
    padding: 0 52px 0 18px;
    border: 2px solid #c8ccd2;
    border-radius: 0;
    background: #fff;
    font-family: 'Open Sans', sans-serif;
    font-size: 14px;
    font-weight: 400;
    letter-spacing: .04em;
    color: #1a2640;
    outline: none;
    transition: border-color .2s;
    /* Divi uses no box-shadow on inputs — border carries the focus state */
    appearance: none;
    -webkit-appearance: none;
}
.sats-rm-search::placeholder {
    color: #8e949e;
    letter-spacing: .06em;
    text-transform: uppercase;
    font-size: 12px;
    font-weight: 600;
}
.sats-rm-search:focus {
    border-color: #0a7cba;
    background: #fff;
}
.sats-rm-search:hover:not(:focus) {
    border-color: #9da3ac;
}

/* ── Group heading ───────────────────────────────────────── */
.sats-rm-group {
    margin-bottom: 32px;
}
.sats-rm-group-title {
    font-size: 18px;
    font-weight: 700;
    color: #1a2640;
    border-bottom: 2px solid #0a7cba;
    padding-bottom: 6px;
    margin-bottom: 16px;
}

/* ── Grid ────────────────────────────────────────────────── */
.sats-rm-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}
.sats-rm-cols-2 { grid-template-columns: repeat(2, 1fr); }
.sats-rm-cols-3 { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 640px) {
    .sats-rm-cols-2,
    .sats-rm-cols-3 { grid-template-columns: 1fr; }
}

/* ── Item card ───────────────────────────────────────────── */
.sats-rm-item {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #fff;
    border: 1px solid #e4e7eb;
    border-radius: 10px;
    padding: 14px 16px;
    transition: box-shadow .2s, border-color .2s;
}
.sats-rm-item:hover {
    border-color: #0a7cba;
    box-shadow: 0 4px 16px rgba(10,124,186,.12);
}

/* ── File-type icon ──────────────────────────────────────── */
.sats-rm-icon {
    flex-shrink: 0;
    width: 46px;
    height: 54px;
    border-radius: 6px;
    background: #e8f3fb;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sats-rm-icon-pdf  { background: #fde8e8; }
.sats-rm-icon-docx { background: #e8f0fe; }
.sats-rm-icon-xlsx { background: #e8faf0; }
.sats-rm-icon-pptx { background: #fff3e8; }
.sats-rm-icon-zip  { background: #f5f0fe; }
.sats-rm-icon-mp4  { background: #fef9e8; }

.sats-rm-filetype {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .05em;
    color: #0a7cba;
    text-transform: uppercase;
}
.sats-rm-icon-pdf  .sats-rm-filetype { color: #c53030; }
.sats-rm-icon-docx .sats-rm-filetype { color: #2563eb; }
.sats-rm-icon-xlsx .sats-rm-filetype { color: #16a34a; }
.sats-rm-icon-pptx .sats-rm-filetype { color: #ea580c; }
.sats-rm-icon-zip  .sats-rm-filetype { color: #7c3aed; }
.sats-rm-icon-mp4  .sats-rm-filetype { color: #ca8a04; }

/* ── Content ─────────────────────────────────────────────── */
.sats-rm-content {
    flex: 1;
    min-width: 0;
}
.sats-rm-title {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: #1a2640;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sats-rm-count {
    display: block;
    font-size: 12px;
    color: #6b7280;
    margin-top: 2px;
}

/* ── Download button ─────────────────────────────────────── */
.sats-rm-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #0a7cba;
    color: #fff !important;
    text-decoration: none !important;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 600;
    transition: background .2s, transform .1s;
    white-space: nowrap;
}
.sats-rm-btn:hover {
    background: #085f90;
    transform: translateY(-1px);
}
.sats-rm-btn svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

/* ── Anchor / URL ID chip ────────────────────────────────── */
.sats-rm-anchor-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-top: 4px;
    padding: 2px 7px 2px 5px;
    background: #f0f4f8;
    color: #64748b;
    border: 1px solid #e2e8f0;
    border-radius: 99px;
    font-size: 11px;
    font-family: monospace;
    cursor: pointer;
    user-select: none;
    transition: background .15s, color .15s, border-color .15s;
    max-width: fit-content;
}
.sats-rm-anchor-chip:hover {
    background: #e8f3fb;
    color: #0a7cba;
    border-color: #bfdbf0;
}
.sats-rm-anchor-chip svg {
    width: 11px;
    height: 11px;
    flex-shrink: 0;
}

/* ── Highlight pulse when scrolled-to via hash ───────────── */
@keyframes satsRmPulse {
    0%   { box-shadow: 0 0 0 0   rgba(10,124,186,.45); border-color: #0a7cba; background: #e8f3fb; }
    50%  { box-shadow: 0 0 0 8px rgba(10,124,186,.0);  border-color: #0a7cba; background: #e8f3fb; }
    100% { box-shadow: none; border-color: #e4e7eb; background: #fff; }
}
.sats-rm-item.sats-rm-highlight {
    animation: satsRmPulse 2.8s ease forwards;
}

/* ── scroll-margin so sticky headers don't overlap ──────── */
.sats-rm-item[id] {
    scroll-margin-top: 80px;
}

/* ── Empty state ─────────────────────────────────────────── */
.sats-rm-empty {
    color: #6b7280;
    font-style: italic;
}

/* ── Popup / Lightbox Modal ──────────────────────────────── */
.sats-rm-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 16px;
}
.sats-rm-modal {
    background: #fff;
    border-radius: 16px;
    padding: 36px 32px 28px;
    max-width: 480px;
    width: 100%;
    box-shadow: 0 24px 64px rgba(0,0,0,.22);
    position: relative;
    text-align: center;
    animation: satsRmSlideUp .22s ease;
}
@keyframes satsRmSlideUp {
    from { opacity: 0; transform: translateY(18px) scale(.97); }
    to   { opacity: 1; transform: none; }
}
.sats-rm-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #9ca3af;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color .15s, background .15s;
}
.sats-rm-modal-close:hover { color: #1a2640; background: #f3f4f6; }
.sats-rm-modal-close svg  { width: 20px; height: 20px; }

.sats-rm-modal-icon {
    width: 64px;
    height: 64px;
    background: #e8f3fb;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 18px;
}
.sats-rm-modal-icon svg { width: 30px; height: 30px; color: #0a7cba; }

.sats-rm-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: #1a2640;
    margin: 0 0 8px;
}
.sats-rm-modal-filename {
    font-size: 14px;
    color: #4b5563;
    margin: 0 0 24px;
    word-break: break-word;
}
.sats-rm-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}
.sats-rm-btn-ghost {
    display: inline-flex;
    align-items: center;
    padding: 9px 18px;
    background: none;
    color: #4b5563;
    border: 1px solid #d1d5db;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}
.sats-rm-btn-ghost:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

@media (max-width: 420px) {
    .sats-rm-modal { padding: 28px 18px 22px; }
    .sats-rm-modal-actions { flex-direction: column; }
    .sats-rm-btn, .sats-rm-btn-ghost { width: 100%; justify-content: center; }
}
