/* ─────────────────────────────────────────────────────────────
   PawBack — components added for the Flask app.
   Built only from the tokens in index.css / search.css.
   ───────────────────────────────────────────────────────────── */
body { margin: 0; }
[hidden] { display: none !important; }
img { max-width: 100%; }
button.btn-primary, button.btn-accent, button.btn-outline {
    border: none; cursor: pointer; font-family: 'DM Sans', sans-serif; justify-content: center;
}
button.btn-outline { border: 2px solid var(--border); }
button:disabled { opacity: 0.75; cursor: wait; transform: none !important; }
.btn-block { width: 100%; }
.btn-sm { padding: 0.65rem 1.2rem; font-size: 0.88rem; border-radius: 0.7rem; }
.footer-caret { margin-inline-end: 0.4rem; }
.req { color: var(--accent); }

/* ── Flash messages ── */
.flash-stack {
    position: fixed; top: 84px; left: 50%; transform: translateX(-50%);
    z-index: 1100; display: flex; flex-direction: column; gap: 0.6rem;
    width: min(560px, calc(100% - 2rem));
}
.flash {
    display: flex; align-items: center; gap: 0.75rem;
    background: white; border: 1px solid var(--border); border-radius: 1rem;
    padding: 0.9rem 1.1rem; font-weight: 700; font-size: 0.92rem;
    box-shadow: 0 12px 40px rgba(30,92,72,0.14); animation: fadeUp 0.35s ease both;
}
.flash span { flex: 1; }
.flash-success { color: var(--primary-darker); border-color: rgba(59,158,126,0.35); }
.flash-success > i { color: var(--primary); }
.flash-error { color: #b4441f; border-color: rgba(249,123,79,0.4); background: #fff7f4; }
.flash-error > i { color: var(--accent); }
.flash-close { background: none; border: none; color: inherit; opacity: 0.5; cursor: pointer; font-size: 0.85rem; }
.flash-close:hover { opacity: 1; }

/* ── Panels & forms ── */
.form-shell { max-width: 860px; margin: 0 auto; display: flex; flex-direction: column; gap: 1.5rem; }
.panel {
    background: white; border: 1px solid var(--border); border-radius: 1.5rem;
    padding: 1.75rem; box-shadow: 0 2px 12px var(--shadow);
}
.panel-title {
    font-family: 'Fredoka', sans-serif; font-size: 1.3rem; font-weight: 700; letter-spacing: 0.01em;
    color: var(--text-main); margin: 0 0 1.25rem; display: flex; align-items: center; gap: 0.6rem;
}
.panel-title > i { color: var(--primary); }
.panel-subtitle { font-weight: 800; margin: 1.5rem 0 0.5rem; color: var(--text-main); }
.panel-text { color: var(--text-muted); line-height: 1.7; margin: 0; white-space: pre-line; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem 1.25rem; }
.field { display: flex; flex-direction: column; gap: 0.35rem; }
.field-wide { grid-column: 1 / -1; }
.field .filter-select { width: 100%; }
.input {
    width: 100%; padding: 0.75rem 0.95rem;
    border: 1.5px solid var(--border); border-radius: 0.75rem;
    font-family: 'DM Sans', sans-serif; font-size: 0.92rem; font-weight: 500;
    color: var(--text-main); background: var(--bg-main); outline: none; resize: vertical;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); background: white; }
.input::placeholder { color: #9cad9e; }
.input.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.82rem; }
.field-hint { color: var(--text-muted); font-size: 0.8rem; font-weight: 600; line-height: 1.5; margin: 0.25rem 0 0; }
.field-hint i { color: var(--primary); margin-inline-end: 0.25rem; }
select.filter-select[dir], .rtl .filter-select { background-position: left 0.75rem center; padding: 0.7rem 0.9rem 0.7rem 2rem; }

