/* =============================================
   DESIGN TOKENS — identical across all pages
   ============================================= */
:root {
    --green-900: #1b4332;
    --green-800: #2d6a4f;
    --green-700: #40916c;
    --green-600: #52b788;
    --green-500: #74c69d;
    --green-400: #95d5b2;
    --green-300: #b7e4c7;
    --green-200: #d8f3dc;
    --green-100: #f0fdf4;

    --gray-900: #1a202c;
    --gray-700: #4a5568;
    --gray-500: #a0aec0;
    --gray-200: #edf2f7;
    --gray-100: #f7fafc;
    --gray-50:  #fcfdfd;

    --font-sans:    'Plus Jakarta Sans', sans-serif;
    --font-serif:   'Source Sans 3', serif;
    --font-display: 'Poppins', sans-serif;

    --shadow-sm: 0 1px 2px 0 rgba(0,0,0,.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
}

/* =============================================
   RESET & BASE
   ============================================= */
*, *::before, *::after { box-sizing: border-box; }
html { overflow-y: scroll; scrollbar-gutter: stable; }

body {
    font-family: var(--font-sans);
    margin: 0;
    padding: 0;
    background-color: var(--gray-50);
    color: var(--gray-700);
    line-height: 1.5;
}

/* =============================================
   HEADER
   ============================================= */
header {
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    background: #ffffff;
    border-bottom: 1px solid #e9efec;
    z-index: 1000;
    padding: 0.5rem 0;
    box-shadow: none;
}

.container-H {
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 56px;
    position: relative;
}

/* =============================================
   LOGO
   ============================================= */
.logo {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}
.logo a {
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.45rem;
}
.logo img {
    height: 32px;
    width: 32px;
    border-radius: 50%;
}
.logo span {
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--green-900);
    font-family: var(--font-display);
    letter-spacing: -0.02em;
}
.logo a span:has(img) {
    display: flex;
    align-items: center;
    font-size: 0;
}

/* =============================================
   NAV PILL
   ============================================= */
nav {
    display: flex;
    gap: 0.2rem;
    align-items: center;
    padding: 0.26rem;
    border-radius: 999px;
    background: #f4f6f5;
    border: 1px solid #edf1ef;
    position: static;
    right: auto;
}
nav a {
    font-weight: 600;
    color: #2f3e36;
    text-decoration: none;
    font-size: 0.88rem;
    position: relative;
    padding: 0.5rem 0.9rem;
    border-radius: 999px;
    transition: color .2s ease, background-color .2s ease;
    width: max-content;
    display: inline-block;
}
nav a:hover { color: var(--green-900); background: #e9f2ed; }
nav a::after {
    content: '';
    position: absolute;
    left: 50%; bottom: 0.25rem;
    width: 6px; height: 2px;
    background: #5a9a78;
    border-radius: 2px;
    transform: translateX(-50%) scaleX(0);
    transition: transform .24s ease;
}
nav a:hover::after,
nav a.active::after { transform: translateX(-50%) scaleX(1); }
nav a.active { background: #dfeee5; color: var(--green-900); }

/* =============================================
   DROPDOWN
   ============================================= */
.dropdown { position: relative; display: inline-flex; align-items: center; }
.dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 0.62rem);
    left: 50%;
    transform: translateX(-50%);
    background-color: #ffffff;
    box-shadow: 0 12px 24px rgba(19,50,36,.12);
    border-radius: 0.8rem;
    min-width: 190px;
    z-index: 1001;
    padding: 0.45rem 0;
    border: 1px solid #e8efea;
}
.dropdown:hover .dropdown-menu { display: block; }
.dropdown-menu a {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.25rem;
    color: var(--gray-700);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background-color .2s ease;
    background: none;
    width: 100%;
}
.dropdown-menu a:hover { background-color: #edf4ef; color: var(--green-900); }
.dropdown-menu a::after { display: none !important; }
.dropdown-menu a i { margin-right: 0.75rem; font-size: 1rem; width: 20px; text-align: center; }
#scanPlant i.fa-chevron-down { margin-left: 0.3rem; font-size: 0.8rem; transition: transform .2s ease; }
.dropdown:hover #scanPlant i.fa-chevron-down { transform: rotate(180deg); }

/* =============================================
   USER / PROFILE ICON
   ============================================= */
.user-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--green-800);
    box-shadow: 0 4px 12px rgba(45,106,79,.25);
    cursor: pointer;
    flex-shrink: 0;
}
.user-icon a.profile {
    color: var(--green-200);
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%; height: 100%;
    border-radius: 50%;
    text-decoration: none;
}
.user-icon a.profile::after { display: none !important; }

