/* =========================================================================
   Fishing Buddies - "water" blue theme
   Bootstrap 5 base + custom deep-blue palette (inspired by ftr's #012F51).
   ========================================================================= */

:root {
    --fb-deep:   #012F51;   /* deep water */
    --fb-main:   #0b6fd6;   /* primary action blue */
    --fb-main-2: #0a5fb8;
    --fb-light:  #cfe8ff;   /* surface highlight */
    --fb-foam:   #e8f4ff;   /* near-white */
    --fb-sand:   #f5f9ff;   /* page surface */
    --fb-text:   #14314a;
    --fb-muted:  #4d6680;   /* darkened from #6b86a0 for WCAG AA contrast */
}

/* ---- Bootstrap primary override -> water blue --------------------------- */
.btn-primary,
.btn-primary:focus {
    --bs-btn-bg: var(--fb-main);
    --bs-btn-border-color: var(--fb-main);
    --bs-btn-hover-bg: var(--fb-main-2);
    --bs-btn-hover-border-color: var(--fb-main-2);
    --bs-btn-active-bg: var(--fb-main-2);
    --bs-btn-active-border-color: var(--fb-main-2);
    --bs-btn-disabled-bg: var(--fb-main);
    --bs-btn-disabled-border-color: var(--fb-main);
}
.btn-outline-primary {
    --bs-btn-color: var(--fb-main);
    --bs-btn-border-color: var(--fb-main);
    --bs-btn-hover-bg: var(--fb-main);
    --bs-btn-hover-border-color: var(--fb-main);
    --bs-btn-active-bg: var(--fb-main);
    --bs-btn-active-border-color: var(--fb-main);
}
a { color: var(--fb-main); }
a:hover { color: var(--fb-main-2); }
.text-primary { color: var(--fb-main) !important; }
.bg-primary { background-color: var(--fb-main) !important; }
.form-control:focus,
.form-select:focus {
    border-color: var(--fb-main);
    box-shadow: 0 0 0 .2rem rgba(11, 111, 214, .25);
}

/* ---- Page layout ------------------------------------------------------- */
html, body { height: 100%; }
.fb-page { min-height: 100vh; display: flex; flex-direction: column; }
.fb-body {
    background: linear-gradient(180deg, var(--fb-sand) 0%, #eef6ff 100%);
    color: var(--fb-text);
    font-size: .95rem;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
.fb-main { flex: 1 0 auto; padding-bottom: 2rem; }

/* Decorative wave band under the navbar */
.fb-waves {
    height: 6px;
    background: linear-gradient(90deg,
        var(--fb-main) 0%,
        #3aa0ff 30%,
        #7fc1ff 50%,
        #3aa0ff 70%,
        var(--fb-main) 100%);
    background-size: 200% 100%;
    animation: fb-wave 8s linear infinite;
}
@keyframes fb-wave {
    0%   { background-position: 0% 0; }
    100% { background-position: 200% 0; }
}

/* ---- Navbar ------------------------------------------------------------ */
.fb-navbar {
    background: var(--fb-deep);
    backdrop-filter: blur(4px);
}
.fb-navbar .navbar-brand,
.fb-navbar .nav-link,
.fb-navbar .navbar-toggler-icon { color: #eaf4ff; }
.fb-navbar .nav-link:hover { color: #fff; }
.fb-navbar .nav-link.active { color: #fff; font-weight: 600; }
.fb-navbar .nav-link:focus-visible,
.fb-navbar .navbar-brand:focus-visible,
.fb-navbar .navbar-toggler:focus-visible {
    outline: 2px solid rgba(255,255,255,.6);
    outline-offset: 2px;
    box-shadow: none;
}
.fb-navbar .navbar-toggler { border-color: rgba(255,255,255,.3); }
.fb-logo { font-size: 1.4rem; line-height: 1; }
.fb-badge {
    background: #ff7a59;
    color: #fff;
    vertical-align: middle;
    margin-left: .25rem;
}

/* Small circular initials avatar */
.fb-avatar-sm,
.fb-avatar-md,
.fb-avatar-lg {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--fb-main);
    color: #fff;
    font-weight: 600;
    flex: 0 0 auto;
    overflow: hidden;
}
.fb-avatar-sm { width: 30px; height: 30px; font-size: .75rem; }
.fb-avatar-md { width: 44px; height: 44px; font-size: 1rem; }
.fb-avatar-lg { width: 80px; height: 80px; font-size: 1.8rem; }
.fb-avatar-sm img,
.fb-avatar-md img,
.fb-avatar-lg img { width: 100%; height: 100%; object-fit: cover; }

/* ---- Hero -------------------------------------------------------------- */
.fb-hero {
    background: linear-gradient(135deg, var(--fb-deep) 0%, var(--fb-main) 100%);
    color: #fff;
    border-radius: 1rem;
    overflow: hidden;
    position: relative;
}
.fb-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle at 80% 20%, rgba(255,255,255,.18), transparent 40%),
                      radial-gradient(circle at 10% 90%, rgba(255,255,255,.12), transparent 35%);
    pointer-events: none;
}
.fb-hero h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); }
.fb-hero .btn { position: relative; z-index: 1; }

