﻿/* ===== FRIENDS PAGE STYLING ===== */

/* Title wrapper — mirror Account page spacing/scale */
.friends-wrap {
    max-width: 720px;
    margin: 24px auto 64px;
    padding: 0 16px;
    font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

    .friends-wrap h1 {
        font-size: 2.5rem;
        font-weight: 700;
        margin: 18px 0 1.75rem;
    }

/* Keep existing friends-page card styles for inner sections */
.friends-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 1rem 2rem;
    font-family: "Helvetica Neue", Arial, sans-serif;
    color: #181d27;
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    color: #181d27;
    margin: 0;
}

/* Section headings */
.friends-page section {
    margin-bottom: 2.5rem;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.friends-page h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.75rem;
    color: #1f2937;
    text-align: left;
}

/* Search */
.find-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

    .find-row .input {
        flex: 1;
        padding: 0.6rem 0.8rem;
        border: 1px solid #ccc;
        border-radius: 8px;
    }

    .find-row .btn {
        background-color: #77dd77;
        color: #fff;
        border: none;
        border-radius: 8px;
        padding: 0.6rem 1rem;
        cursor: pointer;
        font-weight: 600;
    }

        .find-row .btn:disabled {
            opacity: 0.6;
            cursor: not-allowed;
        }

/* Lists */
.list-group {
    list-style: none;
    padding: 0;
    margin: 0;
}

.list-group-item {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    margin-bottom: 0.5rem;
    padding: 0.8rem 1rem;
    background: #fafafa;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Left column layout (basic) */
.row-main {
    display: flex;
    align-items: center;
    gap: 10px;
}

    .row-main strong {
        display: block;
        font-size: 1rem;
        color: #111827;
    }

    .row-main small {
        color: #6b7280;
        font-size: 0.85rem;
    }

/* Right column (actions) */
.row-actions .btn {
    background: #e5e7eb;
    border: none;
    border-radius: 8px;
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.2s ease;
}

    .row-actions .btn:hover {
        background-color: #d1d5db;
    }

/* Primary (green) button */
.btn-primary {
    background-color: #77dd77 !important;
    color: #fff !important;
}

    .btn-primary:hover {
        background-color: #5ec95e !important;
    }

/* Secondary (gray) button */
.btn-secondary {
    background-color: #e5e7eb !important;
    color: #111827 !important;
}

    .btn-secondary:hover {
        background-color: #d1d5db !important;
    }

/* Danger (pink/red) button */
.btn-danger {
    background-color: #FD7E8C !important;
    color: #fff !important;
}

    .btn-danger:hover {
        background-color: #FC5C6F !important;
    }

/* Search results */
.search-results .result.selected {
    border-color: #77dd77;
    background-color: #f0fff0;
}

/* Empty hints (card subtext style) */
.empty-hint {
    font-size: 0.9rem;
    color: #6b7280;
    text-align: center;
    margin-top: 0.5rem;
}

/* Status (shared with Account behavior) */
.status {
    min-height: 20px;
    margin-bottom: 12px;
    color: transparent;
    transition: color .2s ease;
}

    .status.ok {
        color: #127c39;
    }

    .status.err {
        color: #b42318;
    }

/* ====== Tabs (match Account) ====== */
.tabs {
    margin-top: 12px;
}

.tablist {
    position: relative;
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 10px;
    padding-bottom: 8px;
}

    .tablist::before {
        content: '';
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        height: 1px;
        background: #E9EAEB;
        z-index: 1;
    }

.tab {
    appearance: none;
    background: transparent;
    border: none;
    padding: 8px 4px 12px;
    font-weight: 600;
    color: #717680;
    cursor: pointer;
    position: relative;
}

    .tab.active {
        color: #4DC24D;
    }

        .tab.active::after {
            content: '';
            position: absolute;
            left: 0;
            right: 0;
            bottom: -1px;
            height: 2px;
            background: #4DC24D;
            z-index: 2;
        }

/* Notification badge on Pending Requests tab */
.friends-tab-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 12px;
    line-height: 1;
    font-weight: 700;
    color: #fff;
    background: #4DC24D;
    border-radius: 999px;
    border: 2px solid #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,.12);
    pointer-events: none;
}

