/* =========================================================
   0. CRITICAL SAFETY RESET (Prevents Horizontal Scroll)
   ========================================================= */
html, body {
    max-width: 100vw;
    overflow-x: hidden !important;
}

/* Ensure padding doesn't add to width for ALL elements */
.pt-forum-wrapper *,
.pt-forum-wrapper *::before,
.pt-forum-wrapper *::after {
    box-sizing: border-box;
}

/* =========================================================
   1. LAYOUT OVERRIDES (The "Nuclear" Fix)
   ========================================================= */

/* 1. Disable Flexbox on Tribe Pages to allow Full Width */
body.single-pt_tribe .site-content,
body.page-template-manage-tribe .site-content {
    display: block !important;
    width: 100% !important;
    overflow-x: hidden; /* Double safety */
}

/* 2. Force Containers to Full Width */
body.single-pt_tribe .site.grid-container,
body.single-pt_tribe #content {
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* 3. Global Wrapper Background */
.pt-forum-wrapper {
    background-color: #f0f2f5;
    min-height: 100vh;
    padding-top: 40px;
    padding-bottom: 80px;
    width: 100%;
    position: relative;
    overflow: hidden; /* Contain inner elements */
}

/* 4. The Inner Content Container (Width Control) */
.pt-forum-wrapper .pt-container {
    max-width: 1250px !important;
    width: 95%; 
    margin: 0 auto;
    padding: 0 20px;
    box-sizing: border-box !important; /* Critical for keeping padding inside width */
}

/* 5. Fix GeneratePress Entry Header Spacing */
body.single-pt_tribe .entry-content,
body.single-pt_tribe .entry-header {
    margin: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
}

/* Modern Card Base */
.pt-card-modern {
    background: #fff;
    border: 1px solid #eaeaea;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.03);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

/* =========================================================
   2. TRIBE HEADER (Modernized)
   ========================================================= */
.pt-tribe-header {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    border: none;
    position: relative;
    width: 100%; /* Ensure it fits */
}

.pt-tribe-cover {
    height: 320px;
    background-size: cover;
    background-position: center;
    position: relative;
    width: 100%;
}

/* Gradient Overlay */
.pt-tribe-cover::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.1), rgba(0,0,0,0.8));
}

.pt-tribe-header-content {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 30px 40px;
    z-index: 2;
    color: #fff;
    box-sizing: border-box; /* PREVENTS OVERFLOW caused by padding */
}

.pt-tribe-header-content h1 {
    font-size: 3rem;
    font-weight: 800;
    margin: 0 0 5px 0;
    color: #fff;
    letter-spacing: -1px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
    word-wrap: break-word; /* Prevents long titles from breaking layout */
}

/* Action Bar - Desktop Defaults */
.pt-tribe-actions {
    padding: 20px 40px;
    background: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #f0f0f0;
    width: 100%;
    box-sizing: border-box;
}

.pt-tribe-desc {
    font-size: 1.05rem;
    color: #555;
    line-height: 1.6;
    max-width: 600px;
}

.pt-action-buttons {
    display: flex;
    gap: 12px;
}

/* =========================================================
   TRIBE HEADER MOBILE OPTIMIZATION
   ========================================================= */
@media (max-width: 768px) {
    /* 1. Reduce height of the cover image so it doesn't take the whole screen */
    .pt-tribe-cover {
        height: 240px !important;
    }

    /* 2. Scale down the title and adjust padding */
    .pt-tribe-header-content {
        padding: 20px !important;
    }

    .pt-tribe-header-content h1 {
        font-size: 1.8rem !important; /* Smaller text for small screens */
        line-height: 1.2;
    }

    .pt-tribe-header-content div {
        font-size: 0.85rem !important; /* Subtext scaling */
    }

    /* 3. Stack the action buttons and description vertically */
    .pt-tribe-actions {
        flex-direction: column !important;
        align-items: stretch !important;
        padding: 20px !important;
        gap: 20px;
    }

    .pt-tribe-desc {
        max-width: 100% !important;
        text-align: center;
        font-size: 0.95rem;
    }

    /* 4. Make buttons full-width for easier tapping */
    .pt-action-buttons {
        flex-direction: column !important;
        width: 100%;
        gap: 10px;
    }

    .pt-button {
        width: 100%;
        justify-content: center;
    }

    /* Extra: Fix the "Leave" form alignment when stacked */
    .pt-tribe-actions form {
        display: block !important;
        margin-left: 0 !important;
        text-align: center;
    }
}

