/* ========================================= */
/* PISTON TRIBE FORUM - MASTER STYLES        */
/* ========================================= */

/* --- 0. FORCE FULL WIDTH (The Nuclear Option) --- */
body:has(.pt-forum-wrapper) #page.grid-container,
body:has(.pt-forum-wrapper) .site-content {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Ensure the wrapper itself handles the layout */
.pt-forum-wrapper {
    width: 100%;
    margin: 0;
    padding: 40px 0;
    overflow-x: hidden;
    background-color: #f4f4f4;
    min-height: 100vh;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    color: #222;
}
body[class*="page-template-forum"] #page.grid-container,
body[class*="page-template-forum"] .site-content,
body.single-pt_forum_topic #page.grid-container,
body.single-pt_forum_topic .site-content,
body.tax-pt_forum_cat #page.grid-container,
body.tax-pt_forum_cat .site-content {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* --- 1. GLOBAL LAYOUT --- */
.pt-forum-wrapper {
    background-color: #f4f4f4;
    min-height: 100vh;
    padding: 40px 0;
    width: 100%;
    color: #222;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

.pt-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    box-sizing: border-box;
}

.pt-container.pt-narrow {
    max-width: 800px; /* For forms */
}

a { transition: color 0.2s; }
img { max-width: 100%; height: auto; }

/* --- 2. HEADERS & TITLES --- */
.pt-forum-page-header {
    text-align: center;
    margin-bottom: 40px;
}


.pt-sub-title {
    color: #666;
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

.pt-category-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 20px;
}

.pt-breadcrumb {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #999;
    margin-bottom: 5px;
}
.pt-breadcrumb a { color: #999; text-decoration: none; }

/* --- STATUS BADGES (New: Colors moved here) --- */
.pt-status-badge {
    font-size: 0.4em;
    padding: 6px 12px;
    border-radius: 50px;
    text-transform: uppercase;
    font-weight: 700;
    vertical-align: middle;
    letter-spacing: 0.5px;
    line-height: 1;
    position: relative;
    top: -2px;
}

/* Status Colors */
.pt-status-planning { background-color: #6c757d; color: #fff; }
.pt-status-wrenching { background-color: #d63384; color: #fff; }
.pt-status-tuning { background-color: #0dcaf0; color: #000; }
.pt-status-track { background-color: #ffc107; color: #000; }
.pt-status-broken { background-color: #dc3545; color: #fff; }
.pt-status-completed { background-color: #198754; color: #fff; }

/* --- 3. BUTTONS --- */
.pt-button {
    display: inline-block;
    background: #000;
    color: #fff !important;
    font-weight: 800;
    text-transform: uppercase;
    padding: 12px 25px;
    border-radius: 2px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}
.pt-button:hover {
    background: #333;
    opacity: 1;
}
/* NEW (The Fix) */
.pt-button.pt-red { 
    background: #d00; 
    /* width: 100%;  <-- REMOVED */
    text-align: center; 
}

/* Only force full width if it's inside a Sidebar or a Widget */
.pt-sidebar-box .pt-button.pt-red,
.pt-widget .pt-button.pt-red,
.pt-login-modal .pt-button.pt-red {
    width: 100%;
}

/* ========================================= */
/* FIX FOR SECONDARY (WHITE) BUTTONS         */
/* ========================================= */

/* Exclude ANY element that has the 'pt-follow-link' class */
.pt-button.secondary:not(.pt-follow-link) {
    background-color: #fff !important;
    color: #333 !important;
    border: 1px solid #ddd !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.pt-button.secondary:not(.pt-follow-link):hover {
    background-color: #f4f4f4 !important;
    color: #000 !important;
    border-color: #bbb !important;
}

/* --- 4. HOMEPAGE STATS BAR (UPDATED FOR 5 COLS) --- */
.pt-stats-bar {
    background: #fff;
    padding: 30px 0; /* Removing side padding, letting flex handle it */
    display: flex;
    justify-content: space-between; /* Distribute space evenly */
    align-items: center;
    text-align: center;
    border-bottom: 4px solid #d00;
    margin-bottom: 40px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
}

.pt-stat-col {
    flex: 1; /* This forces all 5 columns to be exactly equal width */
    position: relative; /* Needed for the border line */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* The vertical divider line */
.pt-stat-col:not(:last-child):after {
    content: "";
    position: absolute;
    right: 0;
    top: 10%;
    height: 80%; /* Don't touch top/bottom edges */
    width: 1px;
    background: #eee;
}

.pt-stat-number { 
    display: block; 
    font-size: 2.2rem; 
    font-weight: 800; 
    color: #d00; 
    line-height: 1; 
    margin-bottom: 5px;
}

.pt-stat-label { 
    font-size: 0.85rem; 
    text-transform: uppercase; 
    font-weight: 700; 
    color: #999; 
    letter-spacing: 1px; 
}

/* Mobile Overrides (Keep existing 2x2 logic or use this) */
@media (max-width: 900px) {
    .pt-stats-bar { flex-wrap: wrap; }
    .pt-stat-col { 
        flex: 0 0 50%; /* 2 items per row */
        margin-bottom: 20px;
    }
    .pt-stat-col:not(:last-child):after { display: none; } /* Hide separators on mobile */
}

/* --- 5. GRID SYSTEM --- */
.pt-forum-grid {
    display: grid;
    grid-template-columns: 3fr 1fr;
    gap: 30px;
}

/* Sidebar Styling */
.pt-sidebar-box {
    background: #000;
    color: #fff;
    padding: 30px;
    margin-bottom: 20px;
    text-align: center;
}
.pt-sidebar-box.light {
    background: #fff;
    color: #222;
    border: 1px solid #eee;
    border-top: 4px solid #000;
    text-align: left;
}
.pt-sidebar-title { margin-top: 0; font-weight: 800; text-transform: uppercase; color: #fff; }
.pt-sidebar-text { font-size: 0.9rem; color: #ccc; margin-bottom: 20px; line-height: 1.5; }
.pt-user-badge { display: flex; align-items: center; gap: 15px; margin-bottom: 20px; text-align: left; }
.pt-user-badge img { border-radius: 50%; border: 2px solid #fff; }

/* --- 6. CATEGORY LISTS (CLEANED) --- */
.pt-filter-bar {
    background: #fff;
    padding: 0 20px;
    border-bottom: 2px solid #000;
    display: flex;
    gap: 30px;
    font-weight: 800;
    text-transform: uppercase;
    font-size: 0.9rem;
}
.pt-filter-link { padding: 20px 0; display: inline-block; color: #999; text-decoration: none; }
.pt-filter-link.active { color: #000; border-bottom: 4px solid #d00; }


/* Basic layout for the item */
.pt-cat-item {
    padding: 25px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #fff;
    /* transition and relative position are now handled in Section 32 */
}

/* --- HOVER EFFECT FOR ALL ROWS --- */


.pt-cat-info { display: flex; align-items: center; gap: 20px; }
.pt-cat-icon { font-size: 1.8rem; opacity: 0.5; }

/* REMOVED: .pt-cat-title a styling (since the link is now the Master Link) */
.pt-cat-title { 
    margin: 0; 
    font-size: 1.2rem; 
    font-weight: 800; 
    color: #000; 
}

.pt-cat-desc { margin: 5px 0 0 0; font-size: 0.9rem; color: #777; line-height: 1.4; }
.pt-cat-stats { text-align: right; min-width: 80px; }
.pt-count { display: block; font-weight: 700; font-size: 1.1rem; color: #000; }
.pt-label { font-size: 0.7rem; color: #999; text-transform: uppercase; letter-spacing: 0.5px; }




/* --- 7. TOPIC TABLE (Archive) --- */
.pt-table-header {
    display: grid;
    grid-template-columns: 3fr 1fr 1fr 1.5fr;
    background: #000;
    color: #fff;
    padding: 12px 20px;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 1px;
    border-top-left-radius: 3px;
    border-top-right-radius: 3px;
}
.pt-table-row {
    display: grid;
    grid-template-columns: 3fr 1fr 1fr 1.5fr;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    background: #fff;
    transition: background 0.1s;
}
.pt-table-row:hover { background-color: #fafafa !important; }
.pt-table-row.sticky { background: #fffcf0; border-left: 4px solid #000; }
.pt-topic-title h3 { margin: 0; font-size: 1rem; font-weight: 700; line-height: 1.3; }
.pt-topic-title a { color: #004d80; text-decoration: none; }
.pt-meta-cell { text-align: left; font-size: 0.85rem; color: #000; font-weight: 600; }
.pt-meta-cell.light { color: #666; font-weight: 700; font-size: 0.9rem; }
.pt-date-cell { text-align: right; font-size: 0.8rem; color: #888; }



/* --- 9. FORMS (Create Topic) --- */
.pt-form-header { margin-bottom: 40px; border-bottom: 1px solid #eee; padding-bottom: 20px; }
.pt-field-group { margin-bottom: 25px; }
.pt-label { display: block; font-weight: 700; text-transform: uppercase; font-size: 0.9rem; margin-bottom: 10px; }
.pt-input { width: 100%; padding: 15px; border: 1px solid #e0e0e0; font-size: 1.1rem; font-weight: 700; }
.pt-select { width: 100%; padding: 15px; border: 1px solid #e0e0e0; background: #fff; font-size: 1rem; }
.pt-hidden { display: none; }


/* ========================================= */
/* 6. ACTIVITY & SEARCH STYLES               */
/* ========================================= */

/* Search Bar Container - WIDER to match Homepage feel */
.pt-search-wrapper {
    max-width: 900px;
    margin: 30px auto 50px auto;
    position: relative;
}

/* The Signature Red Line */
.pt-search-separator {
    border-bottom: 4px solid #d00;
    margin-top: 40px;
    margin-bottom: 40px;
    width: 100%;
}

.pt-search-form {
    display: flex;
    gap: 0; 
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}



/* List Styles */
.pt-topic-meta-category {
    font-size: 0.65rem;
    text-transform: uppercase;
    color: #999;
    font-weight: 700;
    display: block;
    margin-bottom: 2px;
}

.pt-mini-avatar {
    border-radius: 50%;
    vertical-align: middle;
    margin-right: 5px;
    width: 25px;
    height: 25px;
}

.pt-time-small { font-size: 0.7rem; color: #999; }

.pt-quick-links { list-style: none; padding: 0; margin: 0; font-size: 0.9rem; }
.pt-quick-links li { margin-bottom: 10px; }
.pt-quick-links a { color: #222; text-decoration: none; }
.pt-quick-links a:hover { color: #d00; padding-left: 5px; }

.pt-no-results { padding: 40px; text-align: center; color: #666; }
.pt-cat-list.pt-flush { padding: 0; }

.pt-file-name { font-size:0.8rem; color:#666; margin-left:10px; }


/* ========================================= */
/* 🛠️ MOBILE SEARCH & FILTER CONTROLS FIX    */
/* ========================================= */

@media (max-width: 768px) {
    
    /* 1. Archive Controls Container */
    .pt-archive-controls {
        display: flex !important;
        flex-wrap: nowrap !important; /* Keep on one line */
        align-items: stretch !important;
        gap: 10px !important;
        width: 100% !important;
        margin-bottom: 20px !important;
    }

    /* 2. Search Wrapper (Takes 75-80% Width) */
    .pt-archive-controls .pt-forum-search-wrapper {
        flex-grow: 1 !important;
        width: auto !important; /* Let flex handle width */
        max-width: none !important;
        margin: 0 !important;
    }

    /* 3. The Form inside */
    .pt-archive-controls form {
        display: flex !important;
        width: 100% !important;
        gap: 0 !important; /* Remove gap, connect input & button */
    }

    /* 4. The Input Field (Left side, rounded corners) */
    #pt-forum-search-input {
        flex-grow: 1 !important;
        width: 100% !important;
        border-top-right-radius: 0 !important;
        border-bottom-right-radius: 0 !important;
        border-right: none !important; /* Seamless join */
        padding: 12px 15px !important;
        font-size: 16px !important; /* Prevents zoom on iOS */
        height: 46px !important;    /* Explicit height match */
    }

    /* 5. The Filter Button (Right side, connected) */
    .pt-archive-controls .pt-button.secondary {
        width: auto !important;
        padding: 0 20px !important;
        border-top-left-radius: 0 !important;
        border-bottom-left-radius: 0 !important;
        border-left: 1px solid #ddd !important;
        background: #f9f9f9 !important;
        color: #333 !important;
        font-size: 0.8rem !important;
        font-weight: 700 !important;
        height: 46px !important; /* Matches input height */
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
}


/* ========================================= */
/* 8. PROFILE UPLOAD BUTTON (Green)          */
/* ========================================= */

.pt-upload-btn.small {
    display: inline-block;
    background-color: #009715; /* Green */
    color: #fff;
    font-size: 10px;        
    font-weight: 700;
    text-transform: uppercase;
    padding: 6px 12px;      
    border: none;
    border-radius: 2px;      
    cursor: pointer;
    margin-top: 10px;
    transition: opacity 0.2s ease;
    letter-spacing: 0.5px;
    line-height: 1;
}

.pt-upload-btn.small:hover {
    opacity: 0.7; 
    background-color: #009715;
    color: #fff;
}


/* ========================================= */
/* 9. PARTS SELECTOR & DISPLAY GRID          */
/* ========================================= */

/* --- A. The Search Dropdown --- */
.pt-search-results {
    position: absolute;
    top: 85px;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-top: none;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    border-radius: 0 0 4px 4px;
    display: none;
}

.pt-result-item {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid #f5f5f5;
    cursor: pointer;
    transition: background 0.1s ease;
}
.pt-result-item:hover { background-color: #f0f0f0; }

.pt-result-item img {
    width: 50px !important;        
    height: 50px !important;
    object-fit: contain !important; 
    background: #fff;                
    border-radius: 3px;
    margin-right: 15px;
    border: 1px solid #eee;
    flex-shrink: 0;                 
}

.pt-result-item span {
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
    line-height: 1.2;
}

/* --- B. Selected Parts (Tags) --- */
#pt_selected_parts_container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.pt-part-tag {
    background-color: #000;
    color: #fff;
    padding: 6px 14px;
    border-radius: 4px; 
    font-size: 0.8rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.pt-part-tag .remove {
    margin-left: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    color: #999;
    line-height: 0.5;
    transition: color 0.2s;
}
.pt-part-tag .remove:hover { color: #fff; }


/* --- C. The Display Grid (Single Topic) --- */
.pt-parts-box {
    margin-top: 40px !important;
    background: #fff !important;
    border: 1px solid #eee !important;
    border-top: 3px solid #000 !important;
    padding: 30px !important;
    border-radius: 2px;
}

.pt-parts-box h4 {
    margin: 0 0 25px 0 !important;
    font-size: 1rem !important;
    font-weight: 800 !important;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #000;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
}

.pt-parts-grid {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 20px !important;
    justify-content: flex-start; 
}

/* Default Card Style (3 per row logic is here via 33.333% calc) */
.pt-part-card {
    width: calc(33.333% - 14px) !important; 
    min-width: 200px; 
    background: #fff !important;
    border: 1px solid #eee !important;
    padding: 15px !important;
    text-align: center;
    transition: all 0.2s ease;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: auto; 
}

.pt-part-card:hover {
    border-color: #d00 !important;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
}

.pt-part-card img.pt-part-img {
    height: 120px !important;     
    width: 100% !important;
    object-fit: contain !important;
    background-color: #fff;
    margin: 0 auto 15px auto !important;
    display: block;
}

.pt-part-title {
    font-size: 0.85rem !important;
    line-height: 1.3 !important;
    margin-bottom: 8px;
    color: #000;
    font-weight: 700;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pt-part-price {
    color: #d00 !important;
    font-weight: 800 !important;
    display: block;
    margin-bottom: 10px;
}

.pt-part-verified {
    font-size: 0.65rem;
    color: #fff;
    background-color: #009715;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 8px;
    border-radius: 3px;
    margin-top: auto;
    display: inline-block;
    align-self: center; 
}


/* ========================================= */
/* 10. USER MENTIONS (@TAGGING)              */
/* ========================================= */

#pt-mentions-list {
    position: absolute;
    background: #fff;
    border: 1px solid #e0e0e0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15); 
    z-index: 9999;
    width: 220px;            
    max-height: 250px;
    overflow-y: auto;
    display: none;
    border-radius: 6px;     
    padding: 5px 0;
}

.pt-mention-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;      
    border-bottom: none;    
    cursor: pointer;
    transition: background 0.1s;
}

.pt-mention-item:hover { background-color: #f5f5f5; }
.pt-mention-item img { width: 24px; height: 24px; border-radius: 50%; margin-right: 10px; object-fit: cover; }
.pt-mention-item span { font-size: 0.85rem; font-weight: 700; color: #000; display: flex; flex-direction: column; line-height: 1.2; }
.pt-mention-item span small { font-weight: 400; color: #888; font-size: 0.75rem; }

.pt-mention { color: #0056b3; font-weight: 700; text-decoration: none; }
.pt-mention:hover { text-decoration: underline; }


/* ========================================= */
/* 11. REPLY EDITOR TOOLBAR                  */
/* ========================================= */

.pt-reply-wrapper {
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    overflow: hidden;
    margin-bottom: 20px;
}

.pt-reply-toolbar {
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.pt-reply-toolbar button {
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 14px;
    padding: 4px 8px;
    border-radius: 3px;
    color: #333;
    font-weight: 600;
}
.pt-reply-toolbar button:hover { background: #e0e0e0; border-color: #ccc; }
.pt-vertical-sep { width: 1px; height: 20px; background: #ccc; margin: 0 8px; }

.pt-reply-wrapper textarea#comment {
    border: none !important;
    box-shadow: none !important;
    padding: 15px;
    width: 100%;
    outline: none;
    min-height: 150px;
    resize: vertical;
}
.pt-reply-wrapper textarea#comment:focus { background: #fff; }

/* 📸 NEW: GLOBAL MEDIA GRID CAROUSEL (Forces scroll on all screen sizes) */
.pt-post-media-grid {
    display: flex !important;
    flex-wrap: nowrap !important; /* 🚫 Prevents images from wrapping to a second line */
    overflow-x: auto !important;   /* ↔️ Enables horizontal scrolling */
    -webkit-overflow-scrolling: touch; /* Smooth scroll for touch devices */
    padding-bottom: 12px;         /* Space for the scrollbar */
    scrollbar-width: thin;         /* Standard thin scrollbar for desktop */
}

/* Keeps your existing item spacing and prevents shrinking */
.pt-post-media-grid .pt-review-media-item {
    flex: 0 0 auto !important;     /* 📏 Prevents the browser from shrinking the images */
}








/* ======================= */
/* 16. Garage Context Styling  */
/* ======================= */
.pt-garage-label {
    display: block;
    font-size: 0.65rem;
    text-transform: uppercase;
    color: #999;
    font-weight: 700;
    margin-bottom: 2px;
}
.pt-garage-car {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    color: #333;
    line-height: 1.3;
}

/* Highlight the "Project Car" on the main post */
.pt-project-car .pt-garage-label {
    color: #d00; /* Red label for "Building" */
}
.pt-project-car .pt-garage-car {
    font-size: 0.9rem; /* Slightly larger */
    color: #000;
}

/* ========================= */
/* 17. --- PART CARD ACTIONS --- */
/* ========================= */

.pt-part-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto; /* Push to bottom of card */
    padding-top: 10px;
    width: 100%;
    gap: 10px;
}

.pt-part-verified {
    font-size: 0.6rem;
    color: #fff;
    background-color: #009715; /* Green */
    font-weight: 700;
    text-transform: uppercase;
    padding: 3px 6px;
    border-radius: 2px;
}

.pt-part-action-link {
    font-size: 0.7rem;
    text-decoration: none;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s;
}

/* "Rate Part" Button Style */
.pt-part-action-link.write-review {
    color: #d00;
    border-bottom: 1px solid rgba(221, 0, 0, 0.2);
}
.pt-part-action-link.write-review:hover {
    color: #000;
    border-bottom-color: #000;
}

/* "View Part" Button Style */
.pt-part-action-link.view-part {
    color: #999;
}
.pt-part-action-link.view-part:hover {
    color: #d00;
}


/* ================== */
/* 18. Navigation Buttons */
/* ================== */
.pt-nav-btn {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    background: #fff;
    border: 1px solid #ddd;
    color: #555;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.2s;
}
.pt-nav-btn:hover {
    background: #000;
    color: #fff;
    border-color: #000;
}
.pt-nav-btn.pt-nav-create {
    background: #000;
    color: #fff;
    border-color: #000;
}
.pt-nav-btn.pt-nav-create:hover {
    background: #d00; /* Red on hover */
    border-color: #d00;
}




/* =============================== */
/* 19. REPUTATION PILL STYLING --- */
/* =============================== */

/* --- UNIVERSAL PILL BASE --- */
.pt-tier-badge, 
.pt-status-badge, 
.pt-status-pill {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    font-size: 10px !important;
    font-weight: 900 !important;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 4px 12px !important;
    line-height: 1.2;
    white-space: nowrap;
}

/* --- COLOR MAP: FORCED OVERRIDES --- */

/* 1. Planning / Rookie (Grey) */
.pt-status-planning, 
.pt-tier-rookie { 
    background-color: #7f8c8d !important; 
}

/* 2. Wrenching / Weekend Wrencher (Blue) */
.pt-status-wrenching, 
.pt-tier-wrench { 
    background-color: #007bff !important; 
}

/* 3. Tuning / Track Tuner (Green) */
.pt-status-tuning, 
.pt-tier-tuner { 
    background-color: #27ae60 !important; 
}

/* 4. Track / Pro Builder (Yellow/Amber) */
.pt-status-track, 
.pt-tier-pro { 
    background-color: #f39c12 !important; 
    color: #000 !important; /* Better contrast for yellow */
}

/* 5. Broken (Red) */
.pt-status-broken { 
    background-color: #e74c3c !important; 
}

/* 6. Completed / Legend (Black/Gold) */
.pt-status-completed { 
    background-color: #222 !important; 
}

.pt-tier-legend { 
    background: linear-gradient(135deg, #f1c40f, #f39c12) !important;
    color: #000 !important;
    box-shadow: 0 2px 5px rgba(241, 196, 15, 0.4);
}


/* ========================================= */
/* 20. CONDITIONAL REP LAYOUT                */
/* ========================================= */

/* DESKTOP BEHAVIOR: Elements remain stacked */
.pt-author-meta-container {
    display: block;
    width: 100%;
}

.pt-rep-text-styled {
    display: block; /* Keep it on its own line */
    font-size: 0.75rem; 
    font-weight: 700; 
    color: #555;
    margin-top: 3px; /* Original spacing */
}

@media (max-width: 768px) {
    .pt-author-meta-container {
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
        margin-top: 10px !important;
        gap: 8px !important;
        width: 100% !important;
    }

    .pt-badge-col {
        flex: 0 1 auto !important;
        display: flex !important;
        justify-content: flex-start !important;
    }

    .pt-rep-col {
        flex: 1 !important;
        display: flex !important;
        justify-content: flex-end !important;
        text-align: right !important;
    }

    .pt-rep-text-styled {
        margin-top: 0 !important;
        white-space: nowrap !important;
        font-size: 11px !important;
    }
}


/* ========================================= */
/* 21. USER FOLLOWING SYSTEM STYLES          */
/* ========================================= */

/* --- A. Profile Header / Directory Button (The Pill) --- */
/* FIX: We exclude .pt-follow-link so Single Topic buttons don't get messed up */
.pt-follow-btn:not(.pt-follow-link) {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    padding: 6px 18px !important;
    font-size: 11px !important;
    font-weight: 900 !important;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    border-radius: 50px !important; /* The Pill Shape */
    cursor: pointer;
    margin-left: 15px;
    
    /* Default Colors */
    background: #000;
    color: #fff !important;
    border: 2px solid #000 !important;
    
    transition: all 0.2s ease;
    vertical-align: middle;
}

/* Following State (Transparent Pill) */
.pt-follow-btn:not(.pt-follow-link).following {
    background: transparent;
    color: #000 !important;
    border-color: #eee !important;
}

/* Hover State (Red Pill) */
.pt-follow-btn:not(.pt-follow-link):hover {
    background: #d00;
    border-color: #d00 !important;
    color: #fff !important;
}

/* --- B. Text Link Fallbacks --- */
/* This handles legacy instances where it might still be an <a> tag */
a.pt-follow-link:not(.pt-button) {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    text-decoration: underline;
    text-underline-offset: 2px;
    color: #000 !important;
    transition: color 0.2s ease;
    margin-top: 5px;
}

body:not(.single-pt_forum_topic) a.pt-follow-link.following:not(.pt-button) {
    color: #999 !important;
    text-decoration-color: #eee;
}

/* --- C. Global Processing State (Prevents spam clicks) --- */
.pt-processing {
    opacity: 0.5 !important;
    pointer-events: none !important;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    /* Only apply margin to text links, not our new buttons */
    a.pt-follow-link:not(.pt-button) {
        margin-top: 2px;
        font-size: 10px;
    }
    
    /* Reset margin for the Pill Buttons on mobile */
    .pt-follow-btn:not(.pt-follow-link) {
        margin-left: 10px;
        padding: 4px 12px !important;
    }
}


/* ========================================= */
/* MEMBER DIRECTORY CARDS (Final Mod)        */
/* ========================================= */

/* 1. The Card Container (Matches Profile Page Style) */
.pt-connection-card {
    background: #fff;
    border: 1px solid #eee; /* Matches pt-profile-header */
    border-radius: 4px;
    padding: 25px;
    display: flex;
    flex-direction: column;
    height: 100%; 
    box-sizing: border-box;
    
    /* The "Profile Page" Shadow */
    box-shadow: 0 5px 15px rgba(0,0,0,0.03); 
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.pt-connection-card:hover {
    box-shadow: 0 12px 24px rgba(0,0,0,0.08); 
    border-color: #000; /* Darkens border like Build Cards */
}

/* 2. Top Row: Avatar & Name Layout */
.pt-connection-card > div:first-child {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid #f9f9f9; 
    padding-bottom: 15px;
}

.pt-connection-card a {
    text-decoration: none;
    color: inherit;
}

/* Avatar - (Matches Profile Page: White Border + Shadow) */
.pt-connection-card img.avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1); 
    flex-shrink: 0;
    object-fit: contain;
}

/* User Name Typography (Matches Profile Header) */
.pt-connection-card h4, 
.pt-connection-card h3,
.pt-connection-card a[href*="/user/"] {
    border: none; 
    margin: 0;
    font-size: 1.1rem;
    font-weight: 800; /* Extra Bold */
    text-transform: uppercase; /* Name remains Uppercase to match Profile Header */
    color: #000;
    line-height: 1.2;
    letter-spacing: 0.5px;
}

/* 3. BUTTONS CONTAINER (The 50/50 Fix) */
/* We target the container holding the buttons to ensure they split evenly */
.pt-connection-card > div:last-child {
    display: flex;
    gap: 10px; /* Space between the two buttons */
    width: 100%;
}

/* 4. SHARED BUTTON STYLES */
.pt-connection-card .pt-follow-btn, 
.pt-connection-card > div:last-child > a { 
    /* 50/50 Split Logic */
    flex: 1; 
    width: 50%; /* Fallback */
    
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 0;
    
    /* NEW TYPOGRAPHY REQUESTS */
    font-size: 0.8rem; /* Requested Size */
    text-transform: capitalize !important; /* "View Profile" */
    font-weight: 700; 
    letter-spacing: 0.2px;
    
    text-decoration: none;
    border-radius: 4px !important; 
    transition: all 0.2s ease;
    cursor: pointer;
    line-height: 1.2;
    margin: 0 !important;
}

/* --- A. "View Profile" Button (White Background) --- */
.pt-connection-card > div:last-child > a {
    background: #fff;
    color: #000 !important;
    border: 1px solid #ddd !important;
}

.pt-connection-card > div:last-child > a:hover {
    background: #f9f9f9;
    border-color: #000 !important;
    color: #000 !important;
}

/* --- B. "Follow" Button (Black Background) --- */
/* RETAINED ORIGINAL COLOR LOGIC */
.pt-connection-card .pt-follow-btn {
    background-color: #000 !important;
    color: #fff !important;
    border: 1px solid #000 !important;
}

.pt-connection-card .pt-follow-btn:hover {
    background-color: #333 !important; 
    border-color: #333 !important;
    color: #fff !important;
}

/* --- C. "Following" Button (Transparent State) --- */
.pt-connection-card .pt-follow-btn.following {
    background-color: transparent !important;
    color: #333 !important; 
    border: 1px solid #ddd !important;
}

/* Hover: Red text to indicate removal */
.pt-connection-card .pt-follow-btn.following:hover {
    background-color: #f5f5f5 !important;
    color: #d00 !important; 
    border-color: #d00 !important;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .pt-connection-card {
        padding: 20px;
    }
}



/* ========================================= */
/* 21. GALLERY IMAGE DELETE STYLES (MATCHED) */
/* ========================================= */

/* 1. THUMBNAIL WRAPPER (The Box) */
.thumbnail-wrapper {
    width: 90px !important; 
    height: 90px !important; 
    box-sizing: border-box; 
    position: relative;
    overflow: visible; /* Allows the X to sit outside the box */
    border: 1px solid #ddd; /* Matches common form borders */
    border-radius: 4px;
    flex-shrink: 0;
    background: #fff;
    margin: 0;
}

/* Ensure images fill the matched box correctly */
.thumbnail-wrapper img { 
    width: 100% !important; 
    height: 100% !important; 
    object-fit: contain !important;
    border: none !important; 
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 3px !important; 
    display: block !important;
}

/* 2. DELETE ICON (The red circle X) */
.delete-icon {
    position: absolute; 
    top: -8px; 
    right: -8px; 
    background: #d00; 
    color: #fff;
    width: 22px; 
    height: 22px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; 
    font-size: 12px; 
    font-weight: bold;
    border-radius: 50%;
    z-index: 100; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    line-height: 1;
}

/* 3. HOVER STATE - MATCHES .REVIEW-BUTTON LOGIC */
.delete-icon:hover {
    background-color: #000; /* Changes to black on hover, matching your review-button */
    transform: scale(1.1); /* Adds a slight "pop" for better feedback */
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}




/* ========================================= */
/* 23. FORUM SEARCH UI (Homepage & Results)  */
/* ========================================= */

.pt-forum-search-wrapper {
    position: relative;
    max-width: 600px;
    margin: 25px auto 0;
    z-index: 500;
}

#pt-forum-search-input {
    width: 100%;
    padding: 15px 60px 15px 20px; /* Increased right padding to clear the button */
    border-radius: 50px;
    border: 1px solid #ddd;
    font-size: 1rem;
    font-family: inherit;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    transition: all 0.2s ease;
    outline: none;
}

#pt-forum-search-btn {
    position: absolute;
    right: 6px;
    top: 6px;
    bottom: 6px;
    width: 48px;        /* Match the size seen in your screenshot */
    height: 48px;       /* Match the size seen in your screenshot */
    padding: 0 !important; /* CRITICAL FIX: Removes squishing padding */
    border-radius: 50%;
    background: #000000; /* Your Red Color */
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;       /* Ensures centering works */
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 10;
}

/* Force Icon Size & Color */
#pt-forum-search-btn svg,
#pt-forum-search-btn svg path {
    width: 24px !important;       /* Made larger (was 18px) */
    height: 24px !important;      /* Made larger (was 18px) */
    fill: none !important;
    stroke: #ffffff !important;   /* Force White */
    stroke-width: 2.5;
    color: #ffffff !important;
}

#pt-forum-search-btn:hover {
    background: #d32f2f; /* Darker red on hover */
}


/* ========================================= */
/* 24. SEARCH PAGINATION STYLES (Flat/No-Anim) */
/* ========================================= */

/* Wrapper Container */
.pt-forum-pagination {
    margin-top: 50px !important;
    margin-bottom: 60px !important; /* Increased bottom margin to protect footer */
    padding-top: 20px;
    padding-bottom: 20px;
    text-align: center;
    width: 100%;
    display: block;
    
    /* 🏆 FIX: Prevent overlap */
    clear: both; 
    position: relative;
    z-index: 10;
}

/* The List Container */
.pt-forum-pagination ul.page-numbers {
    display: inline-flex !important;
    flex-wrap: wrap !important; /* 🏆 FIX: Allow wrapping on small screens */
    justify-content: center;
    align-items: center;
    gap: 8px;
    list-style: none !important;
    padding: 0 !important;
    border: none !important;
    margin: 0 !important;
}

/* Individual List Items */
.pt-forum-pagination ul.page-numbers li {
    margin: 0 !important;
    padding: 0 !important;
    display: inline-block !important;
    
    /* 🏆 FIX: Vertical spacing if items wrap to next line */
    margin-bottom: 10px !important; 
}

/* The Buttons (Base Style) */
.pt-forum-pagination .page-numbers {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    min-width: 45px;
    height: 40px;
    
    /* 1. Background removed (Transparent) */
    background: transparent; 
    border: 1px solid #ddd;
    color: #333;
    
    font-size: 0.9rem;
    font-weight: 800;
    text-decoration: none;
    border-radius: 4px;
    
    /* 2. Transition removed (Instant change) */
    transition: none; 
    
    line-height: 1;
    box-sizing: border-box;
}

/* Hover State - Dim White/Light Gray */
.pt-forum-pagination a.page-numbers:hover {
    background: #e0e0e0; /* Slightly darker gray so it is visible against transparent */
    color: #000;
    border-color: #bbb;
    transition: none;    /* Ensure no transition on hover */
    transform: none;     /* Removed the "lift" movement */
    box-shadow: none;    /* Removed shadow for a flatter look */
}

/* Current Page (Active) - Solid Black */
.pt-forum-pagination span.page-numbers.current {
    background: #000;
    color: #fff;
    border-color: #000;
    cursor: default;
}

/* "Dots" styling */
.pt-forum-pagination span.page-numbers.dots {
    border: none;
    background: transparent;
    color: #999;
    padding: 0 5px;
    min-width: auto;
}

/* Prev/Next Text Adjustments */
.pt-forum-pagination .next,
.pt-forum-pagination .prev {
    padding-left: 20px;
    padding-right: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.8rem;
}


/* ======================== */
/* 25. PRIVATE MESSAGING CHAT  */
/* ======================== */

.pt-chat-window {
    background: #fcfcfc;
    border: 1px solid #e5e5e5;
    /* Custom Scrollbar */
    scrollbar-width: thin;
    scrollbar-color: #ddd #f9f9f9;
}

.pt-chat-window::-webkit-scrollbar {
    width: 8px;
}
.pt-chat-window::-webkit-scrollbar-track {
    background: #f9f9f9;
}
.pt-chat-window::-webkit-scrollbar-thumb {
    background-color: #ddd;
    border-radius: 4px;
}

.pt-msg-bubble p {
    margin: 0; /* Remove paragraph spacing inside bubbles */
}

/* My Messages (Right) */
.pt-msg-self .pt-msg-bubble {
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* Other Messages (Left) */
.pt-msg-other .pt-msg-bubble {
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* Reply Form Focus */
.pt-reply-form textarea:focus {
    border-color: #000;
    outline: none;
    background: #fff;
}

/* Custom Scrollbar for Inbox List */
.pt-inbox-list::-webkit-scrollbar {
    width: 6px;
}
.pt-inbox-list::-webkit-scrollbar-track {
    background: #f1f1f1;
}
.pt-inbox-list::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}
.pt-inbox-list::-webkit-scrollbar-thumb:hover {
    background: #000;
}

/* ========================================= */
/* 26. NEW BREADCRUMBS & DELETE BUTTON UI    */
/* ========================================= */

/* --- A. Breadcrumb Buttons (Top Bar) --- */
.pt-breadcrumbs-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

.pt-crumb-btn {
    display: inline-flex;
    align-items: center;
    padding: 8px 14px;
    background: #ffffff;
    border: 1px solid #ddd;
    color: #444;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.pt-crumb-btn:hover {
    background: #000;
    color: #fff;
    border-color: #000;
}

.pt-crumb-sep {
    font-size: 1.2rem;
    color: #bbb;
    font-weight: 300;
    margin: 0 2px;
}

/* --- B. Top Right Delete Icon (Replies) --- */
.pt-reply-delete-container {
    /* Position is handled inline for strict overrides, but defined here too */
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 50;
}

.pt-delete-reply-btn {
    background: #fff !important;
    border: 1px solid #ddd !important;
    color: #d00 !important;
    cursor: pointer;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.pt-delete-reply-btn:hover {
    background: #fff !important;
    color: #d00 !important;
    border-color: #d00 !important;
}

/* Mobile adjustments for breadcrumbs */
@media (max-width: 768px) {
    .pt-breadcrumbs-container {
        gap: 5px;
    }
    .pt-crumb-btn {
        padding: 6px 10px;
        font-size: 0.7rem;
    }
    
    /* Ensure delete button doesn't overlap text on small screens */
    .pt-post-meta {
        padding-right: 40px; /* Make room for the X */
    }
}

/* ========================================= */
/* 27. RESPONSIVE BUTTON TOGGLES             */
/* ========================================= */

/* Default (Desktop): Hide the mobile button */
.pt-mobile-only {
    display: none !important;
}

/* Mobile Screens (< 768px) */
@media (max-width: 768px) {
    
    /* 1. Hide the Desktop Button from the top-right container */
    .pt-desktop-only {
        display: none !important;
    }

    /* 2. Show the Mobile Button inside the meta area */
    .pt-mobile-only {
        display: block !important;
        text-align: left;
    }
}



/* =========================================================
   28. HOMEPAGE & ARCHIVE VIEWS
   ========================================================= */

/* The Stats Bar Links */
.pt-stats-bar a {
    display: block;
    width: 100%;
    height: 100%;
    transition: opacity 0.2s;
}
.pt-stats-bar a:hover {
    opacity: 0.7;
}

/* Members Grid */
.pt-members-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.pt-member-card {
    background: #fff;
    border: 1px solid #eee;
    padding: 25px;
    border-radius: 8px;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.pt-member-card:hover {
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

.pt-member-card h3 {
    margin: 10px 0 5px 0;
    font-size: 1.1rem;
    font-weight: 800;
    color: #000;
}

/* --- One-Click Follow Button --- */
.pt-member-card .pt-follow-link {
    display: block;
    width: 100%;
    margin-top: 15px;
    padding: 10px 0;
    border-radius: 4px;
    
    /* Typography */
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    text-decoration: none;
    letter-spacing: 1px;
    text-align: center;

    /* 1. DEFAULT STATE: "Follow" (Solid Black) */
    background: #000;
    color: #fff;
    border: 1px solid #000;
    
    /* Polish */
    cursor: pointer;
    transition: all 0.2s ease;
}

/* Hover on "Follow" */
.pt-member-card .pt-follow-link:hover {
    background: #333;
    border-color: #333;
    color: #.pt-follow-link:not(.pt-button):hoverf;
}

/* 2. ACTIVE/FOLLOWING STATE: "Dimmed" (Neutral Grey) */
.pt-member-card .pt-follow-link.following {
    background: #f5f5f5;
    color: #999;
    border: 1px solid #eee;
}

/* 3. HOVER ON FOLLOWING: "Unfollow" (Red Warning) */
.pt-member-card .pt-follow-link.following:hover {
    background: #fff;
    color: #d00;
    border-color: #d00;
}

/* OPTIONAL: CSS-only Text Change on Hover */
/* Use this if you don't want to rely on JS to change text from 'Following' to 'Unfollow' */
.pt-member-card .pt-follow-link.following:hover .pt-btn-text {
    display: none;
}
.pt-member-card .pt-follow-link.following:hover:after {
    content: "Unfollow";
}

/* Section Headers (Homepage) */
.pt-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 2px solid #000;
    padding-bottom: 10px;
}

.pt-section-header h2 {
    margin: 0;
    font-size: 1.5rem;
    text-transform: uppercase;
    font-weight: 800;
    color: #000;
}

/* =========================================================
   29. HOMEPAGE TRIBE CARDS (Ported from Tribe Styles)
   ========================================================= */

/* The Grid Container */
.pt-tribes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

/* The Card Itself */
.pt-tribe-card {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

/* The Clickable Link Wrapper */
.pt-card-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Cover Image Area */
.pt-card-cover {
    height: 140px;
    background-size: cover;
    background-position: center;
    background-color: #333;
    position: relative;
}

/* Card Body (White Area) */
.pt-card-body {
    padding: 20px;
    flex-grow: 1;
    position: relative; /* For badge positioning */
}

/* Privacy Badges (Top Right of Body) */
.pt-card-badges {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 5;
}

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

.pt-badge.public { 
    background: #ecfdf5; 
    color: #047857; 
    border: 1px solid #a7f3d0; 
}

.pt-badge.private { 
    background: #fffbeb; 
    color: #b45309; 
    border: 1px solid #fcd34d; 
}

/* Typography */
.pt-card-title {
    margin: 0 0 8px 0;
    font-size: 1.1rem;
    font-weight: 800;
    color: #000;
    padding-right: 70px; /* Space for badge */
    line-height: 1.3;
}

.pt-card-meta {
    display: flex;
    flex-wrap: wrap; /* Allows items to drop to next line if container is narrow */
    gap: 12px;
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f3f4f6; /* Keeps the separation clean */
}

.pt-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap; /* Prevents icon and text from splitting */
}

.pt-meta-item strong {
    color: #000;
}

.pt-card-excerpt {
    font-size: 0.9rem;
    color: #555;
    line-height: 1.5;
    margin: 0;
}

/* Footer (View Button) */
.pt-card-footer {
    padding: 12px 20px;
    background: #f9f9f9;
    border-top: 1px solid #eee;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: #d00;
    text-transform: uppercase;
}

/* Fix for Red Button Sizing in Header */
.pt-section-header .pt-button.secondary {
    width: auto !important;
    display: inline-block;
}

/* ========================================= */
/* 30. MOBILE RESPONSIVENESS (THE FIX)       */
/* ========================================= */

@media (max-width: 900px) {
    
    /* 1. Stack the Main Grid (Content on top, Sidebar below) */
    .pt-forum-grid {
        grid-template-columns: 1fr !important;
        gap: 40px;
    }

    /* 2. Fix the Stats Bar (Make it a 2x2 Grid) */
    .pt-stats-bar {
        flex-wrap: wrap;
        padding: 20px 10px;
    }
    .pt-stats-bar .pt-stat-col {
        width: 50% !important; /* Force 2 columns */
        border: none !important; /* Remove desktop borders */
        margin-bottom: 20px;
    }
    .pt-stats-bar .pt-stat-col.middle {
        width: 50% !important;
        border: none !important;
    }
    /* Add subtle borders for the 2x2 layout */
    .pt-stats-bar .pt-stat-col:nth-child(odd) {
        border-right: 1px solid #eee !important;
    }
    .pt-stats-bar .pt-stat-col:nth-child(1),
    .pt-stats-bar .pt-stat-col:nth-child(2) {
        border-bottom: 1px solid #eee !important;
        margin-bottom: 20px;
    }
    .pt-stat-number { font-size: 1.8rem; }

    /* 3. Fix the Topic/Activity Tables (Override PHP inline styles) */
    
    /* Hide the Header row on mobile (Label "Topic", "Replies", etc.) */
    .pt-table-header {
        display: none !important;
    }
  
    /* Adjust the Main Topic Title Area */
    .pt-topic-title {
        grid-column: 1 / 2;
    }
    .pt-topic-title h3 {
        font-size: 0.95rem;
    }

    /* 4. Search Bar Adjustments */
    .pt-forum-search-wrapper {
        margin: 20px 15px 0 !important;
        width: auto !important;
    }
    #pt-forum-search-input {
        font-size: 16px; /* Prevents iOS zoom on focus */
        padding: 12px 50px 12px 20px !important;
    }
    #pt-forum-search-btn {
        width: 40px !important;
        height: 40px !important;
        right: 5px !important;
        top: 5px !important;
    }

    /* 5. Header Typography */
    .pt-main-title {
        font-size: 1.8rem;
        line-height: 1.2;
    }
    .pt-sub-title {
        font-size: 1rem;
        padding: 0 20px;
    }

    /* 6. Tribe Cards */
    .pt-tribes-grid {
        /* Force 1 column on mobile */
        grid-template-columns: 1fr !important;
    }
    
    /* 7. Category List Padding */
    .pt-cat-item {
        padding: 15px !important;
        flex-wrap: wrap; /* Allow wrapping if text is long */
    }
    .pt-cat-info {
        max-width: 80%;
    }
    .pt-cat-icon {
        display: none; /* Hide icon on tiny screens to save space */
    }
}

/* =========================================================
   30. (A) UNIFIED BADGE STYLES (Public & Private)
   ========================================================= */

/* Base Badge Shape (Uniform for both) */
.pt-forum-wrapper .pt-badge {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    font-size: 10px !important;
    font-weight: 800 !important;
    text-transform: uppercase;
    padding: 3px 10px !important;
    border-radius: 4px !important;
    letter-spacing: 0.05em;
    line-height: 1;
    border: 1px solid transparent !important; /* Prepare for border */
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    white-space: nowrap;
    min-width: 60px; /* Optional: Forces equal width */
    text-align: center;
}

/* 🔒 PRIVATE (Black & White - Existing Style) */
.pt-forum-wrapper .pt-badge.private {
    background: #1a1a1a !important;
    color: #ffffff !important;
    border-color: #000 !important;
}

/* 🌍 PUBLIC (Green & Dark Green - Matching Style) */
.pt-forum-wrapper .pt-badge.public {
    background: #ecfdf5 !important; /* Light Mint Green */
    color: #047857 !important;      /* Dark Green Text */
    border-color: #a7f3d0 !important; /* Green Border */
}

/* Positioning inside Topic Title (Desktop) */
.pt-topic-title h3 {
    display: flex !important;
    align-items: center !important;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0;
    line-height: 1.2;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .pt-topic-title h3 {
        display: block !important; 
    }
    
    .pt-forum-wrapper .pt-badge {
        display: inline-block !important;
        margin-left: 0;
    }
}



/* ========================================================= */
/* 31. MOBILE SORT BAR & RESPONSIVENESS                      */
/* ========================================================= */

/* 1. Hide on Desktop */
.pt-mobile-sort-wrapper {
    display: none;
}

@media (max-width: 768px) {
    
    /* 2. Global Mobile Adjustments */
    .pt-category-header, 
    .pt-forum-page-header { 
        flex-direction: column; 
        align-items: flex-start; 
        gap: 15px; 
    }
    .pt-header-actions { 
        width: 100%; 
        flex-direction: column; 
        align-items: stretch; 
    }
    .pt-forum-search-wrapper { 
        width: 100% !important; 
        max-width: 100% !important; 
    }
    .pt-button { 
        width: 100%; 
        text-align: center; 
        box-sizing: border-box; 
    }
    .desktop-only { display: none !important; }

    /* 3. NEW WRAPPER (Flex Container) */
    .pt-mobile-sort-wrapper {
        display: flex;
        align-items: center;
        width: 100%;
        border-bottom: 1px solid #f0f0f0;
        margin-bottom: 15px;
        background: #fff;
        position: relative;
        z-index: 20; /* High z-index to sit above table */
    }

    /* 4. CONTROLS (Label + Tooltip) - STATIC */
    .pt-sort-controls {
        display: flex;
        align-items: center;
        gap: 6px;
        padding: 10px 10px 10px 5px;
        flex-shrink: 0; /* Prevent shrinking */
        background: #fff;
        position: relative;
        z-index: 30; /* Sit above scrolling chips */
        box-shadow: 2px 0 5px rgba(0,0,0,0.02); /* Subtle separator */
    }

    .pt-sort-label {
        font-weight: 800;
        font-size: 0.75rem;
        color: #999;
        text-transform: uppercase;
    }

    .pt-sort-help {
        display: inline-flex;
        justify-content: center;
        align-items: center;
        width: 20px;
        height: 20px;
        border-radius: 50%;
        background: #f0f0f0;
        color: #666;
        font-size: 0.7rem;
        font-weight: bold;
        cursor: help;
        position: relative; /* Anchor for popup */
    }

    /* 5. TOOLTIP POPUP (Fixed Z-Index Issue) */
    .pt-sort-help:focus::after,
    .pt-sort-help:active::after {
        content: attr(data-title);
        position: absolute;
        top: 130%; /* Push down */
        left: 0;
        width: 220px;
        background: #222;
        color: #fff;
        padding: 10px 14px;
        border-radius: 6px;
        font-size: 0.75rem;
        font-weight: 500;
        line-height: 1.4;
        white-space: normal;
        z-index: 9999; /* Maximum z-index */
        box-shadow: 0 5px 15px rgba(0,0,0,0.3);
        pointer-events: none;
    }
    
    /* Little arrow for tooltip */
    .pt-sort-help:focus::before,
    .pt-sort-help:active::before {
        content: "";
        position: absolute;
        top: 90%;
        left: 5px;
        border: 6px solid transparent;
        border-bottom-color: #222;
        z-index: 9999;
    }

    /* 6. SCROLLABLE CHIPS BAR */
    .pt-mobile-sort-bar {
        display: flex;
        align-items: center;
        gap: 8px;
        overflow-x: auto;
        white-space: nowrap;
        padding: 10px 5px;
        flex-grow: 1; /* Take remaining space */
        -webkit-overflow-scrolling: touch; 
        scrollbar-width: none;
    }
    .pt-mobile-sort-bar::-webkit-scrollbar { display: none; }

    /* 7. CHIPS STYLING */
    .pt-sort-chip {
        display: inline-flex;
        align-items: center;
        gap: 5px;
        padding: 6px 12px;
        border-radius: 50px;
        background: #fff;
        color: #555 !important;
        font-size: 0.8rem;
        font-weight: 600;
        text-decoration: none !important;
        border: 1px solid #e0e0e0;
        flex: 0 0 auto;
        transition: all 0.2s ease;
    }

    .pt-sort-chip.active {
        background: #000 !important;
        color: #fff !important;
        border-color: #000 !important;
        box-shadow: 0 3px 8px rgba(0,0,0,0.15);
    }

    .pt-chip-icon { font-size: 0.95rem; line-height: 1; }
    .pt-sort-chip .sort-arrow { font-size: 0.7rem; min-width: 10px; }

    /* 8. TABLE LAYOUT */
    .pt-table-row {
        grid-template-columns: 1fr !important;
        gap: 10px;
        padding: 15px;
        border-bottom: 1px solid #eee;
    }
    .pt-meta-cell { display: inline-block; margin-right: 15px; font-size: 0.8rem; }
    .pt-meta-cell.light { color: #666; }
    .pt-meta-cell.light:before { content: "💬 "; opacity:0.6; }
    .pt-date-cell { text-align: left !important; font-size: 0.75rem; color: #999; margin-top: 5px; }
}


@media (max-width: 768px) {
    /* 1. UNWRAP THE GRID */
    .pt-forum-grid {
        display: flex !important;
        flex-direction: column !important;
    }

    /* 2. MAKE SIDEBAR BOXES INDEPENDENT */
    .pt-sidebar {
        display: contents !important; /* This allows the children to ignore the sidebar wrapper */
    }

    /* 3. SEARCH ICON RE-CENTER */
    #pt-forum-search-btn {
        right: 6px !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        margin: 0 !important;
    }
}


/* Hide mobile-specific top box on desktop */
.pt-mobile-top-promo {
    display: none;
}

@media (max-width: 900px) {
    /* Show promo above stats on mobile */
    .pt-mobile-top-promo {
        display: block;
        margin-bottom: 25px;
    }

    /* Hide the duplicate box from the bottom sidebar area on mobile */
    .pt-desktop-sidebar-wrapper {
        display: none;
    }

    /* Fix Search Input Viewport Containment */
    .pt-forum-search-wrapper {
        width: 100% !important;
        max-width: 100% !important;
        margin: 20px 0 !important;
        padding: 0 5px; /* Tiny buffer for rounding */
        box-sizing: border-box;
    }

    #pt-forum-search-input {
        width: 100% !important;
        box-sizing: border-box; /* Crucial for keeping width within viewport */
        padding-right: 55px !important; /* Space for the search icon button */
    }

    #pt-forum-search-btn {
        right: 12px !important; /* Position correctly inside the padded wrapper */
        top: 50% !important;
        transform: translateY(-50%) !important;
        margin: 0 !important;
    }
}


/* ========================================= */
/* 🛠️ MOBILE SEARCH TRUNCATION FIX           */
/* ========================================= */

@media (max-width: 768px) {
    /* 1. Ensure the wrapper doesn't have fixed margins or widths */
    .pt-forum-search-wrapper {
        width: 100% !important;
        max-width: 100% !important;
        margin: 25px 0 0 0 !important;
        padding: 0 15px !important; /* Breathing room from screen edges */
        box-sizing: border-box !important;
    }

    /* 2. Fix the Input width logic */
    #pt-forum-search-input {
        width: 100% !important;
        box-sizing: border-box !important; /* CRITICAL: Includes padding in width */
        font-size: 16px !important;       /* Prevents iOS auto-zoom on focus */
        padding: 12px 55px 12px 18px !important; /* Extra right padding for the button */
        height: 50px !important;
    }

    /* 3. Absolute position the button relative to the wrapper */
    #pt-forum-search-btn {
        right: 20px !important;   /* Aligned within the wrapper's 15px padding */
        top: 50% !important;
        transform: translateY(-50%) !important;
        width: 38px !important;
        height: 38px !important;
        position: absolute !important;
        margin: 0 !important;
    }
}


/* Ensure the new wrapper link doesn't change text colors */
.pt-cat-item-link {
    display: block;
    text-decoration: none !important;
}

/* Move the hover effect from the item to the link parent if needed, 
   or keep it on the item as it will still trigger. */
.pt-cat-item-link:hover .pt-cat-item {
    background-color: #000;
    padding-left: 35px; /* Keeps your existing hover animation */
}

/* Ensure the title inside the clickable card looks correct */
.pt-cat-item-link .pt-cat-title {
    color: #000;
    transition: color 0.2s;
}




/* ============================================================ */
/* 32. UNIFIED CLICKABLE ROW SYSTEM (Categories, Tables, Cards) */
/* ============================================================ */

/* 1. PARENT CONTAINERS - Set as the anchor point */
.pt-table-row, 
.pt-cat-item, 
.pt-connection-card {
    position: relative !important;
    transition: all 0.3s ease;
}

.pt-cat-item: hover {
	background-color: #fff;
}

/* 2. THE MASTER LINK - The 'Invisible Stretcher' Layer */
/* Use class="pt-master-link" in your PHP for all clickable containers */
.pt-master-link {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 5 !important; /* Above the background, below specific buttons */
    cursor: pointer !important;
    display: block !important;
    text-indent: -9999px; /* Hides text visually for accessibility */
    background: transparent !important;
    
    /* Grid fix for mobile archive tables */
    grid-column: 1 / -1 !important;
    grid-row: 1 / span 20 !important;
}

/* 3. THE SAFETY LAYER - Keep these clickable on top of the Master Link */
/* This ensures you can still click an author's name or a button inside a clickable row */
.pt-table-row a:not(.pt-master-link),
.pt-cat-item a:not(.pt-master-link),
.pt-table-row button,
.pt-author-cell a,
.pt-solver-info a,
.pt-follow-btn,
.pt-part-action-link,
.pt-badge {
    position: relative !important;
    z-index: 10 !important; /* Higher than master-link */
    pointer-events: auto !important; 
}

/* 4. PASS-THROUGH LAYER - Non-interactive text/stats */
/* This ensures clicks go "through" the description and icons to hit the link */
.pt-cat-info, 
.pt-cat-stats, 
.pt-cat-icon,
.pt-topic-title:not(a) {
    pointer-events: none; 
    z-index: 1;
}




/* 6. MOBILE ADJUSTMENTS */

/* --- Visibility Controls --- */
.pt-mobile-only { display: none !important; }
.pt-desktop-only { display: block !important; }

@media (max-width: 900px) {
    .pt-mobile-only { 
        display: block !important; 
    }
    .pt-desktop-only { 
        display: none !important; 
    }

    /* Keep the grid as a column, but without special ordering */
    .pt-forum-grid {
        display: flex !important;
        flex-direction: column !important;
    }
    
    /* The light sidebar box will now naturally fall to the very bottom */
    .pt-sidebar {
        margin-top: 20px;
    }
}






/* ========================================= */
/* 1. POST TYPE PILLS (Unified Styles)       */
/* ========================================= */
.pt-type-pill {
    display: inline-flex !important;
    align-items: center;
    font-size: 10px !important;
    font-weight: 900 !important;
    text-transform: uppercase;
    padding: 3px 10px !important;
    border-radius: 4px !important;
    line-height: 1.2;
    border: 1px solid transparent;
    white-space: nowrap;
}

/* Post Type Color Palette */
.pt-type-discussion { background-color: #f7fafc; color: #4a5568; border-color: #edf2f7; }
.pt-type-project { background-color: #eef2ff; color: #4338ca; border-color: #c7d2fe; }
.pt-type-question { background-color: #fffaf0; color: #c05621; border-color: #feebc8; }



/* ========================================= */
/* GENERAL ARCHIVE - MOBILE (Badges at Bottom)     */
/* ========================================= */
@media (max-width: 768px) {
    .pt-table-row {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        background: #fff !important;
        margin-bottom: 15px !important;
        padding: 15px !important;
        border: 1px solid #eee !important;
        border-radius: 8px !important;
        gap: 0 !important;
    }

    /* Row 1: Title & Avatar Group */
    .pt-topic-title {
        order: 1;
        display: flex !important;
        width: 100%;
        margin-bottom: 8px;
    }

    /* 🏆 Row 2: Date Info - Updated to swap text order */
    .pt-date-cell {
        order: 2;
        width: 100%;
        text-align: left !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: baseline;
        gap: 4px; /* Tight gap for "Last active: date" */
        margin-bottom: 12px;
    }

    /* Swap the visual order using flex order */
    .pt-date-cell span:last-child { 
        order: 1; /* "Last Active" comes first */
        font-size: 0.7rem !important;
        color: #999;
    }
    
    .pt-date-cell span:last-child::after {
        content: ":"; /* Adds the colon after "Last Active" */
    }

    .pt-date-cell span:first-child { 
        order: 2; /* The Actual Date comes second */
        font-size: 0.75rem !important;
        font-weight: 700;
        color: #d00 !important;
    }

    /* Row 3: The Badge Bar (Moved to Bottom) */
    .pt-mobile-meta-row {
        display: flex !important;
        order: 3;
        width: 100%;
        align-items: center;
        gap: 8px;
        padding-top: 10px;
        border-top: 1px solid rgba(0,0,0,0.04);
    }

    .pt-mobile-replies {
        display: flex !important;
        margin-left: 0 !important;
        font-size: 10px !important;
        font-weight: 800 !important;
        color: #666 !important;
        background: #f9f9f9;
        padding: 3px 10px;
        border-radius: 4px;
        border: 1px solid #eee;
        white-space: nowrap;
    }

    .pt-replies-label {
        display: inline !important;
        margin-left: 4px;
        opacity: 0.8;
    }

    .pt-table-row > .pt-state-cell,
    .pt-table-row > .pt-meta-cell,
    .pt-table-row > .pt-type-cell {
        display: none !important;
    }
}




/* ========================================= */
/* 3. DESKTOP ALIGNMENT FIX (Min-width: 769px)*/
/* ========================================= */
@media (min-width: 769px) {
    .pt-mobile-meta-row {
        display: none !important;
    }
}





/* ========================================= */
/* STYLES FOR SOLVED BY ARCHIVE */
/* ========================================= */

@media (max-width: 768px) {
    .pt-date-cell.desktop-only { 
        display: none !important; 
    }

    .pt-table-row:not(.pt-table-header):has(.pt-solution-preview) {
        display: flex !important;
        flex-direction: column !important;
        padding: 15px !important;
        width: 100% !important;
    }

    .pt-topic-title { order: 1 !important; margin-bottom: 12px !important; }
    .pt-solution-preview { order: 2 !important; margin-bottom: 15px !important; }
    .pt-solver-info { order: 3 !important; margin-bottom: 15px !important; }
    .pt-mobile-meta-row.pt-mobile-only { order: 4 !important; }

    /* 🏆 Solver Info Vertical Centering */
    .pt-solver-info {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        background: #fcfcfc !important;
        padding: 0 12px !important;
        border-radius: 4px;
        width: 100% !important;
        box-sizing: border-box;
        border: 1px solid #f0f0f0 !important;
        min-height: 48px !important;
        max-height: 48px !important;
        overflow: hidden;
    }

    .pt-solver-link {
        flex: 1 1 auto !important;
        display: flex !important;
        align-items: center !important;
        height: 100% !important;
        min-width: 0;
    }

    .pt-solver-text-wrapper {
        display: flex !important; /* Changed to flex for precise axis control */
        font-size: 0.85rem;
        line-height: 1 !important;
        height: 100%;
        gap: 4px;
    }

    .pt-mobile-op-footer {
        flex: 0 0 auto !important;
        display: inline-flex !important;
        align-items: center !important;
        height: 100%;
        font-size: 0.65rem !important;
        color: #bbb !important;
        font-weight: 800;
        text-transform: uppercase;
        margin-left: 10px;
        line-height: 1 !important;
    }

    /* 🏆 Meta Row (Badges/Date) Vertical Centering */
    .pt-mobile-meta-row.pt-mobile-only {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        width: 100% !important;
        margin-top: 5px !important;
        padding-top: 10px !important;
        border-top: 1px solid rgba(0,0,0,0.04);
        line-height: 1 !important;
    }

    /* Force the badge container to also be a centered flexbox */
    .pt-mobile-meta-row.pt-mobile-only > div:first-child {
        display: flex !important;
        align-items: center !important;
        gap: 8px;
    }

    .pt-mobile-date-text {
        color: #444 !important;
        font-weight: 800;
        font-size: 0.75rem;
        display: flex !important;
        align-items: center !important;
        height: 100%;
    }
}






/* ========================================= */
/* STYLES FOR COMMENTS ARCHIVE    */
/* ========================================= */

@media (max-width: 768px) {
    /* 1. Card Container Structure */
    .pt-comment-row {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important; /* Forces global left alignment */
        padding: 15px !important;
        gap: 0 !important;
    }

    /* Row 1: Author Group (Already contains avatar/name) */
    .pt-comment-row .pt-topic-title {
        order: 1 !important;
        width: 100% !important;
        margin-bottom: 10px !important;
        pointer-events: auto !important; /* Allow clicking author name */
    }
  
    /* Row 2: Comment Preview Box */
    .pt-comment-preview {
        order: 2 !important;
        width: 100% !important;
        margin-bottom: 12px !important;
        padding: 10px;
        border-radius: 4px;
        border: 1px solid #f0f0f0;
        box-sizing: border-box;
    }

    /* Row 3: Badge Bar (Privacy + Parent Type) */
    .pt-comment-row .pt-mobile-meta-row {
        order: 3 !important;
        margin-bottom: 10px !important;
        padding-bottom: 8px !important;
        border-bottom: 1px solid rgba(0,0,0,0.03);
        width: 100%;
        display: flex !important;
        justify-content: flex-start !important;
        gap: 8px;
    }

    .pt-comment-preview div {
        font-size: 0.75rem !important;
        font-weight: 700;
        margin-bottom: 4px;
    }

    /* Row 4: Date Row (Strictly Left Aligned) */
    .pt-comment-row .pt-date-cell {
        order: 4 !important;
        display: flex !important;
        flex-direction: row !important;
        justify-content: flex-start !important; /* 🚀 Anchor to the left */
        align-items: baseline !important;
        width: 100% !important;
        gap: 6px !important;
        text-align: left !important;
        margin: 0 !important;
    }

    /* Date Text Styling */
    .pt-comment-row .pt-date-cell span:first-child {
        color: #d00 !important; /* Piston Tribe Red */
        font-weight: 700 !important;
        font-size: 0.75rem !important;
    }

    /* 'Last Active' Text Styling */
    .pt-comment-row .pt-date-cell span:last-child {
        font-size: 0.7rem !important;
        text-transform: lowercase !important;
        color: #999 !important;
    }
}



@media (max-width: 768px) {
    /* This generic selector will now catch activity.php, archive.php, and index.php */
    .pt-table-row {
        display: flex !important;
        flex-direction: column !important;
        background: #fff !important;
        margin-bottom: 15px !important;
        padding: 15px !important;
        border: 1px solid #eee !important;
        border-radius: 8px !important;
    }

    /* Standardizes the Activity Date placement to match other cards */
    .pt-activity-container .pt-date-cell {
        order: 2 !important;
        text-align: left !important;
    }
}