.tabpanel {
    display: none;
}

    .tabpanel.active {
        display: 0;
        display: block;
    }

/* Hero */
.hero-banner {
    width: 100%;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

    .hero-banner img {
        width: 100%;
        object-fit: cover;
        display: block;
    }

/* === Avatar "chip" (match header dropdown; green border + glow) === */
a.coach-link.coach-chip {
    text-decoration: none !important;
    color: inherit;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* Hide image until it successfully loads; initials show by default */
.coach-avatar {
    display: none;
}

.coach-avatar,
.coach-initials {
    width: 32px;
    height: 32px;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #77DD77; /* green ring */
    box-shadow: 0 0 0 1px rgba(119,221,119,.25); /* soft glow */
    background: #fff;
    overflow: hidden;
    object-fit: cover;
    font-weight: 700;
    line-height: 1;
}

.coach-initials {
    background: #e5f6e5;
    color: #14532d;
    font-size: 14px;
}

.coach-name {
    text-decoration: none !important; /* no underline */
    color: #111827;
    font-weight: 600;
}

/* Align avatar chip + "Friends since..." vertically */
.row-main {
    display: grid;
    grid-template-columns: auto;
    grid-auto-rows: auto;
    row-gap: 2px;
}

    .row-main > .coach-chip {
        grid-row: 1;
    }

    .row-main > small {
        grid-row: 2;
        margin-left: 40px; /* indent to clear avatar circle */
        display: inline-block;
    }

/* ===== Drawer + Backdrop (only used if master didn't include them) ===== */
.up-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
    z-index: 9998;
}

    .up-backdrop.open {
        opacity: 1;
        pointer-events: auto;
    }

.up-drawer {
    position: fixed;
    top: var(--nav-offset, 0px);
    right: 0;
    bottom: 0;
    width: min(480px, 90vw);
    background: #fff;
    border-left: 1px solid #e5e7eb;
    box-shadow: -8px 0 24px rgba(0,0,0,.08);
    transform: translateX(100%);
    transition: transform .25s ease;
    z-index: 9999;
    display: flex;
    flex-direction: column;
}

    .up-drawer.open {
        transform: translateX(0%);
    }

.up-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #f0f2f4;
}

.up-drawer-title {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
}

.up-drawer-close {
    background: transparent;
    border: none;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.up-drawer-body {
    padding: 0;
    overflow: auto;
    flex: 1;
}

/* ==== Friend link specific tweaks ==== */
#friendLinkInput {
    font-size: 0.85rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    background-color: #f9fafb;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#copyFriendLinkBtn {
    white-space: nowrap;
}

/* ========================================================= */
/*   ADD FRIENDS TAB: MATCH INVITE COACHES CARD STYLING      */
/* ========================================================= */

/* Overall heading in Add Friends tab */
#tab-add .friends-page h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.75rem;
    text-align: left;
}

