/* ============================================================
   WayToB Safari Animal Guide — style.css v1.0.0
   Prefix: wsg-
   ============================================================ */
.wsg-wrap *, .wsg-wrap *::before, .wsg-wrap *::after { box-sizing: border-box; }
.wsg-wrap {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    font-size: 14px; color: #1a1a2e; line-height: 1.5;
    max-width: 860px; margin: 0 auto 40px;
    border: 1px solid #e5e7eb; border-radius: 16px;
    overflow: hidden; background: #fff;
}

/* ─── Header ─── */
.wsg-header {
    background: #0d1f3c; padding: 18px 22px;
    display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.wsg-header-left { display: flex; align-items: center; gap: 14px; }
.wsg-header-icon { font-size: 36px; line-height: 1; flex-shrink: 0; }
.wsg-header h2 { font-size: 17px !important; font-weight: 700 !important; color: #fff !important; margin: 0 0 3px !important; padding: 0 !important; border: none !important; line-height: 1.2 !important; }
.wsg-header p  { font-size: 12px; color: #7da8c0; margin: 0; }
.wsg-search-box { position: relative; flex-shrink: 0; }
.wsg-search-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); font-size: 14px; pointer-events: none; }
.wsg-search { padding: 9px 14px 9px 34px; border: 1.5px solid #2a4a6b; border-radius: 8px; background: #162d4a; color: #fff; font-size: 13px; outline: none; width: 200px; transition: border-color 0.15s; }
.wsg-search::placeholder { color: #5a7a90; }
.wsg-search:focus { border-color: #239e8a; }

/* ─── Filters ─── */
.wsg-filters { display: flex; gap: 8px; flex-wrap: wrap; padding: 14px 18px; border-bottom: 1px solid #f3f4f6; background: #fafafa; }
.wsg-filter {
    font-size: 12px; font-weight: 600; padding: 6px 14px; border-radius: 20px;
    border: 1.5px solid #e5e7eb; background: #fff; color: #374151;
    cursor: pointer; white-space: nowrap; transition: all 0.15s; user-select: none;
}
.wsg-filter:hover   { border-color: #239e8a; background: #e8f7f5; color: #0d5c52; }
.wsg-filter-active  { border-color: #0d1f3c !important; background: #0d1f3c !important; color: #fff !important; }

/* ─── Count bar ─── */
.wsg-count-bar { display: flex; align-items: center; justify-content: space-between; padding: 9px 18px; border-bottom: 1px solid #f3f4f6; flex-wrap: wrap; gap: 8px; }
.wsg-count { font-size: 12px; color: #6b7280; font-weight: 600; }
.wsg-legend { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.wsg-lgnd { font-size: 10px; font-weight: 800; padding: 2px 7px; border-radius: 4px; letter-spacing: 0.3px; }
.wsg-lgnd-label { font-size: 11px; color: #9ca3af; }
.wsg-cr { background: #fee2e2; color: #991b1b; }
.wsg-en { background: #ffedd5; color: #9a3412; }
.wsg-vu { background: #fef9c3; color: #854d0e; }
.wsg-nt { background: #dcfce7; color: #166534; }
.wsg-lc { background: #d1fae5; color: #065f46; }

/* ─── Grid ─── */
.wsg-grid {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 14px; padding: 16px 18px;
}

/* ─── Animal Card ─── */
.wsg-card {
    border: 1.5px solid #e5e7eb; border-radius: 12px; overflow: hidden;
    background: #fff; transition: box-shadow 0.2s, border-color 0.2s;
    display: flex; flex-direction: column;
}
.wsg-card:hover { border-color: #c5d5e8; box-shadow: 0 4px 16px rgba(0,0,0,0.08); }

/* Card top */
.wsg-card-top { padding: 14px 14px 10px; display: flex; flex-direction: column; align-items: center; gap: 8px; position: relative; }
.wsg-badge-wrap { position: absolute; top: 10px; right: 10px; }

/* Emoji circle */
.wsg-emoji-circle {
    width: 64px; height: 64px; border-radius: 50%; display: flex;
    align-items: center; justify-content: center; font-size: 34px; line-height: 1;
    flex-shrink: 0;
}
.wsg-bg-big-cats   { background: #fff3ee; }
.wsg-bg-elephants  { background: #eef2f8; }
.wsg-bg-primates   { background: #ecfdf5; }
.wsg-bg-plains-game{ background: #fefce8; }
.wsg-bg-predators  { background: #fff7ed; }
.wsg-bg-birds      { background: #eff6ff; }

/* Names */
.wsg-card-names { text-align: center; }
.wsg-name { font-size: 13px; font-weight: 700; color: #0d1f3c; margin-bottom: 2px; line-height: 1.2; }
.wsg-sci  { font-size: 10px; color: #9ca3af; font-style: italic; }

/* Status badge */
.wsg-badge { font-size: 10px; font-weight: 800; padding: 2px 8px; border-radius: 4px; letter-spacing: 0.3px; white-space: nowrap; }
.wsg-badge.wsg-cr { background: #fee2e2; color: #991b1b; }
.wsg-badge.wsg-en { background: #ffedd5; color: #9a3412; }
.wsg-badge.wsg-vu { background: #fef9c3; color: #854d0e; }
.wsg-badge.wsg-nt { background: #dcfce7; color: #166534; }
.wsg-badge.wsg-lc { background: #d1fae5; color: #065f46; }

/* Category tag */
.wsg-cat-tag { font-size: 10px; font-weight: 600; color: #6b7280; background: #f3f4f6; border-radius: 4px; padding: 2px 7px; }

/* Stats */
.wsg-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: #f3f4f6; border-top: 1px solid #f3f4f6; }
.wsg-stat  { background: #fff; padding: 7px 10px; display: flex; flex-direction: column; gap: 2px; }
.wsg-stat-l{ font-size: 9px; color: #9ca3af; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; display: flex; align-items: center; gap: 3px; }
.wsg-stat-v{ font-size: 11px; color: #1a1a2e; font-weight: 600; line-height: 1.2; }

/* View button */
.wsg-view-btn {
    width: 100%; padding: 9px; font-size: 12px; font-weight: 700;
    background: #f9fafb; border: none; border-top: 1px solid #f3f4f6;
    color: #374151; cursor: pointer; transition: background 0.15s, color 0.15s;
    display: flex; align-items: center; justify-content: center; gap: 6px;
}
.wsg-view-btn:hover { background: #e8f7f5; color: #0d5c52; }
.wsg-view-btn.wsg-open { background: #0d1f3c; color: #fff; }
.wsg-view-btn.wsg-open:hover { background: #162d50; }
.wsg-view-arrow { font-style: normal; display: inline-block; transition: transform 0.2s; }
.wsg-view-btn.wsg-open .wsg-view-arrow { transform: rotate(180deg); }

/* ─── Details panel ─── */
.wsg-details {
    max-height: 0; overflow: hidden; opacity: 0;
    transition: max-height 0.36s ease, opacity 0.25s ease;
    border-top: 2px solid #0d1f3c;
}
.wsg-details.wsg-open { opacity: 1; /* max-height set by JS */ }

.wsg-det-inner { padding: 14px; }
.wsg-det-desc { font-size: 12px; color: #374151; line-height: 1.7; margin-bottom: 12px; }

.wsg-det-section { margin-bottom: 12px; }
.wsg-det-title { font-size: 10px; font-weight: 700; color: #9ca3af; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.wsg-det-diet  { font-size: 12px; color: #374151; background: #f9fafb; border-radius: 6px; padding: 8px 10px; border-left: 3px solid #239e8a; }

.wsg-facts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.wsg-facts li { font-size: 11px; color: #374151; padding: 7px 10px 7px 28px; background: #f9fafb; border-radius: 6px; position: relative; line-height: 1.5; }
.wsg-facts li::before { content: '✦'; position: absolute; left: 9px; color: #239e8a; font-size: 9px; top: 9px; }

.wsg-best-places { display: flex; flex-wrap: wrap; gap: 6px; }
.wsg-place { font-size: 11px; font-weight: 600; padding: 4px 10px; background: #eef2f8; color: #0d1f3c; border-radius: 6px; border: 1px solid #d0dae8; display: flex; align-items: center; gap: 4px; }
.wsg-place::before { content: '📍'; font-size: 10px; }

.wsg-waytob-link { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; color: #0d5c52; background: #e8f7f5; border: 1.5px solid #99e8de; border-radius: 8px; padding: 7px 12px; margin-top: 10px; text-decoration: none; cursor: pointer; transition: background 0.15s; }
.wsg-waytob-link:hover { background: #d1f5ef; }

/* ─── Empty state ─── */
.wsg-empty { text-align: center; padding: 48px 24px; }
.wsg-empty-icon  { font-size: 40px; margin-bottom: 12px; }
.wsg-empty-title { font-size: 15px; font-weight: 700; color: #0d1f3c; margin-bottom: 6px; }
.wsg-empty-sub   { font-size: 13px; color: #6b7280; }

/* ─── Responsive ─── */
@media (max-width: 640px) {
    .wsg-header { padding: 14px 16px; flex-direction: column; align-items: flex-start; gap: 10px; }
    .wsg-search { width: 100%; }
    .wsg-search-box { width: 100%; }
    .wsg-filters { padding: 10px 14px; }
    .wsg-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 12px 14px; }
    .wsg-emoji-circle { width: 52px; height: 52px; font-size: 28px; }
    .wsg-count-bar { padding: 8px 14px; }
    .wsg-legend { display: none; }
}
@media (max-width: 360px) {
    .wsg-grid { grid-template-columns: 1fr; }
}

/* ─── Print ─── */
@media print {
    .wsg-header { background: #0d1f3c !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .wsg-filters, .wsg-count-bar, .wsg-view-btn { display: none !important; }
    .wsg-details { max-height: none !important; opacity: 1 !important; display: block !important; }
    .wsg-card { break-inside: avoid; }
}