/* =========================================================
   3. BUTTONS (Standardized & Modern)
   ========================================================= */
.pt-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none !important;
    line-height: 1;
    white-space: nowrap; /* Stops button text from wrapping weirdly */
}

/* Primary (Red) */
.pt-button.pt-red {
    background: #d00;
    color: #fff !important;
}
.pt-button.pt-red:hover {
    background: #b00;
    box-shadow: 0 4px 12px rgba(221, 0, 0, 0.2);
}

/* Secondary (Outline/Grey) */
.pt-button.secondary {
    background: #fff;
    border: 1px solid #ddd;
    color: #333 !important;
}
.pt-button.secondary:hover {
    background: #f9f9f9;
    border-color: #bbb;
    color: #000 !important;
}

/* Status Button (Member) */
.pt-button.status {
    background: #f0fdf4;
    color: #166534 !important;
    border: 1px solid #bbf7d0;
    cursor: default;
}

/* =========================================================
   4. MANAGEMENT DASHBOARD
   ========================================================= */
.pt-manage-section {
    background: #fff;
    border-radius: 12px;
    padding: 35px;
    margin-bottom: 30px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.04);
    border: 1px solid #f0f0f0;
    max-width: 100%;
}

.pt-manage-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 25px 0;
    padding-bottom: 15px;
    border-bottom: 2px solid #f5f5f5;
}

/* Inputs & Forms */
.pt-field-group {
    margin-bottom: 25px;
    width: 100%;
}

.pt-label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.pt-input, .pt-select {
    width: 100%;
    padding: 12px 16px;
    font-size: 1rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box; /* Fix form overflow */
}

.pt-input:focus, .pt-select:focus {
    border-color: #d00;
    box-shadow: 0 0 0 3px rgba(221, 0, 0, 0.1);
    outline: none;
}

textarea.pt-input {
    line-height: 1.5;
    resize: vertical;
}

/* Permission Checkboxes */
.pt-checkbox-card {
    background: #f9fafb;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #eee;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: background 0.2s;
    width: 100%;
    box-sizing: border-box;
}
.pt-checkbox-card:hover {
    background: #f3f4f6;
}
.pt-checkbox-card input {
    width: 18px;
    height: 18px;
    accent-color: #d00;
    flex-shrink: 0; /* Prevents checkbox squishing */
}

/* Member Rows */
.pt-member-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border: 1px solid #eee;
    border-radius: 8px;
    margin-bottom: 10px;
    background: #fff;
    transition: all 0.2s;
    width: 100%;
    box-sizing: border-box;
}

.pt-member-row:hover {
    border-color: #ddd;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}

.pt-user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    overflow: hidden; /* prevents name bleed */
}

.pt-user-info img {
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    flex-shrink: 0; /* Prevents avatar squishing */
}

/* Danger Zone */
.pt-manage-section.danger {
    border: 1px solid #fee2e2;
    background: #fffafa;
}
.pt-manage-section.danger .pt-manage-title {
    color: #dc2626;
    border-bottom-color: #fee2e2;
}

/* =========================================================
   5. SIDEBAR & SEARCH
   ========================================================= */
.pt-sidebar-box {
    background: #fff;
    border-radius: 12px;
    padding: 25px;
    border: 1px solid #f0f0f0;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    width: 100%;
}

#pt_sidebar_search {
    background: #f9f9f9;
    border: 1px solid #eee;
    padding: 10px 15px;
    font-size: 0.9rem;
    border-radius: 20px;
    width: 100%;
    box-sizing: border-box;
}
#pt_sidebar_search:focus {
    background: #fff;
    border-color: #ccc;
}

/* =========================================================
   6. MOBILE RESPONSIVENESS & SEARCH FIX
   ========================================================= */