/* Card base for all inner sections (friend link + search + suggestions) */
#tab-add .friends-page > section {
    width: 100%;
    background: #fff;
    border: 2.5px solid #EAEAEA;
    border-radius: 25px;
    box-shadow: 0 0 14px rgba(0,0,0,0.15);
    padding: 18px 20px;
    box-sizing: border-box;
    margin: 0 auto 1.25rem auto;
    max-width: 520px;
}

    /* Card header + subtext (match "Your friend link" card) */
    #tab-add .friends-page > section h3 {
        margin: 0;
        font-family: "Inter Tight", Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
        font-size: 22px;
        color: #4DC24D;
        font-weight: 600;
    }

    #tab-add .friends-page > section .empty-hint {
        margin-top: 4px;
        text-align: left;
        font-size: 13px;
        color: #717680;
    }

    /* Friend link copy row – grid like ilc-row */
    #tab-add .friends-page > section:first-of-type .find-row {
        display: grid;
        grid-template-columns: 1fr auto;
        gap: 10px;
        align-items: center;
        margin-top: 12px;
    }

    /* Make the friend link input look like ilc-input */
    #tab-add .friends-page > section:first-of-type #friendLinkInput {
        padding: 10px 12px;
        border: 1px solid #D5D7DA;
        border-radius: 8px;
        font-size: 14px;
        background: #FBFBFB;
    }

    /* Search card styling (mirrors Invite a Coach card) */
    #tab-add .friends-page > section.search-results {
        padding: 24px;
    }

        #tab-add .friends-page > section.search-results .find-row {
            display: grid;
            grid-template-columns: 1fr auto;
            gap: 10px;
            align-items: center;
            margin-bottom: 0.75rem;
        }

        /* Dynamic search hint (Searching… / No users found.) */
        #tab-add .friends-page > section.search-results #resultsHint {
            margin-top: 0.25rem;
            font-size: 0.85rem;
            color: #6b7280;
            text-align: left;
        }

        /* Make search input feel like the league invite input */
        #tab-add .friends-page > section.search-results #findPrefix {
            padding: 10px 12px;
            border: 1px solid #D5D7DA;
            border-radius: 8px;
            font-size: 14px;
            background: #FFF;
        }

/* ========================================================= */
/*   PENDING REQUESTS TAB: STACKED CARDS LIKE INVITES        */
/* ========================================================= */

#tab-pending .friends-page {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 1rem 2.5rem;
}

    #tab-pending .friends-page h2 {
        font-size: 1.5rem;
        font-weight: 600;
        margin-bottom: 1.75rem;
        text-align: left;
    }

/* Card container for Incoming + Sent */
#tab-pending .card-subblock {
    background: #fff;
    border: 2.5px solid #EAEAEA;
    border-radius: 20px;
    box-shadow: 0 0 14px rgba(0,0,0,0.1);
    padding: 16px 20px;
    box-sizing: border-box;
    margin: 0 auto 1.25rem auto;
    max-width: 520px;
}

    /* Sub-headings (Incoming / Sent) - match "Your friend link" style */
    #tab-pending .card-subblock h3 {
        margin: 0;
        font-family: "Inter Tight", Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
        font-size: 22px;
        color: #4DC24D;
        font-weight: 600;
    }

    /* Subtext under Incoming / Sent titles */
    #tab-pending .card-subblock .card-subtext {
        margin-top: 4px;
        text-align: left;
        font-size: 13px;
        color: #717680;
    }

    /* Lists inside the cards */
    #tab-pending .card-subblock .list-group {
        margin-top: 0.5rem;
    }

    /* Keep list items visually nested inside the card */
    #tab-pending .card-subblock .list-group-item {
        background: #f9fafb;
    }

/* Empty-state text (replacement content) */
#tab-pending .pending-empty {
    margin-top: 0.75rem;
    text-align: center;
    font-size: 0.95rem;
    color: #4b5563;
    font-weight: 500;
}

/* ========================================================= */
/*   ICON-ONLY "ADD FRIEND" BUTTONS                         */
/* ========================================================= */

.addfriend-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem;
    width: 32px;
    height: 32px;
    border-radius: 9999px;
}

    /* SVG icon inside the button */
    .addfriend-icon-btn .addfriend-icon {
        width: 18px;
        height: 18px;
        display: block;
        transform: scale(4.5);
        transform-origin: center;
    }

/* Screen-reader-only text so "Add friend" is announced but not visible */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ========================================================= */
/*   ALLIANCES TAB STYLING                                  */
/* ========================================================= */

/* Alliances page wrapper (reuse friends-page spacing) */
#tab-alliances .friends-page.alliances-page {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 1rem 2.5rem;
}

    #tab-alliances .friends-page.alliances-page h2 {
        font-size: 1.5rem;
        font-weight: 600;
        margin-bottom: 1.75rem;
        text-align: left;
    }

