/* Reponje Theme Styles */

/* ── UI Consistency Tokens ───────────────────────────────────────
   Single source of truth for spacing and alignment — both layouts.
   Measured rationale: docs/ui-consistency-audit.md (Phase 1).
   Phase 3 batches converge every page onto these values.

   Edges:  --ui-gutter   screen edge → content (mobile reference: feed)
           --ui-card-pad horizontal padding inside cards
   Vertical scale (replaces ad-hoc 0/15/20/23/35/51 gaps):
           --ui-space-1..5 = 4 / 8 / 12 / 16 / 24
           between cards   = --ui-space-3 (12px, the feed standard)
           between sections = --ui-space-5 (24px)
   Buttons: --ui-btn-gap  8px between independent action buttons.
           Every button row uses this gap — the app has no segmented
           .btn-group controls (a one-off segmented control read as
           inconsistent; decided 2026-08, see ui-consistency-audit.md).
   Desktop columns: --ui-col-main 760px (ALL desktop pages inherit this
           one column from base.html; no per-page width caps).
   ──────────────────────────────────────────────────────────────── */
:root {
    --ui-gutter: 4px;
    --ui-card-pad: 12px;
    --ui-space-1: 4px;
    --ui-space-2: 8px;
    --ui-space-3: 12px;
    --ui-space-4: 16px;
    --ui-space-5: 24px;
    --ui-btn-gap: 8px;
    --ui-col-main: 760px;
    --ui-col-form: 480px;
}

/* ── Bootstrap .row gutter fix (both layouts) ─────────────────────
   Bootstrap >= 5.2 applies half-gutter padding to EVERY direct child
   of .row (not just .col-*); with the default --bs-gutter-x: 1.5rem
   that pushes non-column children (e.g. the feed's .feed-item-wrapper)
   12px off the gutter. Grid columns keep their own padding (mobile.css
   [class*="col-"] rule / scoped resets); non-column children must sit
   flush — the profile page is the reference. */
.row > :not([class*="col"]) {
    padding-left: 0;
    padding-right: 0;
}

/* Form field styling */
.form-control,
.form-select {
    border-color: var(--border-color);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    border-radius: var(--border-radius);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Invalid feedback */
.invalid-feedback {
    display: none;
}

.is-invalid {
    border-color: #dc3545 !important;
}

.is-invalid+.invalid-feedback {
    display: block;
}

/* Card hover effects */
.card {
    border-radius: var(--border-radius);
    transition: box-shadow 0.2s ease;
    overflow: hidden;
}

/* Card children - allow overflow for dropdowns but clip images */
.card-header,
.card-divider,
.card-footer {
    overflow: visible;
}

.card-body {
    overflow: hidden;
}

/* Buttons — rounded corners */
.btn {
    border-radius: var(--border-radius);
}

/* Modal — rounded corners */
.modal-content {
    border-radius: var(--border-radius-lg);
}

/* Dropdown — rounded corners */
.dropdown-menu {
    border-radius: var(--border-radius);
}

/* List group — rounded corners */
.list-group {
    border-radius: var(--border-radius) !important;
    overflow: hidden;
}

/* Pagination — rounded corners */
.page-link {
    border-radius: var(--border-radius);
}

/* Toast — rounded corners */
.toast {
    border-radius: var(--border-radius);
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

/* Button styling */
.btn-primary {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    border-radius: var(--border-radius-pill);
}

.btn-primary:hover {
    background-color: var(--accent-hover);
    border-color: var(--accent-hover);
}

.btn-outline-primary {
    color: var(--accent-color);
    border-color: var(--accent-color);
}

.btn-outline-primary:hover {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: #fff;
}

/* Badge styling */
.badge {
    font-weight: 500;
}

/* Navbar links */
.navbar .nav-link {
    color: var(--text-primary);
}

.navbar .nav-link:hover {
    color: var(--accent-color);
}

/* Alert styling */
.alert {
    border-radius: var(--border-radius);
}

/* Progress bar */
.progress {
    background-color: var(--bg-secondary);
    border-radius: var(--border-radius);
}

.progress-bar {
    background-color: var(--accent-color);
}

/* Text colors */
.text-muted {
    color: var(--text-secondary) !important;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Responsive image */
img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.3s ease;
}

img[loading="lazy"].loaded {
    opacity: 1;
}

/* ── Feed image lightbox ─────────────────────────────────────── */

.feed-image-wrapper {
    cursor: pointer;
    display: flex !important;
    justify-content: center !important;
    width: 100%;
    text-align: center;
    background: var(--bg-secondary, #f0f2f5);
    transition: transform 0.2s ease;
}

.feed-image-wrapper:hover {
    transform: scale(1.02);
}

.feed-image {
    transition: filter 0.2s ease;
}

.feed-image-wrapper:hover .feed-image {
    filter: brightness(0.95);
}

/* Lightbox modal styling */
#imageLightboxModal .modal-content {
    background: transparent;
    border: none;
}

#imageLightboxModal .modal-body {
    background: transparent;
}

#lightboxImage {
    max-width: 100%;
    max-height: 90vh;
    display: block;
    margin: 0 auto;
    border-radius: 8px;
}