/* =============================================
   PROFILE SUB-MENU
   ============================================= */
.sub-menu-wrap {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 1.5rem;
    width: min(92vw, 300px);
    max-height: 0;
    overflow: hidden;
    transition: max-height .45s ease;
    z-index: 1002;
    filter: none;
}
.sub-menu-wrap.open-menu { max-height: 420px; }
.sub-menu {
    background: rgba(255,255,255,.96);
    backdrop-filter: blur(18px);
    border: 1px solid rgba(255,255,255,.7);
    border-radius: 1.1rem;
    box-shadow: 0 20px 44px rgba(17,66,23,.14);
    padding: 1.25rem;
    margin: 0.5rem 0;
}
.user-info { display: flex; align-items: center; gap: 0.9rem; margin-bottom: 0.8rem; }
.user-info img {
    width: 46px; height: 46px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--green-600), var(--green-900));
    padding: 2px;
    object-fit: cover;
}
.user-info h2 {
    font-family: var(--font-display);
    font-size: 1rem; font-weight: 700;
    color: var(--green-900); margin: 0;
}
.sub-menu hr { border: none; border-top: 1px solid var(--gray-200); margin: 0.75rem 0; }
.sub-menu-link { display: flex; flex-direction: column; gap: 0.1rem; }
.sub-menu-link a {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    text-decoration: none;
    color: var(--gray-700);
    font-size: 0.88rem; font-weight: 600;
    padding: 0.6rem 0.75rem;
    border-radius: 0.65rem;
    transition: background .2s ease, color .2s ease;
    justify-content: space-between;
    background: none; width: 100%;
}
.sub-menu-link a:hover { background-color: #edf4ef; color: var(--green-900); transform: none; }
.sub-menu-link a::after { display: none !important; }
.sub-menu-link a i.same {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border-radius: 8px;
    background: linear-gradient(135deg, var(--green-600), var(--green-900));
    color: var(--green-100); font-size: 0.85rem;
    flex-shrink: 0; transition: none;
}
.sub-menu-link a:hover i.same { transform: none; }
.sub-menu-link a span {
    margin-left: auto; font-size: 1rem;
    color: var(--gray-500); font-weight: 400;
    visibility: visible; transition: none;
}
.sub-menu-link a:hover span { transform: none; color: var(--gray-500); }
.sub-menu-link-inner { display: flex; align-items: center; gap: 0.7rem; }

/* =============================================
   UPLOAD MODAL
   ============================================= */
.modal {
    display: none; position: fixed;
    z-index: 1010; left: 0; top: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,.6);
    justify-content: center; align-items: center;
}
.modal-content {
    background: white; padding: 2rem;
    border-radius: 1rem; text-align: center;
    width: 90%; max-width: 500px;
    box-shadow: var(--shadow-lg); position: relative;
}
.modal-content h2 {
    font-family: var(--font-serif);
    font-size: 1.75rem; color: var(--gray-900); margin-bottom: 1.5rem;
}
.close {
    position: absolute; top: 1rem; right: 1rem;
    font-size: 1.5rem; cursor: pointer;
    color: var(--gray-500); transition: color .2s ease;
}
.close:hover { color: var(--gray-900); }
#drop-area {
    border: 2px dashed var(--green-400);
    border-radius: 0.75rem; padding: 3rem 2rem;
    background-color: var(--green-100);
    transition: all .2s ease; font-family: var(--font-sans);
    color: var(--green-800); font-size: 1.05rem; font-weight: 600;
}
#drop-area:hover { background-color: var(--green-200); border-color: var(--green-600); }
#drop-area.dragover { background-color: var(--green-300); border-color: var(--green-700); }
#drop-area p { margin: 0.5rem 0; }
#fileInput { margin-top: 1rem; }

/* =============================================
   PAGE WRAPPER
   ============================================= */
.page-wrapper {
    padding-top: 72px;
    min-height: calc(100vh - 72px);
}

/* =============================================
   COMMUNITY HERO — dark green overlay banner
   ============================================= */
.community-hero {
    background:
        linear-gradient(115deg, rgba(8,24,17,.74), rgba(19,53,39,.52)),
        url("../bgimg.jpg") center center / cover no-repeat;
    padding: 5rem 1.5rem 4rem;
    text-align: center;
}
.community-hero h1 {
    font-family: var(--font-display);
    font-size: clamp(1.9rem, 4vw, 3.2rem);
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 0.75rem;
    letter-spacing: -0.02em;
    text-shadow: 0 8px 24px rgba(0,0,0,.32);
}
.community-hero p {
    font-size: clamp(1rem, 1.5vw, 1.18rem);
    color: rgba(255,255,255,.88);
    margin: 0;
    text-shadow: 0 4px 16px rgba(0,0,0,.2);
}