/* Base card for each alliances block (Your Alliances / Majority / Largest) */
.alliances-card {
    background: #fff;
    border: 2.5px solid #EAEAEA;
    border-radius: 20px;
    box-shadow: 0 0 14px rgba(0,0,0,0.1);
    padding: 16px 20px 18px;
    box-sizing: border-box;
    margin: 0 auto 1.25rem auto;
    max-width: 640px;
}

.alliances-card-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 10px;
}

    .alliances-card-header h3 {
        margin: 0;
        font-family: "Inter Tight", Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
        font-size: 22px;
        color: #4DC24D;
        font-weight: 600;
    }

.alliances-subtext {
    margin: 0;
    text-align: left;
    font-size: 13px;
    color: #717680;
}

/* Generic action button spacing inside alliances cards */
.alliances-action {
    margin-top: 0.85rem;
}

.alliances-actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.85rem;
}

/* ========== Alliance "pill" cards (inside Your Alliances / Majority Alliance) ========== */

.alliance-pill {
    border-radius: 16px;
    padding: 10px 12px;
    margin: 8px 0;
    border: 1px solid #E5E7EB;
    background: #FAFAFA;
    display: flex;
    flex-direction: column;
    gap: 6px;
    cursor: pointer;
    transition: all 0.12s ease;
}

    .alliance-pill:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }

.alliance-private {
    background: #F2E9FF; /* light purple */
    border-color: #D6C3FF;
}

.alliance-majority {
    background: #FFEAD5; /* light orange */
    border-color: #FFC999;
}

.alliance-pill-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
}

.alliance-pill-name {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
}

.alliance-pill-count {
    font-size: 0.85rem;
    color: #4b5563;
    white-space: nowrap;
}

.alliance-pill-members {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
    align-items: center;
}

/* Alliance action buttons inline (Leave + Delete) */
.alliance-actions-inline {
    display: flex;
    gap: 8px;
    margin-left: auto;
    flex-shrink: 0;
}

    .alliance-actions-inline .btn {
        font-size: 0.85rem;
        padding: 0.4rem 0.8rem;
        white-space: nowrap;
    }

/* Head of the Snake label above the coach chips */
.alliance-head-label {
    display: block;
    width: 100%;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7280;
    margin-bottom: 4px;
}

/* Inside alliance pills, we reuse the same coach-chip avatar styling */
.alliance-pill .coach-chip {
    font-size: 0.9rem;
}

/* Transfer HOS controls row */
.alliance-transfer-hos-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.alliance-transfer-hos-btn {
    font-size: 0.85rem;
    padding: 0.4rem 0.8rem;
    white-space: nowrap;
}

.alliance-transfer-select {
    flex: 1;
    min-width: 150px;
    padding: 0.4rem 0.6rem;
    border: 1px solid #D5D7DA;
    border-radius: 8px;
    font-size: 0.85rem;
    background: #f9fafb;
}

    .alliance-transfer-select:disabled {
        opacity: 0.5;
        cursor: not-allowed;
        background: #e5e7eb;
    }

.alliance-transfer-submit-btn {
    font-size: 0.85rem;
    padding: 0.4rem 0.8rem;
    white-space: nowrap;
}

/* Empty-state text for alliances sections (reuse pending-empty tone) */
#myAlliancesEmpty,
#topAlliancesEmpty {
    margin-top: 0.4rem;
    text-align: center;
    font-size: 0.95rem;
    color: #4b5563;
    font-weight: 500;
}

/* ========== Inline create-alliance form ========== */

.alliances-inline-create {
    margin-top: 0.75rem;
    padding: 10px 12px;
    border-radius: 12px;
    background: #F9FAFB;
    border: 1px solid #E5E7EB;
}

.alliances-inline-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 500;
    color: #4b5563;
    margin-bottom: 4px;
}

.alliances-inline-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 8px;
    align-items: center;
}

.alliances-inline-input {
    width: 100%;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid #D5D7DA;
    font-size: 0.9rem;
    background: #FFFFFF;
}

    .alliances-inline-input::placeholder {
        color: #9CA3AF;
    }