/* ── Button group rounded corners ────────────────────────────────────
   Bootstrap's btn-group relies on direct-child selectors (>.btn), but
   our templates wrap some buttons in <form class="d-inline">, breaking
   the chain.  Re-establish proper first/last rounding here.
   Structure example:
     .btn-group > a.btn (first, direct)
     .btn-group > form > button.btn (middle/last, wrapped)
   */

/* Reset all buttons in btn-group to no rounding first */
.btn-group .btn {
    border-radius: 0 !important;
}

/* First interactive element → round LEFT side */
.btn-group>.btn:first-child,
.btn-group>form:first-child .btn,
.btn-group>a:first-child {
    border-top-left-radius: var(--border-radius) !important;
    border-bottom-left-radius: var(--border-radius) !important;
}

/* Last interactive element → round RIGHT side */
.btn-group>.btn:last-child,
.btn-group>form:last-child .btn,
.btn-group>a:last-child {
    border-top-right-radius: var(--border-radius) !important;
    border-bottom-right-radius: var(--border-radius) !important;
}

/* Single-button groups keep full rounding on both sides */
.btn-group>.btn:only-child {
    border-radius: var(--border-radius) !important;
}

/* ── Reaction Picker (Desktop) ───────────────────────────────────── */

.reaction-picker-overlay {
    position: fixed;
    inset: 0;
    z-index: 1040;
    background: transparent;
}

