:root {
    --bg-primary: #f8fafc;
    --text-main: #111827;
    --font: 'Red Hat Display', sans-serif;
    --pill-bg: #111827;
    --pill-text: #ffffff;
}

body.dark-mode {
    --bg-primary: #000000;
    --text-main: #ffffff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-main);
    min-height: 100vh;
    padding-bottom: 100px; /* Space for the floating pill */
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Header Sections */
.club-header {
    padding: 2rem 1.25rem 1rem 1.25rem;
    position: relative;
    z-index: 10;
    min-height: 120px;
}

.club-title {
    font-size: 2.8rem;
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: -1.5px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.club-title span {
    color: #a1a1aa; /* Gray text for "Today" or "Club" */
    font-weight: 800;
}

.header-actions {
    position: absolute;
    top: 2.5rem;
    right: 1.25rem;
    display: flex;
    gap: 15px;
    font-size: 1.3rem;
    color: var(--text-main);
}

.club-subtitle {
    margin-top: 1rem;
    font-size: 1.15rem;
    font-weight: 800;
    display: flex;
    align-items: flex-start;
}
.club-subtitle sup {
    font-size: 0.6rem;
    color: #a1a1aa;
    margin-left: 2px;
}

/* Masonry Feed */
.masonry-feed {
    padding: 0.5rem 1.25rem 2rem 1.25rem;
    column-count: 2;
    column-gap: 12px;
}

/* Fallback for single column on extremely tiny screens */
@media (max-width: 320px) {
    .masonry-feed { column-count: 1; }
}

.post-card {
    position: relative;
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    page-break-inside: avoid;
    display: inline-block;
    width: 100%;
    margin-bottom: 12px;
    border-radius: 20px;
    overflow: hidden;
    background: #e5e7eb;
    transform: translateZ(0); /* Anti-flicker */
    vertical-align: top;
}

/* The actual image inside the card */
.post-image {
    width: 100%;
    display: block;
    object-fit: cover;
    border-radius: 20px;
}

/* Deep gradient overlay for text readability */
.post-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(180deg, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0) 30%, rgba(0,0,0,0) 60%, rgba(0,0,0,0.6) 100%);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 1rem;
    pointer-events: none; /* Let image capture clicks if needed */
}