.alliances-inline-btn {
    font-size: 0.85rem;
    padding: 0.45rem 0.8rem;
}

/* ========== Majority Alliance browse list ========== */

#majorityAlliancesBrowseContainer .majority-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 6px;
}

#majorityAlliancesBrowseContainer .majority-row {
    border-radius: 12px;
    border: 1px solid #FFE0B8;
    background: #FFF5E6;
    padding: 8px 10px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.majority-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.majority-name {
    font-size: 0.98rem;
    font-weight: 600;
    color: #111827;
}

.majority-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.82rem;
    color: #4b5563;
}

.majority-members {
    font-weight: 500;
}

.majority-creator {
    opacity: 0.9;
}

.majority-actions {
    display: flex;
    align-items: center;
}

    .majority-actions .btn {
        font-size: 0.85rem;
        padding: 0.4rem 0.7rem;
    }

/* ========== Largest Alliances table ========== */

.alliances-table-wrap {
    margin-top: 8px;
    width: 100%;
    overflow-x: auto;
}

.alliances-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

    .alliances-table thead {
        background: #F3F4F6;
    }

    .alliances-table th,
    .alliances-table td {
        padding: 8px 10px;
        text-align: left;
        border-bottom: 1px solid #E5E7EB;
        white-space: nowrap;
    }

    .alliances-table th {
        font-weight: 600;
        font-size: 0.85rem;
        color: #4b5563;
    }

    .alliances-table td {
        font-size: 0.9rem;
        color: #111827;
    }

    /* Color coding by alliance type */
    .alliances-table tbody tr.alliance-type-private {
        background: #F8F4FF; /* soft purple tint */
    }

    .alliances-table tbody tr.alliance-type-majority {
        background: #FFF5E6; /* soft orange tint */
    }

    .alliances-table tbody tr:hover {
        background: #E5F6E5; /* subtle green hover */
    }

    /* Largest Alliances table - make first column clickable */
    .alliances-table tbody td:first-child {
        cursor: pointer;
        color: #2563EB;
        font-weight: 600;
        transition: color 0.12s ease;
    }

        .alliances-table tbody td:first-child:hover {
            color: #1d4ed8;
            text-decoration: underline;
        }

/* Alliance type pill in table (optional) */
.alliances-type-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
}

    .alliances-type-pill.private {
        background: #ECE4FF;
        color: #4338CA;
    }

    .alliances-type-pill.majority {
        background: #FFE9CF;
        color: #C05621;
    }

/* Head of the Snake pseudo-link style if not using avatar chip */
.alliances-creator-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #2563EB;
    text-decoration: none;
    font-weight: 500;
}

    .alliances-creator-link:hover {
        text-decoration: underline;
    }

/* ========== Alliances topic dropdown (Your / Majority / Largest) ========== */

.alliances-topic-card {
    max-width: 640px;
    margin: 0 auto 1rem auto;
    position: relative;
}

.alliances-topic-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #ffffff;
    border: 1px solid #D5D7DA;
    border-radius: 999px;
    padding: 6px 14px 6px 16px;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(15,23,42,0.08);
    transition: box-shadow .15s ease, border-color .15s ease, background-color .15s ease;
}

    .alliances-topic-header:focus-visible {
        outline: 2px solid #4DC24D;
        outline-offset: 2px;
    }

    .alliances-topic-header[aria-expanded="true"] {
        border-color: #4DC24D;
        box-shadow: 0 4px 14px rgba(76,175,80,0.2);
    }

.alliances-topic-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #111827;
    white-space: nowrap;
}

.alliances-topic-caret {
    width: 18px;
    height: 18px;
    border-radius: 999px;
    border: 1px solid #D5D7DA;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 10px;
    position: relative;
}

    .alliances-topic-caret::before,
    .alliances-topic-caret::after {
        content: '';
        position: absolute;
        width: 7px;
        height: 1.8px;
        background: #4B5563;
        border-radius: 999px;
        transition: transform .18s ease;
    }

    .alliances-topic-caret::before {
        transform: translateX(-1px) rotate(40deg);
    }

    .alliances-topic-caret::after {
        transform: translateX(2px) rotate(-40deg);
    }