/* ── Drop zones ── */
.dropzone {
    display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
    border: 2px dashed rgba(59,158,126,0.35); border-radius: 1.25rem;
    background: linear-gradient(135deg, #edf7f3, #f7fbf9);
    padding: 2.25rem 1.5rem; cursor: pointer; position: relative; overflow: hidden;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}
.dropzone:hover, .dropzone.drag { border-color: var(--primary); background: linear-gradient(135deg, #e2f3eb, #f2faf6); }
.dropzone.drag { transform: scale(1.01); }
.dropzone.has-files { padding: 1.25rem; }
.dropzone.has-files .dropzone-icon { display: none; }
.dropzone-icon {
    width: 64px; height: 64px; border-radius: 1rem; background: rgba(59,158,126,0.12);
    display: flex; align-items: center; justify-content: center;
    color: var(--primary); font-size: 1.7rem; margin-bottom: 0.9rem;
}
.dropzone-title { font-weight: 800; color: var(--text-main); }
.dropzone-hint { color: var(--text-muted); font-size: 0.84rem; margin-top: 0.3rem; }
.dropzone.shake { animation: shake 0.4s ease; border-color: var(--accent); }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

.dropzone-empty { display: flex; flex-direction: column; align-items: center; padding: 1.5rem; }
.dropzone-single { height: 260px; padding: 0; margin-bottom: 1.1rem; }
.dropzone-single.has-files { padding: 0; }
.dropzone-single img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.dropzone-single .scan-line { z-index: 2; height: 4px; }

.preview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 0.75rem; margin-top: 1rem; }
.preview-grid:empty { display: none; }
.preview-cell {
    position: relative; aspect-ratio: 1; border-radius: 0.9rem; overflow: hidden;
    border: 1px solid var(--border); box-shadow: 0 2px 10px var(--shadow); animation: fadeUp 0.3s ease both;
}
.preview-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.preview-remove {
    position: absolute; top: 0.4rem; inset-inline-end: 0.4rem; width: 28px; height: 28px;
    border-radius: 50%; border: none; background: rgba(255,255,255,0.92); color: var(--accent);
    cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 0.8rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.preview-cover {
    position: absolute; bottom: 0.4rem; inset-inline-start: 0.4rem;
    background: var(--primary); color: white; font-size: 0.7rem; font-weight: 800;
    padding: 0.15rem 0.5rem; border-radius: 100px;
}

/* ── Map ── */
.map-frame {
    position: relative; border-radius: 1.1rem; overflow: hidden;
    border: 1px solid var(--border); aspect-ratio: 16 / 10; background: #e8f5ef; margin-top: 1rem;
}
.map-frame[hidden] { display: none; }
.panel .map-frame:first-of-type { margin-top: 0; }
.map-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ── Profile ── */
.profile-header { padding-top: 2rem; }
.profile-inner { display: block; }
.back-link {
    display: inline-flex; align-items: center; gap: 0.5rem; margin-bottom: 1.5rem;
    color: var(--primary-dark); font-weight: 700; text-decoration: none; font-size: 0.92rem;
}
.back-link:hover { color: var(--primary-darker); }
.profile-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 3rem; align-items: start; }
.profile-info .listings-page-title { margin-bottom: 0.6rem; }
.gallery-main {
    position: relative; aspect-ratio: 4 / 3; border-radius: 1.75rem; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--border); box-shadow: 0 12px 40px rgba(30,92,72,0.12);
}
.gallery-main img { width: 100%; height: 100%; object-fit: cover; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0.4; } to { opacity: 1; } }
.gallery-icon { font-size: 6rem; opacity: 0.65; }
.gallery-main .pet-browse-tag { top: 1rem; right: 1rem; font-size: 0.85rem; padding: 0.4rem 1rem; }
.gallery-nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 44px; height: 44px; border-radius: 50%; border: none;
    background: rgba(255,255,255,0.92); color: var(--primary-darker); cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12); transition: transform 0.2s ease;
}
.gallery-nav:hover { transform: translateY(-50%) scale(1.08); }
.gallery-prev { left: 1rem; }
.gallery-next { right: 1rem; }
.gallery-thumbs { display: flex; gap: 0.6rem; margin-top: 0.9rem; overflow-x: auto; padding-bottom: 0.25rem; }
.gallery-thumb {
    flex: 0 0 76px; height: 76px; padding: 0; border-radius: 0.8rem; overflow: hidden; cursor: pointer;
    border: 2px solid transparent; background: none; opacity: 0.65; transition: all 0.2s ease;
}
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-thumb.active, .gallery-thumb:hover { opacity: 1; border-color: var(--primary); }

.contact-card {
    margin-top: 1.75rem; background: white; border: 1.5px solid var(--border);
    border-radius: 1.5rem; padding: 1.5rem 1.75rem; box-shadow: 0 8px 30px var(--shadow);
}
.contact-card-lost { border-color: rgba(249,123,79,0.3); }
.contact-card-title {
    font-size: 0.78rem; font-weight: 800; color: var(--text-muted);
    display: flex; align-items: center; gap: 0.5rem;
}
.contact-card-title i { color: var(--primary); }
.contact-card-lost .contact-card-title i { color: var(--accent); }
.contact-name { font-weight: 800; font-size: 1.05rem; margin-top: 0.75rem; }
.contact-phone {
    font-family: 'Fredoka', sans-serif; font-size: 2rem; font-weight: 700;
    color: var(--primary-dark); letter-spacing: 0.02em; margin: 0.15rem 0 1rem; text-align: start;
}
.rtl .contact-phone { text-align: end; }
.contact-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.contact-safety {
    margin: 1.1rem 0 0; font-size: 0.82rem; color: var(--text-muted); line-height: 1.55;
    display: flex; gap: 0.5rem;
}
.contact-safety i { color: var(--primary); margin-top: 3px; }