.post-title h3 {
    color: #ffffff;
    font-size: 1.3rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

/* Bottom info inside the card */
.post-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.post-author {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.75rem;
    font-weight: 500;
    text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}
.post-author span {
    opacity: 0.7;
    margin-left: 2px;
}

.post-actions {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
}

/* User Avatar variations */
.avatar-floating {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    aspect-ratio: 1;
    border-radius: 50%;
    object-fit: cover;
    pointer-events: none;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

/* Text-only Cards (Like the James Carter one) */
.post-card-text {
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    page-break-inside: avoid;
    display: inline-flex;
    width: 100%;
    background: transparent;
    padding: 0.5rem 0 1rem 0;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}
.post-card-text .small-avatar {
    width: 44px; height: 44px;
    border-radius: 50%;
    object-fit: cover;
}
.post-card-text .text-info {
    flex: 1;
}
.post-card-text h4 {
    font-size: 0.9rem;
    font-weight: 800;
    margin-bottom: 2px;
}
.post-card-text p {
    font-size: 0.75rem;
    color: #a1a1aa;
    font-weight: 500;
}
.post-card-text .action-dots {
    color: #a1a1aa;
    font-size: 1.2rem;
}


/* Floating Bottom Navigation Pill - Match Screenshot EXACTLY */
.club-nav-pill-wrapper {
    position: fixed;
    bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px; /* Spread apart */
}

/* 1. Back Button (Dark Circle) */
.pill-back {
    width: 60px; height: 60px;
    border-radius: 50%;
    background: rgba(30, 30, 30, 0.85);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    color: #ffffff;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem;
    text-decoration: none;
    transition: transform 0.2s;
    box-shadow: 0 15px 40px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.08);
}
.pill-back:active { transform: scale(0.9); }

/* 2. Post Button Group (White Pill) */
.pill-post-group {
    background: #ffffff;
    border-radius: 100px;
    display: flex;
    align-items: center;
    padding: 6px 6px 6px 20px;
    color: #000000;
    box-shadow: 0 15px 40px rgba(0,0,0,0.2);
    text-decoration: none;
    transition: transform 0.2s;
    border: 1px solid rgba(255,255,255,0.8);
}
.pill-post-group:active { transform: scale(0.95); }

.pill-post-text {
    font-weight: 800;
    font-size: 1.05rem;
    margin-right: 15px;
    display: flex; align-items: center; gap: 8px;
    letter-spacing: -0.3px;
}
.pill-post-text i { font-size: 1rem; color: #374151; }

.pill-post-add {
    width: 48px; height: 48px;
    border-radius: 50%;
    background: transparent;
    border: 1px solid #e5e7eb;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600;
    font-size: 1.3rem;
    color: #000000;
}

/* 3. Globe Button (Blue Circle) */
.pill-globe-btn {
    width: 60px; height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #0ea5e9);
    position: relative;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 15px 40px rgba(59, 130, 246, 0.4);
    transition: transform 0.2s;
    text-decoration: none;
    border: 1px solid rgba(255,255,255,0.2);
}
.pill-globe-btn:active { transform: scale(0.9); }

.pill-globe-img {
    width: 100%; height: 100%;
    border-radius: 50%;
    object-fit: cover;
    opacity: 0.9;
}

/* Search Bar Overlay Animating */
.club-search-bar {
    position: absolute;
    top: 2rem;
    left: 1.25rem;
    right: 1.25rem;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 100px;
    padding: 0.8rem 1.2rem;
    display: flex;
    align-items: center;
    gap: 12px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
    border: 1px solid rgba(0,0,0,0.1);
    z-index: 20;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}
body.dark-mode .club-search-bar {
    background: rgba(30, 30, 30, 0.95);
    border-color: rgba(255,255,255,0.1);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.club-search-bar input {
    flex: 1; border: none; background: transparent; font-size: 1.15rem; color: var(--text-main); font-weight: 700; outline: none;
}
.club-search-bar i {
    color: #a1a1aa; font-size: 1.2rem;
}

.no-results-msg {
    text-align: center;
    padding: 3rem 1rem;
    color: #a1a1aa;
    font-size: 1.1rem;
    font-weight: 600;
    width: 100%;
    display: none;
    grid-column: 1 / -1;
}

/* --- POST MODAL OVERLAY --- */
.post-modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 3000;
    display: none;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
}

.post-modal {
    background: var(--bg-primary);
    width: 100%;
    max-width: 600px;
    border-top-left-radius: 28px;
    border-top-right-radius: 28px;
    padding: 30px 24px 40px 24px;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.3);
    transform: translateY(100%);
}

body.dark-mode .post-modal {
    background: #111827;
    border: 1px solid rgba(255,255,255,0.1);
    border-bottom: none;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.modal-header h3 {
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: -0.5px;
}

.modal-header i {
    font-size: 1.2rem;
    cursor: pointer;
    background: rgba(0,0,0,0.05);
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}
body.dark-mode .modal-header i {
    background: rgba(255,255,255,0.1);
}

.modal-body label {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 8px;
    display: block;
    color: var(--text-main);
}

.modal-body input[type="text"] {
    width: 100%;
    padding: 16px;
    border-radius: 14px;
    border: 1px solid rgba(0,0,0,0.1);
    background: rgba(0,0,0,0.02);
    font-size: 1rem;
    margin-bottom: 24px;
    font-family: inherit;
    color: var(--text-main);
    font-weight: 500;
}
.modal-body input[type="text"]:focus {
    outline: none;
    border-color: #8b5cf6;
}
body.dark-mode .modal-body input[type="text"] {
    border-color: rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.05);
}

.upload-area {
    border: 2px dashed rgba(0,0,0,0.15);
    border-radius: 16px;
    height: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #a1a1aa;
    cursor: pointer;
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
    background: rgba(0,0,0,0.02);
    transition: border-color 0.2s;
}
.upload-area:active {
    border-color: #8b5cf6;
}
body.dark-mode .upload-area {
    border-color: rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.02);
}

.upload-area i {
    font-size: 3rem;
    color: #cbd5e1;
}
body.dark-mode .upload-area i {
    color: #4b5563;
}
.upload-area p {
    font-weight: 600;
    font-size: 0.9rem;
}

.submit-post-btn {
    width: 100%;
    background: #111827;
    color: white;
    font-size: 1.15rem;
    font-weight: 800;
    padding: 18px;
    border-radius: 16px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: transform 0.2s cubic-bezier(0.2, 1, 0.3, 1), box-shadow 0.2s;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}
body.dark-mode .submit-post-btn {
    background: #ffffff;
    color: #000000;
    box-shadow: 0 10px 20px rgba(255,255,255,0.1);
}

.submit-post-btn:active {
    transform: scale(0.96);
    box-shadow: 0 5px 10px rgba(0,0,0,0.1);
}