@media (max-width: 768px) {
    /* Ensure the main container doesn't "pinch" items */
    .pt-forum-wrapper .pt-container {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 15px !important;
    }

    /* Stack the Toolbar elements */
    .pt-tribe-toolbar {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 15px !important;
    }

    /* 🏆 THE CRITICAL FIX: Override the 450px desktop limit */
    .pt-tribe-search-wrapper {
        width: 100% !important;
        max-width: 100% !important; /* Forces it to stretch full width */
        margin: 0 !important;
    }

    #pt-tribe-search-input {
        height: 54px !important;
        padding: 12px 60px 12px 20px !important;
    }

    #pt-tribe-search-btn {
        width: 42px !important;
        height: 42px !important;
    }
}




/* =========================================================
   7. ARCHIVE: HERO SECTION
   ========================================================= */
.pt-tribe-archive-hero {
    background: #fff;
    padding: 60px 40px;
    border-radius: 16px;
    text-align: center;
    margin-bottom: 40px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.03);
    border: 1px solid #fff;
}

.pt-hero-content h1 {
    font-size: 2.8rem;
    font-weight: 900;
    color: #111;
    margin: 0 0 15px 0;
    letter-spacing: -1px;
}

.pt-hero-content p {
    font-size: 1.1rem;
    color: #666;
    max-width: 600px;
    margin: 0 auto 30px auto;
    line-height: 1.6;
}

/* =========================================================
   8. ARCHIVE: TOOLBAR (Tabs & Search)
   ========================================================= */
.pt-tribe-toolbar {
    display: flex;
    justify-content: space-between; /* Pushes tabs left, search right */
    align-items: center;
    margin-bottom: 40px;
    width: 100%;
}

.pt-tribe-tabs {
    display: flex;
    gap: 5px;
    background: #e5e7eb;
    padding: 5px;
    border-radius: 8px;
}

.pt-tab-link {
    padding: 8px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
    color: #6b7280;
    transition: all 0.2s;
}

.pt-tab-link.active {
    background: #fff;
    color: #000;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.pt-tribe-search-form {
    position: relative;
    max-width: 300px;
    width: 100%;
}

.pt-tribe-search-form .pt-input {
    padding-right: 40px;
    border-radius: 50px;
    background: #fff;
    border: 1px solid #e5e7eb;
}

.pt-search-icon-btn {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 5px;
}

/* =========================================================
   9. ARCHIVE: GRID & CARDS
   ========================================================= */
.pt-tribes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
    margin-bottom: 50px;
}

.pt-tribe-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #f0f0f0;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.pt-tribe-card:hover {
    box-shadow: 0 10px 25px rgba(0,0,0,0.08);
}