.alliances-topic-header[aria-expanded="true"] .alliances-topic-caret::before {
    transform: translateX(-1px) rotate(-40deg);
}

.alliances-topic-header[aria-expanded="true"] .alliances-topic-caret::after {
    transform: translateX(2px) rotate(40deg);
}

.alliances-topic-menu {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    z-index: 20;
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #E5E7EB;
    box-shadow: 0 16px 40px rgba(15,23,42,0.28);
    padding: 6px;
    display: none;
}

    .alliances-topic-menu.is-open {
        display: block;
    }

.alliances-topic-option {
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
    border-radius: 12px;
    padding: 7px 10px;
    font-size: 0.86rem;
    font-weight: 500;
    color: #111827;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

    .alliances-topic-option:hover {
        background: #F3F4F6;
    }

    .alliances-topic-option.is-active {
        background: #E5F6E5;
        color: #14532d;
    }

    .alliances-topic-option[aria-checked="true"]::after {
        content: '✓';
        font-size: 0.8rem;
        color: #14532d;
        margin-left: 6px;
    }

    /* Keep badges left-aligned next to text, unaffected by checkmark */
    .alliances-topic-option .friends-nav-badge-menu {
        margin-left: auto;
        position: static;
    }

/* Panels that are wired to topic dropdown */
.alliances-topic-panel.is-hidden {
    display: none;
}

/* ========================================================= */
/*   ALLIANCE INVITE CARDS (NEW)                            */
/* ========================================================= */

.alliance-invite-card {
    background: #F9FAFB;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    padding: 14px 16px;
    margin-top: 1rem;
}

.alliance-invite-title {
    margin: 0 0 4px 0;
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
}

.alliance-invite-subtext {
    margin: 0 0 12px 0;
    font-size: 0.85rem;
    color: #6b7280;
}

.alliance-invite-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.alliance-invite-label {
    font-size: 0.82rem;
    font-weight: 500;
    color: #4b5563;
    margin-bottom: -6px;
}

.alliance-invite-select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #D5D7DA;
    border-radius: 8px;
    font-size: 0.9rem;
    background: #FFFFFF;
}

    .alliance-invite-select:disabled {
        opacity: 0.5;
        cursor: not-allowed;
        background: #e5e7eb;
    }

.alliance-requests-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #E5E7EB;
}

.alliance-requests-subtitle {
    margin: 0 0 8px 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #374151;
}

.alliance-requests-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

    .alliance-requests-list li {
        background: #FFFFFF;
        border: 1px solid #E5E7EB;
        border-radius: 8px;
        padding: 10px 12px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 10px;
    }

.alliance-request-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.alliance-request-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: #111827;
}

.alliance-request-meta {
    font-size: 0.8rem;
    color: #6b7280;
}

.alliance-request-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

    .alliance-request-actions .btn {
        font-size: 0.8rem;
        padding: 0.35rem 0.65rem;
    }

.alliance-requests-empty {
    text-align: center;
    font-size: 0.85rem;
    color: #9CA3AF;
    padding: 8px 0;
}

.alliance-request-disabled-info {
    background: #FEF3C7;
    border: 1px solid #FCD34D;
    border-radius: 6px;
    padding: 8px 10px;
    margin-top: 6px;
    font-size: 0.8rem;
    color: #92400E;
}

/* ========================================================= */
/*   READ-ONLY ALLIANCE INVITES CARD (NON-HOS)             */
/* ========================================================= */