/* ---- Cards ------------------------------------------------------------- */
.fb-card {
    border: none;
    border-radius: 1rem;
    box-shadow: 0 6px 20px rgba(1, 47, 81, .08);
    overflow: hidden;
    transition: transform .15s ease, box-shadow .15s ease;
}
.fb-card:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(1, 47, 81, .14); }
.fb-card .card-img-top {
    object-fit: cover;
    max-height: 360px;
    background: var(--fb-light);
}
.fb-card-img-wrap { background: var(--fb-light); }
.fb-clickable-card { cursor: pointer; }
.fb-comment-body p { margin-bottom: 0; }
.fb-meta { color: var(--fb-muted); font-size: .82rem; }
.fb-chip {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    background: var(--fb-light);
    color: var(--fb-deep);
    border-radius: 999px;
    padding: .15rem .6rem;
    font-size: .75rem;
    font-weight: 500;
}

/* ---- Buddy list -------------------------------------------------------- */
.fb-buddy {
    display: flex;
    align-items: center;
    gap: .9rem;
    padding: .9rem 1rem;
    border-radius: 1rem;
    background: #fff;
    box-shadow: 0 4px 14px rgba(1, 47, 81, .06);
    transition: transform .15s ease;
}
.fb-buddy:hover { transform: translateY(-1px); }
.fb-buddy .dist { color: var(--fb-main); font-weight: 600; }
.fb-online-dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: #999; display: inline-block;
}
.fb-online-dot.online { background: #29c46a; box-shadow: 0 0 0 3px rgba(41,196,106,.2); }

/* ---- Chat -------------------------------------------------------------- */
.fb-chat {
    height: 60vh;
    min-height: 360px;
    display: flex;
    flex-direction: column;
    border-radius: 1rem;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 6px 20px rgba(1, 47, 81, .08);
}
.fb-chat-msgs {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 1rem;
    background:
      linear-gradient(180deg, var(--fb-foam), #fff 120px);
}
.fb-bubble {
    max-width: 78%;
    padding: .5rem .85rem;
    border-radius: 1rem;
    margin-bottom: .5rem;
    word-wrap: break-word;
    font-size: .92rem;
}
.fb-bubble.them { background: #eef4fb; color: var(--fb-text); border-bottom-left-radius: .25rem; }
.fb-bubble.me   { background: var(--fb-main); color: #fff; border-bottom-right-radius: .25rem; margin-left: auto; }
.fb-bubble .t   { font-size: .7rem; opacity: .7; display: block; margin-top: .15rem; }

/* ---- Forms ------------------------------------------------------------- */
.fb-form-card { border: none; border-radius: 1rem; box-shadow: 0 6px 20px rgba(1,47,81,.08); }
.fb-form-card .card-header {
    background: var(--fb-deep);
    color: #fff;
    border-radius: 1rem 1rem 0 0 !important;
    font-weight: 600;
}
.fb-img-preview {
    max-width: 100%;
    max-height: 240px;
    border-radius: .6rem;
    border: 1px solid var(--fb-light);
}

/* ---- Footer ------------------------------------------------------------ */
.fb-footer {
    background: var(--fb-deep);
    color: #fff;
    flex-shrink: 0;
}

/* ---- Utilities --------------------------------------------------------- */
.cursor-pointer { cursor: pointer; }

/* Formatting toolbar for post editor */
.fb-format-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.fb-format-bar .btn {
    padding: 2px 8px;
    font-size: .85rem;
    line-height: 1.4;
}
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--fb-muted);
}
.empty-state .ico { font-size: 3rem; opacity: .6; }
.text-water { color: var(--fb-main) !important; }
.fw-medium { font-weight: 500; }

/* Reply quote blocks (from [re]...[/re] in comments) */
.fb-quote {
    border-left: 3px solid var(--fb-muted);
    background: var(--fb-foam);
    padding: .4rem .6rem;
    margin-bottom: .4rem;
    border-radius: 0 .4rem .4rem 0;
}
.fb-quote cite {
    display: block;
    font-style: normal;
    font-size: .85rem;
    color: var(--fb-muted);
    word-break: break-word;
}

/* Toast container (top-right, stacks) */
#fb-toasts {
    position: fixed; top: 1rem; right: 1rem; z-index: 1080;
    display: flex; flex-direction: column; gap: .5rem; max-width: 92vw;
}
.fb-toast {
    background: #fff; border-radius: .6rem; padding: .7rem 1rem;
    box-shadow: 0 8px 24px rgba(0,0,0,.18); border-left: 4px solid var(--fb-main);
    font-size: .9rem; min-width: 240px; animation: fb-slidein .25s ease;
}
.fb-toast.error { border-left-color: #d9534f; }
.fb-toast.success { border-left-color: #29c46a; }
@keyframes fb-slidein { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Post composer map/geo pill */
.geo-pill {
    display: inline-flex; align-items: center; gap: .35rem;
    background: var(--fb-light); color: var(--fb-deep);
    border-radius: 999px; padding: .25rem .7rem; font-size: .8rem;
}

/* YouTube responsive video embed */
.fb-video-embed {
    position: relative;
    width: 100%;
    max-width: 480px;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: .6rem;
}
.fb-video-embed iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border: none;
}

/* Featured (top) post card - horizontal layout */
.fb-featured-card {
    display: flex;
    flex-direction: row;
    overflow: hidden;
}
.fb-featured-card .fb-card-img-wrap {
    flex: 0 0 140px;
    max-height: 140px;
    overflow: hidden;
}
.fb-featured-card .fb-card-img-wrap img,
.fb-featured-card .fb-card-img-wrap a {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.fb-featured-card .card-body {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    padding: .75rem 1rem;
}
.fb-featured-card .card-text {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
/* Allow video embeds to show fully inside featured card */
.fb-featured-card .fb-video-embed {
    max-width: 280px;
    margin-top: .5rem;
    margin-bottom: .25rem;
}

/* Compact feed card thumbnail */
.fb-card-img-thumb {
    flex: 0 0 80px;
    width: 80px;
    height: 80px;
    overflow: hidden;
    border-radius: .5rem;
    background: var(--fb-light);
}
.fb-card-img-thumb img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
}

/* Compact card - horizontal row layout */
.fb-compact-card {
    display: flex;
    flex-direction: row;
    overflow: hidden;
}
.fb-compact-card .fb-card-img-wrap {
    flex: 0 0 80px;
    max-height: 100px;
    overflow: hidden;
}
.fb-compact-card .fb-card-img-wrap img,
.fb-compact-card .fb-card-img-wrap a {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.fb-compact-card .card-body {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    padding: .75rem 1rem;
}
.fb-compact-card .card-text {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.fb-compact-card .fb-video-embed {
    max-width: 220px;
    margin-top: .25rem;
}

/* Sort bar */
.fb-sort-bar {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
}
.fb-sort-bar .btn {
    font-size: .82rem;
    padding: .25rem .6rem;
}

/* Like button */
.fb-like-btn {
    cursor: pointer;
    font-size: .85rem;
    color: var(--fb-muted);
    transition: color .15s;
    background: none;
    border: none;
    padding: 0;
}
.fb-like-btn:hover,
.fb-like-btn.liked {
    color: #e53e3e;
}
.fb-like-btn .count {
    margin-left: .2rem;
}

/* Conversation list */
.fb-conv-list {
    overflow-y: auto;
    max-height: 70vh;
}
.fb-conv-item {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .6rem .75rem;
    border-bottom: 1px solid var(--fb-foam);
    cursor: pointer;
    transition: background .15s;
}
.fb-conv-item:hover,
.fb-conv-item.active {
    background: var(--fb-foam);
}
.fb-conv-item .conv-preview {
    flex: 1;
    min-width: 0;
}
.fb-conv-item .conv-name {
    font-weight: 500;
    font-size: .9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fb-conv-item .conv-last {
    font-size: .8rem;
    color: var(--fb-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fb-conv-item .conv-time {
    font-size: .72rem;
    color: var(--fb-muted);
    white-space: nowrap;
}
.fb-conv-item .conv-unread {
    background: #ff7a59;
    color: #fff;
    font-size: .7rem;
    padding: .1rem .4rem;
    border-radius: 999px;
    min-width: 1.2rem;
    text-align: center;
}

/* Cookie consent banner */
.fb-cookie-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1060;
    background: var(--fb-deep);
    color: #fff;
    padding: .75rem 1rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: .75rem;
    font-size: .88rem;
    box-shadow: 0 -4px 16px rgba(0,0,0,.15);
}
.fb-cookie-bar a { color: var(--fb-light); }

/* Radius slider */
.fb-radius-wrap {
    display: flex;
    align-items: center;
    gap: .75rem;
}
.fb-radius-wrap input[type=range] {
    width: 180px;
    accent-color: var(--fb-main);
}
.fb-radius-label {
    min-width: 60px;
    text-align: center;
    font-weight: 600;
    color: var(--fb-main);
}

/* ---- Mobile responsive overrides --------------------------------------- */
@media (max-width: 767px) {
    .fb-featured-card {
        flex-direction: column;
        max-height: none;
    }
    .fb-featured-card .fb-card-img-wrap {
        flex: 0 0 auto;
        max-height: 180px;
    }
    .fb-sort-bar .btn { font-size: .82rem; padding: .35rem .6rem; }

    /* Mobile messages: single-panel list/chat navigation */
    .fb-messages-layout .fb-conv-col { display: block; }
    .fb-messages-layout .fb-chat-col { display: none; }
    .fb-messages-layout.chat-open .fb-conv-col { display: none; }
    .fb-messages-layout.chat-open .fb-chat-col { display: block; }
    .fb-chat-back { display: inline-flex !important; }

    /* Cookie bar: more padding on mobile so footer is visible */
    body:has(.fb-cookie-bar) .fb-footer { padding-bottom: 80px; }
}

/* Desktop: hide the mobile back button, always show both panels */
@media (min-width: 768px) {
    .fb-chat-back { display: none !important; }
}

/* ---- Cookie bar: offset footer so content isn't hidden ------------------- */
body:has(.fb-cookie-bar) .fb-footer { padding-bottom: 60px; }

/* ---- Accessibility: reduced motion -------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .fb-waves { animation: none; }
    .fb-toast { animation: none; }
    .fb-buddy, .fb-conv-item, .fb-like-btn, .card { transition: none; }
    * { scroll-behavior: auto; }
}

/* ---- Larger touch targets for format toolbar ----------------------------- */
.fb-format-bar .btn {
    padding: 4px 12px;
    min-height: 32px;
}

/* ---- Chat header name truncation ----------------------------------------- */
#chatHeader .flex-grow-1 { min-width: 0; }
#chatPeerName {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}