.pt-card-link {
    text-decoration: none;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.pt-card-cover {
    height: 160px;
    background-size: cover;
    background-position: center;
    position: relative;
    background-color: #333;
}

/* Card Body */
.pt-card-body {
    padding: 25px;
    flex-grow: 1;
    position: relative; /* 🏆 Necessary for absolute positioning of badge */
}

/* Privacy Badges (Moved to White Area) */
.pt-card-badges {
    position: absolute;
    top: 25px;  /* Aligns with top padding */
    right: 25px; /* Aligns with right padding */
}

.pt-badge {
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    padding: 4px 8px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

/* Updated Colors for White Background */
.pt-badge.public { 
    background: #ecfdf5; /* Light Green Bg */
    color: #047857;      /* Dark Green Text */
    border: 1px solid #a7f3d0;
}

.pt-badge.private { 
    background: #fffbeb; /* Light Yellow Bg */
    color: #b45309;      /* Dark Orange Text */
    border: 1px solid #fcd34d;
}

/* Adjust Title to not overlap badge if title is long */
.pt-card-title {
    margin: 0 0 10px 0;
    font-size: 1.25rem;
    font-weight: 800;
    color: #111;
    line-height: 1.3;
    padding-right: 60px; /* 🏆 Buffer space for the badge */
}

.pt-card-meta {
    display: flex;
    flex-wrap: wrap; /* 🏆 Allows stats to wrap on narrow cards */
    gap: 12px;       /* 🏆 Slightly reduced gap for three items */
    font-size: 0.8rem;
    color: #6b7280;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f3f4f6;
}

.pt-meta-item {
    white-space: nowrap; /* 🏆 Keeps the icon and number together */
    display: flex;
    align-items: center;
    gap: 4px;
}

.pt-card-excerpt {
    font-size: 0.95rem;
    color: #4b5563;
    line-height: 1.5;
    margin: 0;
}

.pt-card-footer {
    padding: 15px 25px;
    background: #f9fafb;
    border-top: 1px solid #f0f0f0;
    text-align: center;
}

.pt-view-btn {
    font-size: 0.85rem;
    font-weight: 700;
    color: #d00;
    text-transform: uppercase;
}

/* Pagination */
.pt-pagination {
    text-align: center;
    margin-top: 40px;
}
.pt-pagination a, .pt-pagination span {
    display: inline-block;
    padding: 8px 15px;
    background: #fff;
    border: 1px solid #ddd;
    margin: 0 2px;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
    font-weight: 600;
}
.pt-pagination span.current {
    background: #000;
    color: #fff;
    border-color: #000;
}

/* Empty State */
.pt-empty-state {
    text-align: center;
    padding: 80px 20px;
    color: #6b7280;
    background: #fff;
    border-radius: 12px;
}

/* ========================================= */
/* MEMBER OVERLAY STYLES (New)               */
/* ========================================= */

/* 1. The Grey Overlay */
/* This pseudo-element sits ON TOP of the background image but BELOW the text */
.pt-card-cover.is-member::before {
    content: "";
    position: absolute;
    inset: 0; /* Cover entire area */
    background-color: rgba(255, 255, 255, 0.5); /* White tint to dull it, or use rgba(0,0,0,0.5) for dark */
    backdrop-filter: grayscale(100%); /* Makes the image black & white */
    z-index: 1;
    transition: all 0.3s ease;
}

/* 2. The Centered Badge */
.pt-member-overlay-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2; /* Sit on top of the overlay */
    
    background: #fff;
    color: #d00; /* Red Text */
    border: 2px solid #d00;
    
    font-weight: 800;
    text-transform: uppercase;
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 1.1rem;
    letter-spacing: 1px;
        
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

/* Hover Effect: Restore color slightly when hovering the card */
.pt-tribe-card:hover .pt-card-cover.is-member::before {
    backdrop-filter: grayscale(50%); /* Bring back some color */
    background-color: rgba(255, 255, 255, 0.2);
}


/* =========================================================
   10. TRIBE DISCUSSION LIST (Single Tribe View)
   ========================================================= */

/* 1. The Main Container (Card Style) */
.pt-cat-list.pt-flush {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.03);
    border: 1px solid #eaeaea;
    overflow: hidden; /* Ensures rows don't spill out of rounded corners */
}

/* 2. The Row (Grid Layout) */
.pt-table-row {
    display: grid;
    /* Title | Privacy | Author | Comments | Date */
    grid-template-columns: 2.5fr 1fr 1fr 0.8fr 1.2fr !important; 
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s ease;
    background: #fff;
    gap: 15px;
}

.pt-table-row:last-child {
    border-bottom: none;
}

.pt-table-row:hover {
    background-color: #f9f9f9;
}

/* 3. PINNED TOPIC STYLING */
.pt-table-row.pt-pinned {
    background-color: #fff9f9; /* Very faint red tint */
    border-left: 4px solid #d00; /* Piston Tribe Red branding */
}

.pt-table-row.pt-pinned:hover {
    background-color: #fff0f0; /* Slightly darker red tint on hover */
}

.pt-table-row.pt-pinned .pt-topic-title h3 a {
    color: #d00; /* Make pinned title red */
}

/* 4. Column Content Styling */

/* Title Column */
.pt-topic-title h3 {
    margin: 0 0 5px 0;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.3;
}

.pt-topic-title a {
    color: #111;
    text-decoration: none;
    transition: color 0.2s;
}

.pt-topic-title a:hover {
    color: #d00;
}

.pt-topic-excerpt {
    font-size: 0.85rem;
    color: #888;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 1; /* Limit to 1 line */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Author Column */
.pt-meta-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    color: #333;
    font-weight: 600;
}

.pt-mini-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #eee;
}

