/* ==========================================================================
   COMMUNITY DISCOVERY PLATFORM – COMPLETE DESIGN SYSTEM
   ========================================================================== */

/* ---------- CSS Variables ---------- */
:root {
    /* Brand */
    --cp-green: #25D366;
    --cp-dark: #075E54;
    --cp-bg: #ffffff;
    --cp-text: #111827;
    --cp-muted: #6B7280;
    --cp-border: #E5E7EB;
    --cp-radius: 12px;
    --cp-radius-sm: 8px;
    --cp-shadow: 0 4px 24px rgba(0,0,0,0.06);
    --cp-shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --cp-transition: 0.2s ease;
}

/* ---------- Global Reset & Typography ---------- */
body {
    background: #ffffff !important;
    color: #111827 !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
h1, h2, h3, h4, h5, h6 {
    color: #111827 !important;
}
a {
    color: var(--cp-green);
    text-decoration: none;
}
a:hover {
    color: var(--cp-dark);
}
p, span, div, li, label {
    color: #111827 !important;
}
.text-muted {
    color: var(--cp-muted) !important;
}

/* ---------- Header (cp-header) ---------- */
.cp-header {
    background: var(--cp-bg);
    border-bottom: 1px solid var(--cp-border);
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
}
.cp-header-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 24px;
    height: 68px;
}
.cp-logo img {
    height: 32px;
    width: auto;
    display: block;
}

/* Search Bar */
.cp-search {
    flex: 1;
    max-width: 420px;
    position: relative;
}
.cp-search input {
    width: 100%;
    height: 44px;
    border: 1px solid var(--cp-border);
    border-radius: 44px;
    padding: 0 20px 0 48px;
    font-size: 15px;
    background: #F9FAFB;
    color: var(--cp-text);
    outline: none;
    transition: all var(--cp-transition);
}
.cp-search input:focus {
    border-color: var(--cp-green);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(37,211,102,0.1);
}
.cp-search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--cp-muted);
    font-size: 17px;
    pointer-events: none;
}

/* Navigation */
.cp-nav {
    display: flex;
    align-items: center;
    gap: 28px;
}
.cp-nav a {
    font-size: 15px;
    font-weight: 500;
    color: var(--cp-text);
    text-decoration: none;
    transition: color var(--cp-transition);
    white-space: nowrap;
}
.cp-nav a:hover,
.cp-nav a.active {
    color: var(--cp-green);
}

/* Auth Buttons */
.cp-auth {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}
.cp-btn-outline {
    padding: 10px 20px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border: 1px solid var(--cp-border);
    color: var(--cp-text);
    background: transparent;
    transition: all var(--cp-transition);
}
.cp-btn-outline:hover {
    border-color: var(--cp-green);
    color: var(--cp-green);
    background: #F0FDF4;
}
.cp-btn-solid {
    padding: 10px 20px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    background: var(--cp-green);
    color: #fff;
    border: none;
    transition: background var(--cp-transition);
}
.cp-btn-solid:hover {
    background: var(--cp-dark);
}

/* Hamburger */
.cp-hamburger {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--cp-text);
    cursor: pointer;
    padding: 8px;
}

/* Search Dropdown */
.cp-search-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--cp-border);
    border-radius: var(--cp-radius);
    box-shadow: var(--cp-shadow);
    max-height: 320px;
    overflow-y: auto;
    display: none;
    z-index: 200;
}
.cp-search-dropdown .cp-search-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--cp-text);
    border-bottom: 1px solid #f1f1f1;
    transition: background var(--cp-transition);
}
.cp-search-dropdown .cp-search-item:last-child {
    border-bottom: none;
}
.cp-search-dropdown .cp-search-item:hover {
    background: #F9FAFB;
}
.cp-search-dropdown .cp-search-item img {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
}
.cp-search-dropdown .cp-search-title {
    font-weight: 600;
    font-size: 15px;
}
.cp-search-dropdown .cp-search-meta {
    font-size: 13px;
    color: var(--cp-muted);
}
.cp-search-dropdown .cp-search-empty {
    padding: 20px;
    text-align: center;
    color: var(--cp-muted);
}