.reaction-picker {
    position: fixed;
    z-index: 1050;
    display: flex;
    background: var(--bg-card, #ffffff);
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: var(--ui-space-2) var(--ui-space-2);
    animation: reaction-picker-pop 0.2s ease-out;
}

@keyframes reaction-picker-pop {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.reaction-picker-row {
    display: flex;
    gap: 4px;
    align-items: center;
}

.reaction-picker-emoji {
    background: none;
    border: none;
    padding: 4px 8px;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    border-radius: 8px;
    transition: transform 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.reaction-picker-emoji:hover {
    transform: scale(1.3);
    background: var(--hover-bg, #f0f0f0);
}

.reaction-emoji {
    display: inline-block;
}

/* Reaction state on desktop like button */
.desktop-eng-btn.like-btn.liked i.bi-heart-fill,
.desktop-eng-btn.like-btn.liked i.bi-hand-thumbs-up-fill,
.desktop-eng-btn.like-btn.liked i.bi-emoji-laughing-fill,
.desktop-eng-btn.like-btn.liked i.bi-emoji-astonished-fill,
.desktop-eng-btn.like-btn.liked i.bi-emoji-dizzy-fill,
.desktop-eng-btn.like-btn.liked i.bi-emoji-angry-fill {
    color: var(--accent-color, #0d6efd);
}

.desktop-eng-btn.like-btn.liked[data-current-reaction="love"] i {
    color: #e74c3c;
}

.desktop-eng-btn.like-btn.liked[data-current-reaction="haha"] i {
    color: #f39c12;
}

.desktop-eng-btn.like-btn.liked[data-current-reaction="wow"] i {
    color: #3498db;
}

.desktop-eng-btn.like-btn.liked[data-current-reaction="sad"] i {
    color: #9b59b6;
}

.desktop-eng-btn.like-btn.liked[data-current-reaction="angry"] i {
    color: #e74c3c;
}

/* Reaction counts bar */
.reaction-counts-bar {
    display: flex;
    align-items: center;
    gap: var(--ui-space-2);
    padding: 4px 0;
    font-size: 12px;
    color: var(--text-muted, #6c757d);
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: opacity 0.2s ease, max-height 0.2s ease;
}

.reaction-counts-bar.reaction-counts-visible {
    opacity: 1;
    max-height: 40px;
}

.reaction-count-item {
    display: inline-flex;
    align-items: center;
    gap: var(--ui-space-1);
}

.reaction-count-item .reaction-emoji {
    font-size: 14px;
}

/* ── Inline Composer (C.1) ─────────────────────────────────────────── */
.inline-composer {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.inline-composer-compact {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.inline-composer-compact:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: -2px;
}

.inline-composer-avatar {
    flex-shrink: 0;
}

.inline-composer-placeholder {
    flex: 1;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border-radius: var(--border-radius-pill);
    padding: var(--ui-space-2) var(--ui-space-4);
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.inline-composer-pencil {
    color: var(--text-secondary);
    flex-shrink: 0;
}

/* The form stays hidden until expanded (in place, desktop) or moved into
   the bottom sheet (mobile-first). */
.inline-composer-form {
    display: none;
    padding: 0.5rem 1rem 1rem;
}

/* Desktop: in-place expansion */
body:not([data-layout="mobile-first"]) .inline-composer.expanded .inline-composer-form {
    display: block;
}

/* Mobile-first: form renders inside the bottom sheet when moved there;
   in-place expansion is only the fallback when BottomSheet is missing. */
body[data-layout="mobile-first"] .mobile-bottom-sheet .inline-composer-form,
body[data-layout="mobile-first"] .inline-composer.expanded .inline-composer-form {
    display: block;
}

.inline-composer-form-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.inline-composer-name {
    font-weight: 600;
    color: var(--text-primary);
}

.inline-composer-textarea {
    border: none;
    box-shadow: none;
    background: transparent;
    resize: none;
    padding: 0.25rem 0;
    font-size: 1rem;
    color: var(--text-primary);
}

.inline-composer-textarea:focus {
    border: none;
    box-shadow: none;
}

.inline-composer-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.inline-composer-preview:empty {
    display: none;
    margin: 0;
}

.inline-composer-preview-item {
    position: relative;
    width: 72px;
    height: 72px;
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.inline-composer-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.inline-composer-preview-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}

.inline-composer-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

.inline-composer-visibility {
    max-width: 150px;
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.inline-composer-post-btn {
    border-radius: var(--border-radius-pill);
}

.inline-composer-cancel-btn {
    color: var(--text-secondary);
    text-decoration: none;
}

.inline-composer-cancel-btn:hover {
    color: var(--text-primary);
}

/* Bottom-sheet variant (mobile-first): moved form gets sheet paddings */
body[data-layout="mobile-first"] .mobile-bottom-sheet .inline-composer-form {
    padding: 0.25rem 0.25rem 0.75rem;
}

/* ── Empty State (applies to BOTH classic + mobile-first layouts) ─────── */

.mobile-empty-state {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--ui-space-5) var(--ui-space-1);
    text-align: center;
}

.mobile-empty-state-paw {
    position: absolute;
    width: 120px;
    height: 100px;
    pointer-events: none;
    z-index: 0;
}

.mobile-empty-state-paw svg {
    width: 100%;
    height: 100%;
}

.mobile-empty-state-icon {
    position: relative;
    z-index: 1;
    font-size: 48px;
    color: var(--text-secondary, #7a7d8e);
    margin-bottom: 16px;
    opacity: 0.5;
}

.mobile-empty-state-illustration {
    position: relative;
    z-index: 1;
    width: 220px;
    max-width: 72%;
    height: auto;
    margin-bottom: 8px;
    filter: drop-shadow(0 10px 16px rgba(93, 78, 55, 0.13));
}

/* Paw brand accent (C.2: paw is brand decoration only — both
   layouts). The partial's SVG uses currentColor, so the wrapper's
   `color` (default: brand accent) themes it. */
.paw-accent {
    display: block;
    width: 15px;
    height: auto;
}

.mobile-empty-state-paw-accent {
    position: relative;
    z-index: 1;
    width: 18px;
    color: var(--accent-color, #E8645A);
    opacity: 0.35;
    margin-bottom: 12px;
}

.mobile-empty-state-paw-accent .paw-accent {
    width: 18px;
}

/* Coral at 0.35 opacity reads near-invisible on dark surfaces */
[data-color-theme="dark"] .mobile-empty-state-paw-accent {
    opacity: 0.55;
}

/* Pet species portrait icons (transparent PNGs, rounded-square crop) */
.pet-species-icon {
    border-radius: 25%;
}

.mobile-empty-state-text {
    position: relative;
    z-index: 1;
    font-size: 15px;
    color: var(--text-secondary, #7a7d8e);
    line-height: 1.5;
    margin-bottom: var(--ui-space-4);
}

.mobile-empty-state-cta {
    position: relative;
    z-index: 1;
    display: inline-block;
    padding: var(--ui-space-2) var(--ui-space-5);
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    background: var(--accent-color, #4f46e5);
    border: none;
    border-radius: 24px;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.mobile-empty-state-cta:hover {
    transform: scale(1.04);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
    color: #fff;
}

.mobile-empty-state-cta:active {
    transform: scale(0.97);
}

/* Secondary CTA (outline variant) */
.mobile-empty-state-cta-secondary {
    background: transparent;
    border: 2px solid var(--accent-color, #0d6efd);
    color: var(--accent-color, #0d6efd);
}

.mobile-empty-state-cta-secondary:hover {
    background: var(--accent-color, #0d6efd);
    color: #fff;
}

.mobile-empty-state-cta-secondary:active {
    transform: scale(0.97);
}

@media (min-width: 768px) {
    .mobile-empty-state-illustration {
        width: 300px;
        max-width: 55%;
    }
}

/* ── Onboarding tutorial illustrations (mobile spotlight + desktop modal) ── */
.onboarding-illustration {
    display: block;
    margin: 0 auto 0.75rem;
    width: 200px;
    max-width: 70%;
    height: auto;
    filter: drop-shadow(0 10px 16px rgba(93, 78, 55, 0.13));
}

.onboarding-illustration-desktop {
    width: 280px;
    max-width: 75%;
    margin-bottom: 0;
    filter: drop-shadow(0 10px 16px rgba(93, 78, 55, 0.13));
}

/* ── Verification pending page illustration ── */
.verification-pending-illustration {
    display: block;
    margin: 0 auto 1rem;
    width: 240px;
    max-width: 70%;
    height: auto;
    filter: drop-shadow(0 10px 16px rgba(93, 78, 55, 0.13));
}

/* ── Micro-animations (D.1) ──────────────────────────────────────────
   Shared by BOTH layouts (mobile.css only loads in mobile-first).
   All animations are disabled when the user prefers reduced motion.
   Badge bounce uses the independent `scale` property so it composes
   with existing `transform`s (e.g. .mobile-nav-badge translateX).
*/
@media (prefers-reduced-motion: no-preference) {
    @keyframes fadeInUp {
        from { opacity: 0; transform: translateY(12px); }
        to { opacity: 1; transform: translateY(0); }
    }

    @keyframes badgeBounce {
        0%, 100% { scale: 1; }
        50% { scale: 1.3; }
    }

    @keyframes shimmer {
        0% { background-position: -200% 0; }
        100% { background-position: 200% 0; }
    }

    /* List item appear (infinite scroll / pull-to-refresh) */
    .feed-item-animate {
        animation: fadeInUp 0.3s ease-out both;
    }

    /* Badge bounce when a new message/notification arrives */
    .badge-bounce {
        animation: badgeBounce 0.4s ease-out;
    }

    /* Skeleton loading shimmer (shared with .mobile-skeleton) */
    .skeleton-shimmer {
        background: linear-gradient(90deg, var(--bg-secondary, #f0f0f0) 25%, var(--border-color, #e0e0e0) 50%, var(--bg-secondary, #f0f0f0) 75%);
        background-size: 200% 100%;
        animation: shimmer 1.5s infinite;
    }

    /* Button press feedback (extends the mobile-only .btn:active to both layouts) */
    .btn:active,
    button:active,
    [role="button"]:active {
        transform: scale(0.96);
    }
}

/* ── Toast container must be click-through ──────────────────────────
   #toast-container is a permanent, transparent, fixed strip above the
   mobile bottom nav (full width via mobile.css left/right: 8px). Left at
   the default pointer-events: auto, the empty container absorbs every
   tap landing in that band — e.g. the lower half of the FAB and feed
   action buttons (like/reply/share/save) when scrolled into the band.
   The container passes clicks through; actual toasts re-enable them. */
#toast-container {
    pointer-events: none;
}

#toast-container .toast {
    pointer-events: auto;
}