.profile-body { display: grid; grid-template-columns: 1fr 1fr; gap: 1.75rem; align-items: start; }
.detail-list { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin: 0; }
.detail-list > div { background: var(--bg-main); border: 1px solid var(--border); border-radius: 0.9rem; padding: 0.8rem 1rem; }
.detail-list dt { font-size: 0.75rem; font-weight: 800; color: var(--text-muted); }
.detail-list dd { margin: 0.2rem 0 0; font-weight: 700; color: var(--text-main); }

/* ── Cards: extras ── */
.listing-img { overflow: hidden; }
.listing-photo { width: 100%; height: 100%; object-fit: cover; }
.photo-count {
    position: absolute; bottom: 0.75rem; right: 0.85rem;
    background: rgba(255,255,255,0.9); backdrop-filter: blur(8px);
    color: var(--text-muted); padding: 0.25rem 0.65rem; border-radius: 100px;
    font-size: 0.75rem; font-weight: 700; display: flex; align-items: center; gap: 0.3rem;
}
.match-rank {
    position: absolute; top: 0.85rem; left: 0.85rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white; font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 0.95rem;
    padding: 0.25rem 0.75rem; border-radius: 100px; box-shadow: 0 4px 14px var(--primary-glow);
}
.match-meter { margin-bottom: 0.85rem; }
.match-meter-top { font-size: 0.8rem; font-weight: 800; color: var(--primary-dark); margin-bottom: 0.35rem; }
.match-bar { height: 7px; background: rgba(59,158,126,0.12); border-radius: 4px; overflow: hidden; }
.match-fill {
    height: 100%; border-radius: 4px;
    background: linear-gradient(90deg, var(--primary-light), var(--primary), var(--primary-dark));
    animation: grow 0.9s ease both;
}
@keyframes grow { from { width: 0; } }

.query-thumb {
    display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
    background: white; border: 1px solid var(--border); border-radius: 1.25rem;
    padding: 0.75rem; box-shadow: 0 4px 20px var(--shadow);
    font-size: 0.78rem; font-weight: 800; color: var(--text-muted);
}
.query-thumb img, .query-thumb > i {
    width: 150px; height: 150px; object-fit: cover; border-radius: 0.9rem;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-main); color: var(--primary); font-size: 2.5rem;
}

/* ── AI search page ── */
.ai-hero { min-height: auto; }
.ai-hero .hero-content { max-width: 560px; }
.search-card {
    width: 100%; max-width: 440px; background: white;
    border: 1px solid var(--border); border-radius: 2rem; padding: 1.75rem;
    box-shadow: 0 20px 60px rgba(30,92,72,0.14);
    display: flex; flex-direction: column; gap: 1rem;
    animation: fadeUp 0.8s 0.3s ease both;
}
.search-card > .filter-label { margin-bottom: -0.6rem; }
.tips-panel { margin-top: 2rem; animation: fadeUp 0.7s 0.35s ease both; text-align: start; }
.index-size {
    margin-top: 1rem; padding-top: 0.9rem; border-top: 1px solid var(--border);
    color: var(--text-muted); font-size: 0.84rem; font-weight: 700;
}
.index-size i { color: var(--primary); margin-inline-end: 0.35rem; }
.fee-note {
    display: flex; align-items: center; gap: 0.55rem;
    background: rgba(249,123,79,0.08); border: 1px solid rgba(249,123,79,0.25);
    color: #b4441f; border-radius: 0.85rem; padding: 0.7rem 0.95rem;
    font-size: 0.85rem; font-weight: 700;
}
.fee-free { background: rgba(59,158,126,0.08); border-color: var(--border); color: var(--primary-darker); }

/* ── Status pages ── */
.status-section { min-height: 60vh; display: flex; align-items: center; }
.status-section .cta-inner { width: 100%; }
.status-icon {
    width: 96px; height: 96px; margin: 0 auto 1.5rem; border-radius: 50%;
    background: rgba(59,158,126,0.12); color: var(--primary);
    display: flex; align-items: center; justify-content: center; font-size: 2.4rem;
}
.status-icon-fail { background: rgba(249,123,79,0.12); color: var(--accent); }