/* Mobile Menu */
.cp-mobile-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 300;
    display: none;
}
.cp-mobile-overlay.active { display: block; }
.cp-mobile-menu {
    position: fixed;
    top: 0;
    right: 0;
    width: 320px;
    height: 100%;
    background: #fff;
    z-index: 400;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}
.cp-mobile-menu.active { transform: translateX(0); }
.cp-mobile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--cp-border);
    font-weight: 600;
}
.cp-mobile-header button {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
}
.cp-mobile-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}
.cp-mobile-body a {
    display: block;
    padding: 12px 0;
    text-decoration: none;
    color: var(--cp-text);
    border-bottom: 1px solid var(--cp-border);
    font-weight: 500;
}
.cp-mobile-search input {
    width: 100%;
    padding: 10px 16px;
    border: 1px solid var(--cp-border);
    border-radius: 24px;
    margin-bottom: 20px;
    font-size: 14px;
}

/* ---------- Homepage Hero & Search ---------- */
.community-hero {
    background: var(--cp-white);
    padding: 60px 0 40px;
    text-align: center;
    border-bottom: 1px solid var(--cp-border);
}
.hero-search {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid var(--cp-border);
    border-radius: 48px;
    overflow: hidden;
    box-shadow: var(--cp-shadow);
    transition: border-color var(--cp-transition);
}
.hero-search:focus-within {
    border-color: var(--cp-green);
    box-shadow: 0 0 0 3px rgba(37,211,102,0.2);
}
.hero-search input {
    flex: 1;
    border: none;
    padding: 14px 24px;
    font-size: 16px;
    background: transparent;
    color: var(--cp-text);
    outline: none;
}
.hero-search button {
    background: var(--cp-green);
    border: none;
    padding: 14px 28px;
    color: #fff;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: background var(--cp-transition);
    border-radius: 0 48px 48px 0;
}
.hero-search button:hover {
    background: var(--cp-dark);
}

.community-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 30px;
}

/* Category Chips */
.category-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 16px 0;
    overflow-x: auto;
    scrollbar-width: none;
}
.category-chips::-webkit-scrollbar { display: none; }
.category-chip {
    flex-shrink: 0;
    padding: 8px 20px;
    border-radius: 24px;
    border: 1px solid var(--cp-border);
    background: #fff;
    color: var(--cp-text);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--cp-transition);
}
.category-chip:hover {
    border-color: var(--cp-green);
    color: var(--cp-green);
}
.category-chip.active {
    background: var(--cp-green);
    border-color: var(--cp-green);
    color: #fff;
}

/* ---------- Feed Card (Horizontal) ---------- */
.feed-card {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid var(--cp-border);
    border-radius: var(--cp-radius);
    padding: 16px;
    margin-bottom: 16px;
    transition: box-shadow var(--cp-transition);
    text-decoration: none;
    color: inherit;
}
.feed-card:hover {
    box-shadow: var(--cp-shadow);
}
.feed-avatar {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    overflow: hidden;
    margin-right: 16px;
    flex-shrink: 0;
    position: relative;
}
.feed-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.feed-avatar .featured-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #FFC107;
    color: #fff;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.feed-content {
    flex: 1;
    min-width: 0;
}
.feed-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--cp-text);
}
.feed-description {
    font-size: 14px;
    color: var(--cp-muted);
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.feed-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: var(--cp-muted);
}
.feed-category {
    background: #F0FDF4;
    color: var(--cp-dark);
    padding: 2px 10px;
    border-radius: 12px;
    font-weight: 500;
}
.feed-action {
    margin-left: auto;
    flex-shrink: 0;
}
.feed-action .btn {
    background: var(--cp-green);
    color: #fff;
    border-radius: 20px;
    padding: 8px 16px;
    font-weight: 500;
    transition: background var(--cp-transition);
}
.feed-action .btn:hover {
    background: var(--cp-dark);
}

/* ---------- Platform Section ---------- */
.platform-section {
    background: #F5F7F9;
    padding: 60px 0;
}
.platform-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 20px;
}
.platform-card {
    background: #fff;
    border: 1px solid var(--cp-border);
    border-radius: var(--cp-radius);
    padding: 24px;
    text-align: center;
    transition: box-shadow var(--cp-transition);
}
.platform-card:hover {
    box-shadow: var(--cp-shadow);
}
.platform-card img {
    width: 48px;
    height: 48px;
    margin-bottom: 8px;
}