/* Stats (Comments) Column */
.pt-meta-cell.light {
    justify-content: center;
    color: #999;
    font-weight: 700;
    font-size: 0.9rem;
    text-align: center;
}
/* Optional: Add icon before comment count */
.pt-meta-cell.light::before {
    content: "💬"; 
    font-size: 0.7rem; 
    margin-right: 4px; 
    opacity: 0.7; 
}

/* Date Column */
.pt-date-cell {
    text-align: right;
    font-size: 0.75rem;
    color: #999;
    font-weight: 600;
    text-transform: uppercase;
}

/* =========================================================
   10. TRIBE DISCUSSION LIST - STRUCTURE & MOBILE FIX
   ========================================================= */

/* DESKTOP FIX: Ensures the new wrapper doesn't break the grid flow */
@media (min-width: 769px) {
    .pt-meta-wrapper-mobile {
        display: contents !important;
    }
}

@media (max-width: 768px) {
    /* 🏆 FIX: Hide the jumbled table header row on mobile */
    .pt-table-header {
        display: none !important;
    }

    /* Stack the Row */
    .pt-table-row {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        padding: 20px !important;
        gap: 12px !important;
    }

    /* Meta Wrapper horizontal bar for Mobile */
    .pt-meta-wrapper-mobile {
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        gap: 12px !important;
        width: 100%;
        border-top: 1px solid #f3f4f6;
        padding-top: 12px;
        position: static !important; /* Static allows badge to position relative to the Row */
        z-index: 3;
    }

    /* 1. Standard Meta Data (Author, Date, Comments) */
    .pt-meta-cell, .pt-date-cell {
        display: flex !important;
        font-size: 0.8rem !important;
        color: #6b7280 !important;
        align-items: center !important;
    }

    /* 2. Privacy Badge (Positioned Top Right) */
    .pt-state-cell {
        display: block !important;
        position: absolute !important;
        top: 15px !important;
        right: 15px !important;
        z-index: 20 !important; /* Above clickable links */
        width: auto !important;
    }

    /* 3. Ensure Title doesn't hit the badge */
    .pt-topic-title {
        width: 100%;
        padding-right: 70px !important; /* Buffer for the badge */
        box-sizing: border-box;
    }

    .pt-meta-cell.light {
        color: #111 !important;
        font-weight: 700;
    }

    .pt-meta-cell.light::before {
        content: "💬 ";
        margin-right: 4px;
    }

    .pt-date-cell::before {
        content: "Last Post: ";
        font-weight: 400;
        margin-right: 4px;
    }
}



/* =========================================================
   11. DISCUSSION BADGES (Private/Sticky/Closed)
   ========================================================= */

/* Ensure the title container can handle inline elements */
.pt-topic-title h3 {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px; /* Space between title text and badge */
}