/* =============================================
   COMMUNITY GRID SECTION
   ============================================= */
.community-section {
    background: linear-gradient(180deg, #f8fcfa 0%, #ffffff 100%);
    padding: 4rem 1.5rem 5rem;
}

.community-inner {
    max-width: 1100px;
    margin: 0 auto;
}

/* =============================================
   COMMUNITY CARDS
   ============================================= */
.community-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.community-card {
    background-color: #ffffff;
    border-radius: 1.1rem;
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: all .3s ease;
    display: flex;
    flex-direction: column;
}
.community-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--green-300);
}

.community-card .card-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.community-card .card-body {
    padding: 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

/* Author row */
.author-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}
.author-row img {
    width: 36px; height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--green-200);
    flex-shrink: 0;
}
.author-row .author-name {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--gray-900);
}

/* Caption */
.card-caption {
    font-size: 0.95rem;
    color: var(--gray-700);
    margin: 0;
    line-height: 1.5;
    flex: 1;
}

/* Stats row */
.stats-row {
    display: flex;
    align-items: center;
    gap: 1.1rem;
    margin-top: auto;
    padding-top: 0.75rem;
    border-top: 1px solid var(--gray-200);
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--gray-500);
}
.stats-row .stat {
    display: flex;
    align-items: center;
    gap: 0.38rem;
}
.stats-row .stat i {
    font-size: 0.95rem;
    color: var(--green-600);
}
.stats-row .stat.likes i { color: #f43f5e; }

/* =============================================
   FOOTER
   ============================================= */
footer {
    background-color: var(--green-900);
    color: rgba(255,255,255,.65);
    padding: 3.5rem 0 0;
}

.footer-inner {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr 1.3fr;
    gap: 2.5rem;
}

.footer-brand .brand-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.9rem;
}
.footer-brand .brand-row img {
    height: 30px; width: 30px;
    border-radius: 50%;
}
.footer-brand .brand-row span {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.02em;
}
.footer-brand p {
    font-size: 0.9rem;
    line-height: 1.65;
    margin: 0;
}

.footer-col h3 {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 1rem;
    letter-spacing: 0.01em;
}
.footer-col ul {
    list-style: none;
    padding: 0; margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}
.footer-col ul li a {
    color: rgba(255,255,255,.6);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color .2s ease;
}
.footer-col ul li a:hover { color: #ffffff; }

/* Newsletter */
.footer-newsletter p {
    font-size: 0.88rem;
    line-height: 1.6;
    margin: 0 0 1rem;
}
.newsletter-form {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.newsletter-form input {
    flex: 1;
    min-width: 130px;
    padding: 0.62rem 0.9rem;
    border: 1px solid rgba(255,255,255,.15);
    border-radius: 999px;
    background: rgba(255,255,255,.1);
    color: #ffffff;
    font-family: var(--font-sans);
    font-size: 0.88rem;
    outline: none;
    transition: border-color .2s ease;
}
.newsletter-form input::placeholder { color: rgba(255,255,255,.45); }
.newsletter-form input:focus { border-color: var(--green-400); }
.newsletter-form button {
    padding: 0.62rem 1.25rem;
    border: none;
    border-radius: 999px;
    background: var(--green-600);
    color: #ffffff;
    font-family: var(--font-sans);
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    transition: background .2s ease, transform .2s ease;
    white-space: nowrap;
}
.newsletter-form button:hover { background: var(--green-500); transform: translateY(-1px); }

/* Footer bottom */
.footer-bottom {
    max-width: 1240px;
    margin: 2.5rem auto 0;
    padding: 1.25rem 1.5rem;
    border-top: 1px solid rgba(255,255,255,.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}
.footer-bottom p {
    margin: 0;
    font-size: 0.86rem;
    color: rgba(255,255,255,.5);
}
.social-links {
    display: flex;
    gap: 0.75rem;
}
.social-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px; height: 34px;
    border-radius: 50%;
    background: rgba(255,255,255,.1);
    color: rgba(255,255,255,.65);
    font-size: 0.95rem;
    text-decoration: none;
    transition: background .2s ease, color .2s ease;
}
.social-links a:hover { background: var(--green-700); color: #ffffff; }

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 1200px) {
    nav { display: none; }
    .community-grid { grid-template-columns: repeat(2, 1fr); }
    .footer-inner { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
    .community-grid { grid-template-columns: 1fr; }
    .footer-inner { grid-template-columns: 1fr; gap: 1.75rem; }
    .community-section { padding: 3rem 1rem 4rem; }
    .footer-bottom { flex-direction: column; text-align: center; }
}