/* Newsletter */
.newsletter-section {
    background: var(--cp-dark);
    padding: 60px 0;
    text-align: center;
    color: #fff;
}
.newsletter-form {
    display: flex;
    max-width: 480px;
    margin: 0 auto;
    border-radius: 48px;
    overflow: hidden;
    box-shadow: var(--cp-shadow);
}
.newsletter-form input {
    flex: 1;
    border: none;
    padding: 14px 20px;
    font-size: 16px;
    color: var(--cp-text);
    outline: none;
}
.newsletter-form button {
    background: var(--cp-green);
    border: none;
    color: #fff;
    padding: 14px 28px;
    font-weight: 600;
    cursor: pointer;
}

/* ---------- Group Detail Page ---------- */
.group-detail-hero {
    background: #fff;
    padding: 40px 0 0;
}
.group-banner {
    border-radius: var(--cp-radius);
    overflow: hidden;
    margin-bottom: 24px;
    box-shadow: var(--cp-shadow-sm);
    max-height: 400px;
}
.group-banner img {
    width: 100%;
    object-fit: cover;
}
.group-info-card {
    background: #fff;
    border: 1px solid var(--cp-border);
    border-radius: var(--cp-radius);
    padding: 24px;
    margin-bottom: 24px;
}
.group-avatar {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    overflow: hidden;
}
.group-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.group-name {
    font-size: 1.5rem;
    font-weight: 700;
}
.group-description {
    background: #fff;
    border-radius: var(--cp-radius);
    padding: 32px;
    border: 1px solid var(--cp-border);
    line-height: 1.7;
}
.group-description img {
    max-width: 100%;
    border-radius: 8px;
    margin: 1rem 0;
}

/* ---------- Dashboard (Light) ---------- */
.dashboard-wrapper {
    display: flex;
    min-height: 100vh;
    background: var(--cp-bg);
}
.dashboard-sidebar {
    width: 260px;
    background: #fff;
    border-right: 1px solid var(--cp-border);
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    overflow-y: auto;
    z-index: 100;
}
.dashboard-main {
    margin-left: 260px;
    flex: 1;
    background: var(--cp-bg);
}
.dashboard-topbar {
    background: #fff;
    border-bottom: 1px solid var(--cp-border);
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.dashboard-content {
    padding: 24px;
}

/* ---------- Global Mobile Responsive ---------- */
@media (max-width: 1024px) {
    .cp-nav { gap: 20px; }
    .cp-search { max-width: 300px; }
}
@media (max-width: 768px) {
    .cp-header-container {
        flex-wrap: wrap;
        height: auto;
        padding: 12px 16px;
        gap: 12px;
    }
    .cp-logo img { height: 28px; }
    .cp-nav, .cp-auth { display: none !important; }
    .cp-hamburger { display: block; margin-left: auto; }
    .cp-search {
        order: 3;
        width: 100%;
        max-width: 100%;
        margin-top: 4px;
    }

    .hero-search {
        flex-direction: column;
        border-radius: 12px;
    }
    .hero-search input {
        border-radius: 12px 12px 0 0;
    }
    .hero-search button {
        border-radius: 0 0 12px 12px;
        width: 100%;
    }

    .feed-card {
        flex-wrap: wrap;
    }
    .feed-avatar {
        margin-bottom: 12px;
    }
    .feed-action {
        width: 100%;
        text-align: right;
        margin-top: 12px;
    }

    .group-banner { max-height: 250px; }
    .group-name { font-size: 1.25rem; }
    .group-description { padding: 20px; }

    .dashboard-sidebar {
        transform: translateX(-100%);
        box-shadow: var(--cp-shadow);
    }
    .dashboard-sidebar.open { transform: translateX(0); }
    .dashboard-main { margin-left: 0; }
    .sidebar-toggle { display: block; }

    .platform-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .newsletter-form {
        flex-direction: column;
        border-radius: 12px;
    }
    .newsletter-form input {
        border-radius: 12px 12px 0 0;
        text-align: center;
    }
    .newsletter-form button {
        border-radius: 0 0 12px 12px;
    }
}