.alliance-readonly-invites-card {
    background: #F9FAFB;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    padding: 14px 16px;
    margin-top: 1rem;
    margin-bottom: 1rem;
}

    .alliance-readonly-invites-card .alliance-invite-title {
        margin: 0 0 4px 0;
        font-size: 1rem;
        font-weight: 600;
        color: #111827;
    }

    .alliance-readonly-invites-card .alliance-invite-subtext {
        margin: 0 0 12px 0;
        font-size: 0.85rem;
        color: #6b7280;
    }

/* ========================================================= */
/*   HOS TRANSFER MODAL                                     */
/* ========================================================= */

.hos-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.hos-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.2s ease;
}

.hos-modal-content {
    position: relative;
    background: #FFFFFF;
    border-radius: 16px;
    padding: 24px;
    max-width: 440px;
    width: 100%;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

.hos-modal-title {
    margin: 0 0 12px 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: #111827;
}

.hos-modal-text {
    margin: 0 0 8px 0;
    font-size: 0.95rem;
    color: #374151;
    line-height: 1.5;
}

.hos-modal-warning {
    margin: 0 0 20px 0;
    font-size: 0.9rem;
    color: #DC2626;
    font-weight: 500;
    background: #FEE2E2;
    border: 1px solid #FCA5A5;
    border-radius: 8px;
    padding: 10px 12px;
}

.hos-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

    .hos-modal-actions .btn {
        font-size: 0.9rem;
        padding: 0.5rem 1rem;
    }

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ========== Largest Alliances type filters (NEW) ========== */

#largestAllianceFilters {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin: 8px 0 6px 0; /* sits just above the table */
}

.largest-filter-label {
    font-size: 0.82rem;
    color: #4b5563;
    margin-right: 2px;
}

.filter-check {
    display: inline-flex;
    align-items: center;
    position: relative;
}

    .filter-check input[type="checkbox"] {
        position: absolute;
        opacity: 0;
        pointer-events: none;
        width: 1px;
        height: 1px;
    }

    .filter-check span {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 6px 10px;
        border-radius: 999px;
        border: 1px solid #D5D7DA;
        background: #FFFFFF;
        font-size: 0.82rem;
        font-weight: 600;
        color: #111827;
        user-select: none;
        transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
    }

    .filter-check input[type="checkbox"]:checked + span {
        background: #E5F6E5; /* soft green fill */
        border-color: #77DD77; /* brand green border */
        color: #14532d; /* deep green text */
        box-shadow: 0 0 0 2px rgba(119,221,119,.18);
    }

    .filter-check input[type="checkbox"]:focus-visible + span {
        outline: 2px solid #4DC24D;
        outline-offset: 2px;
    }

/* Helper class for JS to hide rows by type */
.hide-by-filter {
    display: none !important;
}

/* Mobile tighten */
@media (max-width: 480px) {
    #largestAllianceFilters {
        gap: 6px;
    }

    .filter-check span {
        padding: 6px 9px;
        font-size: 0.8rem;
    }
}

/* Mobile adjustments for alliances cards */
@media (max-width: 640px) {
    .alliances-card {
        padding: 14px 14px 16px;
    }

    .alliances-card-header h3 {
        font-size: 1.1rem;
    }

    .alliances-inline-row {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .alliances-inline-btn {
        width: 100%;
        justify-content: center;
    }

    #majorityAlliancesBrowseContainer .majority-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .alliances-table th,
    .alliances-table td {
        padding: 6px 8px;
    }

    .alliance-transfer-hos-row {
        flex-direction: column;
        align-items: stretch;
    }

    .alliance-transfer-select {
        min-width: 100%;
    }

    .alliance-invite-controls {
        gap: 8px;
    }

    .alliance-requests-list li {
        flex-direction: column;
        align-items: flex-start;
    }

    .alliance-request-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .hos-modal-content {
        padding: 20px;
    }

    .hos-modal-actions {
        flex-direction: column-reverse;
    }

        .hos-modal-actions .btn {
            width: 100%;
        }

    .alliance-pill-members {
        flex-direction: column;
        align-items: flex-start;
    }

    .alliance-actions-inline {
        margin-left: 0;
        width: 100%;
        justify-content: flex-end;
    }
}