/* Modernized Private Badge */
.pt-topic-title .pt-badge.private {
    display: inline-flex;
    align-items: center;
    background: #1a1a1a; /* Dark sleek background */
    color: #ffffff;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 4px;
    letter-spacing: 0.05em;
    vertical-align: middle;
    border: none; /* Override previous inline styles */
    margin-left: 20px;
    line-height: 1;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Optional: Subtle Lock Icon via Emoji or Dashicon spacing */
.pt-topic-title .pt-badge.private::before {
    margin-right: 3px;
}

/* Mobile Adjustments for Badge */
@media (max-width: 768px) {
    .pt-topic-title h3 {
        display: block; /* Let title wrap naturally */
    }
    
    .pt-topic-title .pt-badge.private {
        display: inline-block;
        margin-top: 4px;
        margin-left: 0;
    }
}



/* =========================================================
   12. TRIBE ARCHIVE BADGE STYLING (Corner Position)
   ========================================================= */

/* Maintain corner position for archive cards */
.pt-card-badges {
    position: absolute;
    top: 25px;
    right: 25px;
    z-index: 5;
}

/* Force the new black style for ALL private badges site-wide */
.pt-forum-wrapper .pt-badge.private {
    display: inline-flex !important;
    align-items: center !important;
    background: #1a1a1a !important; /* New Black Style */
    color: #ffffff !important;
    font-size: 10px !important;
    font-weight: 800 !important;
    text-transform: uppercase;
    padding: 4px 10px !important;
    border-radius: 4px !important;
    letter-spacing: 0.05em;
    line-height: 1;
    border: none !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Keep the Green style for Public for visibility contrast */
.pt-forum-wrapper .pt-badge.public {
    background: #ecfdf5 !important;
    color: #047857 !important;
    border: 1px solid #a7f3d0 !important;
}

/* =========================================================
   13. MOBILE STACKING (Sidebar under Content)
   ========================================================= */
@media (max-width: 768px) {
    /* Stack the main grid: Discussions first, Members second */
    .pt-forum-grid {
        display: flex !important;
        flex-direction: column !important;
    }

    .pt-main-content {
        order: 1 !important;
        width: 100% !important;
    }

    .pt-sidebar {
        order: 2 !important;
        width: 100% !important;
    }

    /* Fix title wrapping to avoid overlapping badges */
    .pt-card-title {
        padding-right: 80px !important;
        display: block !important;
    }
}


/* ========================================= */
/* 32. BULLETPROOF CLICKABLE ROW FIX         */
/* ========================================= */

/* 1. The Row must be relative to anchor the phantom link */
.pt-table-row {
    position: relative !important;
}

/* 2. The Link Expansion (Stretches to cover EVERYTHING) */
.pt-row-link::before {
    content: "" !important;
    position: absolute !important;
    /* inset: 0 is a shorthand for top/bottom/left/right: 0 */
    inset: 0 !important; 
    width: 100% !important;
    height: 100% !important;
    z-index: 1 !important; /* Sits behind text but covers the background area */
    display: block !important;
}

/* 3. Safety: Elements you still want to be "individually" clickable */
/* This ensures if someone clicks the Author's name, they go to the profile, 
   otherwise, clicking the "row" goes to the topic. */
.pt-mini-avatar, 
.pt-meta-cell span, 
.pt-badge, 
.pt-meta-wrapper-mobile a,
button {
    position: relative !important;
    z-index: 10 !important; /* Higher than the phantom link expansion */
}

/* 4. Ensure the meta wrapper on mobile doesn't block the click */
@media (max-width: 768px) {
    .pt-meta-wrapper-mobile {
        /* This ensures the wrapper background doesn't eat the click */
        pointer-events: none !important; 
        position: relative;
        z-index: 2;
    }
    
    /* Re-enable clicking for specific links inside that wrapper */
    .pt-meta-wrapper-mobile a,
    .pt-meta-wrapper-mobile .pt-mini-avatar {
        pointer-events: auto !important;
    }
}

/* Visual Feedback */
.pt-table-row:hover {
    background-color: #fcfcfc !important;
    cursor: pointer;
}



/* Update your Section 8 / Master Link logic */
.pt-master-link {
    position: absolute !important;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100% !important;
    height: 100% !important;
    /* 🏆 THE FIX: Increase z-index so it sits ABOVE the text on mobile */
    z-index: 20 !important; 
    cursor: pointer;
    display: block;
    text-indent: -9999px;
    background: transparent;
}

/* Ensure that specific buttons STILL work on top of the link */
.pt-follow-btn, 
.pt-button, 
.pt-badge,
.pt-view-btn {
    position: relative !important;
    z-index: 30 !important; /* Must be higher than the master link z-index */
    pointer-events: auto !important;
}

/* 📱 MOBILE TWEAK: Remove tap highlighting delay */
@media (max-width: 768px) {
    .pt-tribe-card, .pt-cat-item, .pt-table-row {
        -webkit-tap-highlight-color: transparent; /* Removes the grey box delay when tapping */
    }
}



/* ============================================================
   SIDEBAR MEMBER LIST: SCROLL, SECTIONS & BUTTONS
   ============================================================ */

/* 1. Main Scroll Container */
.pt-sidebar-scroll-area {
    max-height: 420px;
    overflow-y: auto;
    padding-right: 8px; /* Space for scrollbar */
}

/* Sleek Scrollbar Styling */
.pt-sidebar-scroll-area::-webkit-scrollbar { 
    width: 5px; 
}
.pt-sidebar-scroll-area::-webkit-scrollbar-track { 
    background: #f1f1f1; 
    border-radius: 10px; 
}
.pt-sidebar-scroll-area::-webkit-scrollbar-thumb { 
    background: #ccc; 
    border-radius: 10px; 
}
.pt-sidebar-scroll-area::-webkit-scrollbar-thumb:hover { 
    background: #000; 
}

/* 2. Section Containers & Break Lines */
.pt-member-section {
    padding-bottom: 10px;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee; /* The clean break line */
}

/* Remove break line and bottom margin from the very last section */
.pt-member-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

/* Section Labels (Leadership, Friends, etc.) */
.pt-sidebar-section-label {
    font-size: 0.7rem; 
    color: #999; 
    text-transform: uppercase; 
    display: block; 
    margin-bottom: 12px;
    letter-spacing: 0.5px;
}

/* Remove top margin from the first label to keep it flush with the header */
.pt-member-section:first-child .pt-sidebar-section-label { 
    margin-top: 0; 
}

/* 3. Member Row Layout */
.pt-member-card-small {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    gap: 10px;
}

/* Avatar & Name Info */
.pt-sidebar-member-info {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    flex: 1;
    min-width: 0; /* Critical for truncation */
}

/* Name Truncation (Bulletproof) */
.pt-m-name {
    font-size: 0.85rem;
    font-weight: 700;
    display: block;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #000;
}

.pt-m-role { 
    font-size: 0.7rem; 
    color: #888; 
}

/* 4. Minimalist Sidebar Follow Buttons */
.pt-follow-btn.sidebar-tiny {
    background: #000 !important;
    color: #fff !important;
    border: 1px solid #000 !important;
    padding: 4px 10px !important;
    font-size: 9px !important;
    font-weight: 800 !important;
    text-transform: uppercase;
    border-radius: 4px !important;
    cursor: pointer;
    min-width: 75px;
    text-align: center;
    transition: all 0.2s ease;
    line-height: 1;
}

.pt-follow-btn.sidebar-tiny:hover {
    background: #333 !important;
    border-color: #333 !important;
}

/* "Following" State (Grey & Minimal) */
.pt-follow-btn.sidebar-tiny.following {
    background: #f0f0f0 !important;
    color: #999 !important;
    border: 1px solid #ddd !important;
}

/* Hovering "Following" turns Red for Unfollow */
.pt-follow-btn.sidebar-tiny.following:hover {
    background: #fff !important;
    color: #d00 !important;
    border-color: #d00 !important;
}


/* Fix the search input to look like the Forum Search */
.pt-tribe-toolbar #pt-forum-search-input {
    width: 100% !important;
    padding: 15px 60px 15px 20px !important;
    border-radius: 50px !important;
    border: 1px solid #ddd !important;
    font-size: 1rem !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05) !important;
    outline: none !important;
    height: auto !important;
}