/* ── Pagination extras ── */
.pagination-wrap .is-disabled { opacity: 0.4; }
.pagination-wrap .is-gap { border-color: transparent; background: transparent; }
.pagination-wrap [aria-current="page"] { border: none; padding: 0; min-width: 0; background: none; }
.pagination-wrap [aria-current="page"] span { min-width: 40px; }

/* ── RTL (Arabic) ── */
.rtl, .rtl .nav-link, .rtl .cta-btn, .rtl .lang-btn, .rtl .input, .rtl .filter-search, .rtl .filter-select { font-family: 'Tajawal', 'DM Sans', sans-serif; }
.rtl .flip-rtl, .rtl .pet-browse-arrow, .rtl .fa-angle-right { transform: scaleX(-1); }
.rtl .pet-browse-card:hover .pet-browse-arrow { transform: scaleX(-1) translateX(4px); }
.rtl .filter-search { padding: 0.7rem 2.5rem 0.7rem 1rem; }
.rtl .filter-search-icon { left: auto; right: 1rem; }
.rtl .pet-browse-tag, .rtl .gallery-main .pet-browse-tag { right: auto; left: 0.85rem; }
.rtl .match-rank { left: auto; right: 0.85rem; }
.rtl .pet-browse-time { left: auto; right: 0.85rem; }
.rtl .photo-count { right: auto; left: 0.85rem; }
.rtl .footer-links a:hover { padding-left: 0; padding-right: 0.4rem; }
.rtl .ai-floating-badge { right: auto; left: -24px; }
.rtl .cta-btn { margin-left: 0; margin-right: 0.5rem; }
.rtl .lang-switcher { margin-right: 0; margin-left: 0.25rem; }

/* ── Responsive ── */
@media (max-width: 1024px) {
    .profile-grid, .profile-body { grid-template-columns: 1fr; }
    .ai-hero .hero-content { max-width: none; }
    .tips-panel { text-align: start; }
}
@media (max-width: 768px) {
    .form-grid, .detail-list { grid-template-columns: 1fr; }
    .panel { padding: 1.35rem; border-radius: 1.25rem; }
    .contact-phone { font-size: 1.6rem; }
    .flash-stack { top: 76px; }
    .hero-cards { transform: scale(0.85); }
}

/* Small badge icons on card images keep the badge's text size */
.pet-browse-time .fas, .photo-count .fas { font-size: 0.75rem; opacity: 1; color: inherit; transform: none; }