/* Fix the button to be a black circle on the right */
.pt-tribe-toolbar #pt-forum-search-btn {
    position: absolute !important;
    right: 6px !important;
    top: 6px !important;
    bottom: 6px !important;
    width: 44px !important;
    height: 44px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    background: #000 !important;
    color: #fff !important;
    border: none !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 10 !important;
}

/* Ensure the magnifying glass icon is white */
.pt-tribe-toolbar #pt-forum-search-btn svg,
.pt-tribe-toolbar #pt-forum-search-btn svg path {
    stroke: #ffffff !important;
}

/* Card hover tweak for the master link */
.pt-tribe-card {
    position: relative;
    cursor: pointer;
}








/* =========================================================
   7. CLEANED SEARCH BAR (REPLACE DUPLICATES)
   ========================================================= */
.pt-tribe-search-wrapper {
    position: relative;
    max-width: 450px;
    margin-left: auto; /* Pushes to the far right on desktop */
}

#pt-tribe-search-input {
    width: 100%;
    padding: 16px 65px 16px 25px !important;
    border-radius: 50px !important;
    border: 1px solid #ddd !important;
    font-size: 1rem !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05) !important;
    outline: none !important;
    height: 58px !important;
    background: #fff !important;
}

#pt-tribe-search-btn {
    position: absolute !important;
    right: 6px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 46px !important;
    height: 46px !important;
    border-radius: 50% !important;
    background: #000 !important;
    border: none !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    z-index: 5 !important;
}

#pt-tribe-search-btn svg {
    stroke: #ffffff !important;
}

#pt-tribe-search-btn:hover {
    background: #d00 !important;
}