/* Support chat widget */
.chat-launcher {
    position: fixed; bottom: 1.5rem; inset-inline-end: 1.5rem; z-index: 1200;
    display: inline-flex; align-items: center; gap: 0.6rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white; border: none; cursor: pointer;
    font-family: 'DM Sans', sans-serif; font-size: 0.92rem; font-weight: 700;
    padding: 0.9rem 1.35rem; border-radius: 100px;
    box-shadow: 0 10px 30px rgba(59,158,126,0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.chat-launcher:hover { transform: translateY(-2px); box-shadow: 0 14px 38px rgba(59,158,126,0.5); }
.chat-launcher.is-open .chat-launcher-text { display: none; }
.chat-launcher > i { font-size: 1.1rem; }
.chat-badge {
    position: absolute; top: -4px; inset-inline-end: -4px; min-width: 22px; height: 22px;
    background: var(--accent); color: white; border-radius: 100px;
    font-size: 0.72rem; font-weight: 800; display: flex; align-items: center; justify-content: center;
    border: 2px solid white; padding: 0 5px;
}
.chat-panel {
    position: fixed; bottom: 5.5rem; inset-inline-end: 1.5rem; z-index: 1200;
    width: min(360px, calc(100vw - 2rem)); max-height: min(560px, calc(100vh - 8rem));
    background: white; border: 1px solid var(--border); border-radius: 1.5rem;
    box-shadow: 0 24px 70px rgba(30,92,72,0.25);
    display: flex; flex-direction: column; overflow: hidden;
    animation: fadeUp 0.25s ease both;
}
.chat-head {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem;
    padding: 1.1rem 1.25rem;
    background: linear-gradient(135deg, var(--primary-darker) 0%, var(--primary-dark) 100%);
    color: white;
}
.chat-head-title { font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 1.05rem; }
.chat-head-sub { color: rgba(255,255,255,0.7); font-size: 0.78rem; margin-top: 0.2rem; }
.chat-x { background: none; border: none; color: rgba(255,255,255,0.8); cursor: pointer; font-size: 1rem; }
.chat-x:hover { color: white; }
.chat-log {
    flex: 1; overflow-y: auto; padding: 1rem 1.1rem;
    display: flex; flex-direction: column; gap: 0.75rem; background: var(--bg-main);
    min-height: 160px;
}
.chat-empty { color: var(--text-muted); font-size: 0.85rem; line-height: 1.6; margin: auto 0; text-align: center; }
.chat-msg { display: flex; flex-direction: column; gap: 0.2rem; max-width: 85%; }
.chat-msg-visitor { align-self: flex-end; align-items: flex-end; }
.chat-msg-admin { align-self: flex-start; }
.chat-who { font-size: 0.68rem; font-weight: 800; color: var(--text-muted); text-transform: uppercase; }
.chat-bubble {
    padding: 0.6rem 0.9rem; border-radius: 1rem; font-size: 0.88rem; line-height: 1.55;
    white-space: pre-wrap; word-break: break-word;
}
.chat-msg-visitor .chat-bubble { background: var(--primary); color: white; border-end-end-radius: 0.3rem; }
.chat-msg-admin .chat-bubble {
    background: white; color: var(--text-main); border: 1px solid var(--border);
    border-end-start-radius: 0.3rem;
}
.chat-note, .chat-error {
    margin: 0; padding: 0.55rem 1.1rem; font-size: 0.76rem; font-weight: 600; line-height: 1.5;
    border-top: 1px solid var(--border); color: var(--text-muted); background: white;
}
.chat-error { color: #b4441f; background: #fff7f4; }
.chat-form { padding: 0.85rem 1.1rem 1.1rem; border-top: 1px solid var(--border); background: white; }
.chat-name { margin-bottom: 0.5rem; font-size: 0.82rem; padding: 0.5rem 0.7rem; }
.chat-name.is-set { display: none; }
.chat-row { display: flex; align-items: flex-end; gap: 0.5rem; }
.chat-input { resize: none; overflow-y: auto; max-height: 110px; font-size: 0.88rem; }
.chat-send {
    flex: 0 0 42px; height: 42px; border-radius: 50%; border: none; cursor: pointer;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); color: white;
}
.chat-send:hover { filter: brightness(1.05); }
.rtl .chat-send > i { transform: scaleX(-1); }

/* Footer contact rows */
.footer-contact-row {
    display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.5rem;
    color: rgba(255,255,255,0.5); font-size: 0.88rem;
}
.footer-contact-row > i { color: var(--primary-light); width: 14px; }
.footer-contact-row a { color: inherit; text-decoration: none; }
.footer-contact-row a:hover { color: var(--primary-light); }
.footer-phone-placeholder { color: rgba(255,255,255,0.4); display: flex; align-items: center; }

@media (max-width: 480px) {
    .chat-launcher { bottom: 1rem; inset-inline-end: 1rem; padding: 0.85rem 1.1rem; }
    .chat-launcher-text { display: none; }
    .chat-panel { bottom: 4.75rem; inset-inline-end: 1rem; }
}

/* ── Tracking code (search request follow-up) ──────────────────
   Added for the tracking-code feature; uses the same tokens as
   everything above, so it inherits the site's look automatically. */
.track-code-panel { margin-top: 1.5rem; }
.track-code-row {
    display: flex; align-items: center; gap: 0.75rem;
    flex-wrap: wrap; margin-bottom: 0.9rem;
}
.track-code-value {
    flex: 1 1 auto; min-width: 190px;
    font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
    font-size: clamp(1.15rem, 1rem + 1vw, 1.6rem);
    font-weight: 700; letter-spacing: 0.08em; color: var(--primary-dark);
    background: rgba(59, 158, 126, 0.09);
    border: 2px dashed var(--primary-light);
    border-radius: 0.85rem; padding: 0.7rem 1rem; text-align: center;
    user-select: all;
}
.track-code-copy { white-space: nowrap; flex-shrink: 0; }
.track-code-link {
    display: inline-flex; align-items: center; gap: 0.45rem;
    margin-top: 0.35rem; font-weight: 700; font-size: 0.9rem;
    color: var(--primary-dark); text-decoration: none;
}
.track-code-link:hover { text-decoration: underline; }
.track-code-input {
    font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
    font-size: 1.25rem; font-weight: 700; letter-spacing: 0.12em;
    text-align: center; text-transform: uppercase;
}
/* Admin tables show the code inline */
.track-code-inline {
    font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
    font-weight: 700; letter-spacing: 0.04em; white-space: nowrap;
}
