/* =================================================================
 |
 |  TanamPohon App - main.css
 |
 |  TABLE OF CONTENTS
 |  -----------------
 |  1. ROOT VARIABLES & GLOBAL RESET
 |  2. TYPOGRAPHY & GENERAL HELPERS
 |  3. MAIN APP LAYOUT (Container, Header, Content, Nav)
 |  4. AUTHENTICATION PAGES
 |  5. UI COMPONENTS (Buttons, Forms, Cards, Alerts)
 |  6. PAGE: DASHBOARD (Social Feed)
 |  7. PAGE: TREE & FORMS (Detail, Update, Add)
 |  8. PAGE: PROFILE & FORMS
 |  9. PAGE: CHALLENGES
 |  10. PAGE: LEADERBOARD
 |  11. PAGE: MAP
 |  12. COMPONENT: MODAL
 |  13. ADMIN PANEL STYLING
 |  14. RESPONSIVE MEDIA QUERIES
 |
 ================================================================= */

/* 1. ROOT VARIABLES & GLOBAL RESET
-------------------------------------------------- */
:root {
    --primary-color: #2E7D32;
    --primary-color-dark: #1B5E20;
    --secondary-color: #66BB6A;
    --accent-color: #FFC107;
    --background-light: #F7F9F7;
    --surface-color: #FFFFFF;
    --on-surface-color: #212121;
    --on-surface-secondary: #757575;
    --border-color: #E0E0E0;
    --error-color: #D32F2F;
    --success-color: #388E3C;
    --font-family: 'Poppins', 'Segoe UI', 'Roboto', sans-serif;
    --border-radius: 12px;
    --box-shadow: 0 4px 20px rgba(0, 0, 0, 0.07);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
    font-family: var(--font-family);
    background: #E0E0E0;
    color: var(--on-surface-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

/* 2. TYPOGRAPHY & GENERAL HELPERS
-------------------------------------------------- */
h1 { font-size: 1.5rem; font-weight: 600; }
h2 { font-size: 1.25rem; font-weight: 600; }
h3 { font-size: 1.1rem; font-weight: 500; }
p { font-size: 0.95rem; line-height: 1.6; color: var(--on-surface-secondary); }
a { color: var(--primary-color); text-decoration: none; transition: color 0.3s ease; }
a:hover { color: var(--primary-color-dark); }
.text-center { text-align: center; }
.mt-20 { margin-top: 20px; }

/* 3. MAIN APP LAYOUT
-------------------------------------------------- */
.mobile-container {
    width: 100%; max-width: 420px; height: 100vh; max-height: 850px;
    background: var(--background-light); border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    display: flex; flex-direction: column; overflow: hidden; position: relative;
}
.app-header {
    background-color: var(--surface-color); padding: 0 20px; height: 60px;
    display: flex; justify-content: space-between; align-items: center;
    flex-shrink: 0; border-bottom: 1px solid var(--border-color);
    position: sticky; top: 0; z-index: 100;
}
.app-header h1 {
    font-size: 1.2rem; font-weight: 600; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis; flex-grow: 1; min-width: 0;
}
.header-icons { display: flex; align-items: center; gap: 15px; margin-left: 15px; flex-shrink: 0; }
.icon-link {
    font-size: 1.3rem; color: var(--on-surface-secondary); position: relative;
    transition: color 0.2s ease, transform 0.2s ease;
    display: flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 50%;
}
.icon-link:hover { color: var(--primary-color); background-color: #f0f4f0; }
.icon-link:active { transform: scale(0.9); }

.app-content { flex-grow: 1; overflow-y: auto; padding: 20px; }
.bottom-nav {
    display: flex; justify-content: space-around; background: var(--surface-color);
    padding: 8px 0; border-top: 1px solid var(--border-color);
    box-shadow: 0 -5px 15px rgba(0,0,0,0.04); flex-shrink: 0;
}
.nav-item {
    display: flex; flex-direction: column; align-items: center;
    color: var(--on-surface-secondary); font-size: 0.7rem;
    font-weight: 500; width: 20%; padding: 5px 0;
}
.nav-item i { font-size: 1.3rem; margin-bottom: 4px; }
.nav-item.active { color: var(--primary-color); }
.nav-item.nav-item-add {
    color: white; background-color: var(--primary-color);
    border-radius: 50%; width: 50px; height: 50px; justify-content: center;
    transform: translateY(-20px); border: 4px solid var(--background-light);
    box-shadow: var(--box-shadow); transition: transform 0.2s ease;
}
.nav-item.nav-item-add:hover { transform: translateY(-22px) scale(1.05); }
.nav-item.nav-item-add i { font-size: 1.8rem; margin: 0; }

/* 4. AUTHENTICATION PAGES
-------------------------------------------------- */
.auth-page { background: linear-gradient(135deg, #2E7D32, #4CAF50); }
.auth-page .app-content { display: flex; align-items: center; justify-content: center; padding: 0; }
.auth-container {
    background-color: var(--surface-color); width: 100%; height: 100%;
    display: flex; flex-direction: column; justify-content: center; padding: 30px;
}
.auth-header { text-align: center; margin-bottom: 25px; }
.auth-logo { font-size: 3rem; color: var(--primary-color); margin-bottom: 10px; }
.auth-header h1 { color: var(--on-surface-color); }
.auth-header p { font-size: 1rem; color: var(--on-surface-secondary); }
.auth-form { width: 100%; margin: 15px 0; }
.auth-footer { text-align: center; margin-top: 25px; }
.auth-footer p { font-size: 0.9rem; }
.auth-footer a { font-weight: 600; }

/* 5. UI COMPONENTS
-------------------------------------------------- */
.card {
    background-color: var(--surface-color); border-radius: var(--border-radius);
    padding: 20px; margin-top: 20px; box-shadow: var(--box-shadow);
}
.button-primary {
    display: block; width: 100%; padding: 15px; background: var(--primary-color);
    color: white; border: none; border-radius: var(--border-radius);
    font-size: 1rem; font-weight: 600; text-align: center; cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    box-shadow: 0 4px 15px rgba(46, 125, 50, 0.3);
}
.button-primary:hover { background-color: var(--primary-color-dark); transform: translateY(-2px); }
.button-primary i { margin-right: 8px; }
.button-primary-small {
    display: inline-block; padding: 8px 16px; background: var(--primary-color);
    color: white; border-radius: 8px; font-size: 0.9rem;
    font-weight: 500; text-decoration: none; box-shadow: 0 2px 8px rgba(46, 125, 50, 0.3);
}
.button-secondary {
    display: block; width: 100%; padding: 10px; margin-top: 10px;
    background: #f0f0f0; color: var(--on-surface-secondary);
    border: 1px solid var(--border-color); border-radius: var(--border-radius);
    font-size: 0.9rem; font-weight: 500; text-align: center; cursor: pointer;
    transition: background-color 0.3s ease;
}
.button-secondary:hover { background-color: #e0e0e0; }
.button-link {
    background: none; border: none; padding: 0; color: var(--primary-color);
    cursor: pointer; font-size: inherit; font-family: inherit;
}
.button-link.delete { color: var(--error-color); }
.input-group { margin-bottom: 20px; position: relative; }
.input-group label { display: block; margin-bottom: 8px; font-weight: 500; color: var(--on-surface-secondary); font-size: 0.9rem; }
.input-group input, .input-group textarea {
    width: 100%; padding: 14px 16px; border: 1px solid var(--border-color);
    border-radius: var(--border-radius); font-size: 1rem;
    font-family: var(--font-family);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.input-group input:focus, .input-group textarea:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.2); }
.input-group textarea { resize: vertical; }
.input-group input[type="file"] { padding: 10px; background-color: #f9f9f9; }
.alert { padding: 15px; margin-bottom: 20px; border-radius: var(--border-radius); font-size: 0.9rem; border: 1px solid transparent; }
.alert-danger { color: var(--error-color); background-color: rgba(211, 47, 47, 0.1); border-color: rgba(211, 47, 47, 0.2); }
.alert-success { color: var(--success-color); background-color: rgba(56, 142, 60, 0.1); border-color: rgba(56, 142, 60, 0.2); }

/* 6. PAGE: DASHBOARD (Social Feed)
-------------------------------------------------- */
.personal-header {
    background: var(--surface-color); position: sticky; top: 60px; z-index: 99;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05); padding: 0; margin: -20px -20px 0 -20px;
}
.personal-header-content { padding: 15px 20px; }
.app-content.dashboard-content {
    padding: 0;
    /* Membuat layout flex untuk header fix dan area scroll */
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Header Personal yang Fixed */
.dashboard-personal-header {
    background: var(--surface-color);
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    z-index: 10;
}

.header-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px; /* Jarak ke statistik di bawahnya */
}

.welcome-section {
    display: flex;
    align-items: center;
    gap: 12px;
}
.user-avatar-small {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}
.user-avatar-small img { width: 100%; height: 100%; object-fit: cover; }
.welcome-text small { font-size: 0.85rem; color: var(--on-surface-secondary); }
.welcome-text h2 { font-size: 1.3rem; font-weight: 600; line-height: 1.2; margin: 0; }

.header-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 15px;
}
.header-stat-item {
    background-color: var(--background-light);
    padding: 10px;
    border-radius: var(--border-radius);
    text-align: center;
}
.header-stat-item .value { font-size: 1.2rem; font-weight: 600; }
.header-stat-item .value small { font-size: 0.8rem; font-weight: 500; }
.header-stat-item .label { font-size: 0.7rem; color: var(--on-surface-secondary); }

/* Area Konten yang Bisa di-scroll */
.feed-scroll-area {
    flex-grow: 1; /* Ambil semua sisa ruang vertikal */
    overflow-y: auto; /* Aktifkan scroll hanya untuk area ini */
    padding: 20px;
}

/* Banner Tantangan di dalam area scroll */
.challenge-banner-feed {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-color-dark));
    color: white;
    padding: 12px 15px;
    border-radius: var(--border-radius);
    text-decoration: none;
    margin-bottom: 20px; /* Jarak ke feed di bawahnya */
    transition: transform 0.2s ease;
}
.challenge-banner-feed:hover { transform: scale(1.02); }
.challenge-banner-info { display: flex; align-items: center; gap: 15px; }
.challenge-banner-info i { font-size: 1.8rem; color: var(--accent-color); }
.challenge-banner-text strong { font-size: 0.9rem; display: block; }
.challenge-banner-text small { font-size: 0.8rem; opacity: 0.8; }
.challenge-banner-feed > .fa-chevron-right { font-size: 0.9rem; opacity: 0.7; }

/* Judul untuk feed */
.feed-title {
    margin-bottom: 15px;
}
.feed-title h3 {
    font-size: 1.1rem;
    font-weight: 600;
}
.header-stats-slider {
    margin-top: 15px;
}
.header-stats-slider .swiper-slide {
    width: auto; /* Biarkan Swiper yang mengatur */
}
.swiper-pagination {
    position: static; /* Letakkan di bawah slider */
    margin-top: 10px;
}
.swiper-pagination-bullet {
    background: var(--primary-color);
    opacity: 0.4;
}
.swiper-pagination-bullet-active {
    opacity: 1;
}
.stats-grid-feed { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-item-feed { display: flex; align-items: center; gap: 12px; background-color: var(--background-light); padding: 12px; border-radius: var(--border-radius); border: 1px solid var(--border-color); height: 100%; }
.stat-item-feed i { font-size: 1.8rem; color: var(--primary-color); background-color: rgba(46, 125, 50, 0.1); width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.stat-item-feed .value { font-size: 1.1rem; font-weight: 600; }
.stat-item-feed .label { font-size: 0.7rem; color: var(--on-surface-secondary); line-height: 1.2; }
.challenge-banner-feed { display: flex; align-items: center; justify-content: space-between; background: linear-gradient(135deg, var(--primary-color), var(--primary-color-dark)); color: white; padding: 12px 15px; border-radius: var(--border-radius); text-decoration: none; margin-top: 15px; transition: transform 0.2s ease; }
.challenge-banner-feed:hover { transform: scale(1.02); }
.challenge-banner-info { display: flex; align-items: center; gap: 15px; }
.challenge-banner-info i { font-size: 1.8rem; color: var(--accent-color); }
.challenge-banner-text strong { font-size: 0.9rem; display: block; }
.challenge-banner-text small { font-size: 0.8rem; opacity: 0.8; }
.challenge-banner-feed > .fa-chevron-right { font-size: 0.9rem; opacity: 0.7; }
.progress-bar-small { width: 100%; height: 6px; background-color: rgba(255,255,255,0.2); border-radius: 3px; overflow: hidden; }
.progress-bar-small .progress { height: 100%; background-color: var(--accent-color); border-radius: 3px; }

.social-feed { padding-top: 20px; }
.feed-card { margin-bottom: 20px; padding: 0; box-shadow: 0 4px 15px rgba(0,0,0,0.08); border-radius: var(--border-radius); overflow: hidden;}
.feed-card-header { display: flex; align-items: center; gap: 10px; padding: 12px 15px; }
.feed-user-avatar { width: 40px; height: 40px; border-radius: 50%; overflow: hidden; }
.feed-user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.feed-user-info strong { font-weight: 600; font-size: 0.95rem; display: block; }
.feed-user-info small { font-size: 0.8rem; color: var(--on-surface-secondary); }
.feed-card-image { display: block; width: 100%; max-height: 500px; background-color: #eee; }
.feed-card-image img { width: 100%; height: 100%; object-fit: cover; }
.feed-card-content { padding: 15px; }
.feed-card-actions { display: flex; gap: 10px; border-bottom: 1px solid var(--border-color); padding-bottom: 10px; margin-bottom: 10px; }
.action-btn { background: none; border: none; cursor: pointer; font-size: 0.9rem; color: var(--on-surface-secondary); font-weight: 500; padding: 8px; border-radius: 8px; transition: background-color 0.2s; }
.action-btn:hover { background-color: var(--background-light); }
.action-btn i { margin-right: 5px; }
.action-btn.share-btn { margin-left: auto; }
.feed-card-caption { font-size: 0.95rem; line-height: 1.5; }
.feed-card-caption strong { font-weight: 600; color: var(--primary-color-dark); }

/* 7. PAGE: TREE & FORMS
-------------------------------------------------- */
.form-container .form-description { text-align: center; margin-bottom: 20px; font-size: 0.95rem; }
.form-container .card { padding-top: 5px; }
.form-container .form-title { margin-bottom: 5px; }
.form-container .form-subtitle { margin-bottom: 20px; color: var(--on-surface-secondary); }
.form-divider { border: none; border-top: 1px solid var(--border-color); margin: 25px 0; }

.list-item-link { display: block; text-decoration: none; color: inherit; border-radius: var(--border-radius); transition: background-color 0.2s ease; }
.list-item-link:hover { background-color: #f5f5f5; }

.tree-photo-container { width: 100%; height: 250px; background-color: var(--border-color); }
.tree-photo-container img { width: 100%; height: 100%; object-fit: cover; }
.tree-info-card { margin-top: -30px; position: relative; border-top-left-radius: 20px; border-top-right-radius: 20px; }
.tree-info-card h2 { margin-bottom: 20px; font-size: 1.6rem; }
.tree-info-list { list-style: none; padding: 0; }
.tree-info-list li { display: flex; align-items: center; padding: 15px 0; border-bottom: 1px solid var(--border-color); font-size: 0.95rem; }
.tree-info-list li:last-child { border-bottom: none; }
.tree-info-list i { color: var(--primary-color); font-size: 1.2rem; width: 40px; text-align: center; margin-right: 15px; }
.tree-info-list span { color: var(--on-surface-secondary); }
.tree-info-list strong { margin-left: auto; font-weight: 600; text-align: right; }

.timeline { position: relative; padding-left: 30px; border-left: 2px solid var(--border-color); }
.timeline-item { display: flex; gap: 15px; margin-bottom: 25px; position: relative; }
.timeline-item:last-child { margin-bottom: 0; }
.timeline-item::before { content: ''; position: absolute; left: -39px; top: 5px; width: 15px; height: 15px; background-color: var(--secondary-color); border-radius: 50%; border: 3px solid var(--surface-color); }
.timeline-image { flex-shrink: 0; width: 80px; height: 80px; }
.timeline-image img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--border-radius); }
.timeline-content .timeline-date { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 5px; }
.timeline-content p { font-size: 0.9rem; line-height: 1.5; }
.timeline-content p em { color: var(--on-surface-secondary); }

/* 8. PAGE: PROFILE & FORMS
-------------------------------------------------- */
.profile-header-card { display: flex; flex-direction: column; align-items: center; text-align: center; }
.profile-avatar { width: 100px; height: 100px; border-radius: 50%; background-color: var(--primary-color); margin-bottom: 15px; overflow: hidden; display: flex; align-items: center; justify-content: center; border: 4px solid var(--surface-color); box-shadow: 0 0 10px rgba(0,0,0,0.1); }
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-initials { font-size: 2.5rem; font-weight: 600; color: white; }
.profile-name { font-size: 1.5rem; font-weight: 600; }
.profile-email { font-size: 0.95rem; color: var(--on-surface-secondary); }
.profile-joined { font-size: 0.8rem; color: var(--on-surface-secondary); margin-top: 10px; background-color: var(--background-light); padding: 3px 10px; border-radius: 20px; }
.profile-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-top: 15px; }
.stat-item-profile { background-color: #f9f9f9; padding: 15px; border-radius: var(--border-radius); text-align: center; border: 1px solid var(--border-color); }
.stat-item-profile i { font-size: 1.5rem; color: var(--secondary-color); margin-bottom: 8px; }
.stat-item-profile .value { font-size: 1.5rem; font-weight: 600; }
.stat-item-profile .label { font-size: 0.8rem; color: var(--on-surface-secondary); }
.action-menu h3 { margin-bottom: 10px; }
.action-item { display: flex; align-items: center; padding: 15px; text-decoration: none; color: var(--on-surface-color); border-radius: 10px; transition: background-color 0.2s ease; }
.action-item:hover { background-color: #f5f5f5; }
.action-item > i:first-child { font-size: 1.2rem; width: 40px; text-align: center; margin-right: 15px; color: var(--on-surface-secondary); }
.action-item span { font-weight: 500; }
.action-item > i:last-child { margin-left: auto; color: var(--border-color); }
.logout-item span, .logout-item > i:first-child { color: var(--error-color); }
.app-version { text-align: center; margin-top: 30px; color: var(--on-surface-secondary); font-size: 0.8rem; }
.change-photo-preview { width: 150px; height: 150px; border-radius: 50%; margin: 0 auto; overflow: hidden; border: 4px solid var(--border-color); background-color: #f0f0f0; }
.change-photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.file-name-display { display: block; margin-top: 10px; font-size: 0.85rem; color: var(--on-surface-secondary); font-style: italic; }

/* 9. PAGE: CHALLENGES
-------------------------------------------------- */
.form-grid-half { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.challenge-item-card { display: flex; gap: 15px; align-items: flex-start; }
.challenge-icon { font-size: 2rem; color: var(--accent-color); background-color: #FFF8E1; width: 60px; height: 60px; border-radius: var(--border-radius); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.challenge-content { flex-grow: 1; min-width: 0; }
.challenge-content h4 { margin-bottom: 5px; font-weight: 600; line-height: 1.3; }
.challenge-content p { font-size: 0.9rem; margin-bottom: 12px; line-height: 1.5; word-break: break-word; }
.challenge-details { display: flex; flex-wrap: wrap; gap: 10px 20px; font-size: 0.8rem; color: var(--on-surface-secondary); }
.challenge-details span i { margin-right: 5px; }
.challenge-action { margin-left: auto; flex-shrink: 0; align-self: center; }
.list-item-empty { text-align: center; padding: 30px 20px; color: var(--on-surface-secondary); }
.list-item-empty i { font-size: 2.5rem; margin-bottom: 15px; color: var(--border-color); }

/* 10. PAGE: LEADERBOARD
-------------------------------------------------- */
.leaderboard-header { text-align: center; padding: 20px; margin-bottom: 20px; }
.leaderboard-header i { font-size: 3rem; color: var(--accent-color); margin-bottom: 10px; }
.leaderboard-header h1 { font-size: 1.8rem; font-weight: 700; }
.leaderboard-header p { font-size: 1rem; max-width: 500px; margin: 5px auto 0; }
.leaderboard-podium { display: flex; justify-content: center; align-items: flex-end; gap: 10px; margin-bottom: 30px; padding: 0 10px; }
.podium-item { width: 30%; max-width: 120px; text-align: center; padding: 15px 10px; border-radius: var(--border-radius); background-color: var(--surface-color); border: 2px solid transparent; transition: transform 0.3s ease; display: flex; flex-direction: column; justify-content: flex-end; }
.podium-item:hover { transform: translateY(-5px); }
.podium-rank { font-size: 1.5rem; font-weight: 700; color: var(--on-surface-secondary); }
.podium-avatar { width: 80px; height: 80px; border-radius: 50%; margin: 10px auto; position: relative; border: 4px solid #fff; box-shadow: 0 4px 10px rgba(0,0,0,0.1); flex-shrink: 0; }
.podium-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.podium-avatar .crown { position: absolute; top: -20px; left: 50%; transform: translateX(-50%) rotate(-15deg); font-size: 1.8rem; color: #FFD700; }
.podium-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%; margin-top: auto; }
.podium-score { font-size: 0.9rem; color: var(--primary-color-dark); font-weight: 500; margin-top: 5px; white-space: nowrap; }
.podium-item.rank-1 { order: 2; min-height: 210px; border-color: #FFD700; }
.podium-item.rank-2 { order: 1; min-height: 180px; border-color: #C0C0C0; }
.podium-item.rank-3 { order: 3; min-height: 160px; border-color: #CD7F32; }
.leaderboard-list { padding: 10px; }
.list-item-rank { display: flex; align-items: center; padding: 10px; border-radius: 8px; margin-bottom: 5px; }
.list-item-rank.current-user { background-color: #E8F5E9; border: 1px solid var(--secondary-color); }
.rank-number { font-weight: 600; font-size: 1.1rem; width: 40px; text-align: center; color: var(--on-surface-secondary); }
.rank-avatar { width: 40px; height: 40px; border-radius: 50%; margin: 0 15px; }
.rank-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.rank-name { font-weight: 500; flex-grow: 1; }
.rank-score { font-size: 1rem; font-weight: 600; color: var(--primary-color); }
.rank-score i { font-size: 0.8em; margin-left: 5px; opacity: 0.7; }
.current-user-banner { position: sticky; bottom: 0; background: white; padding: 5px; box-shadow: 0 -5px 15px rgba(0,0,0,0.1); margin: 0 -20px -20px -20px; }
.current-user-banner .list-item-rank { margin-bottom: 0; }

/* 11. PAGE: MAP
-------------------------------------------------- */
.map-container-full { margin: -20px; }
#map { height: calc(100vh - 60px - 61px); width: 100%; }
.map-popup { display: flex; align-items: center; gap: 10px; width: 220px; }
.map-popup img { width: 60px; height: 60px; object-fit: cover; border-radius: 8px; }
.map-popup .popup-info strong { font-size: 1rem; font-weight: 600; display: block; }
.map-popup .popup-info p { font-size: 0.8rem; margin: 2px 0 5px; color: var(--on-surface-secondary); }
.map-popup .popup-info a { font-size: 0.85rem; font-weight: 600; }

/* 12. COMPONENT: MODAL
-------------------------------------------------- */
.modal { display: none; position: fixed; z-index: 1000; padding-top: 60px; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0, 0, 0, 0.9); animation: fadeIn 0.3s; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-content { margin: auto; display: block; width: 80%; max-width: 700px; animation: zoomIn 0.3s; }
@keyframes zoomIn { from { transform: scale(0); } to { transform: scale(1); } }
#modalCaption { margin: auto; display: block; width: 80%; max-width: 700px; text-align: center; color: #ccc; padding: 10px 0; height: 150px; }
.modal-close-btn { position: absolute; top: 15px; right: 35px; color: #f1f1f1; font-size: 40px; font-weight: bold; transition: 0.3s; cursor: pointer; }
.modal-close-btn:hover, .modal-close-btn:focus { color: #bbb; text-decoration: none; }
.clickable-image { cursor: pointer; transition: opacity 0.3s ease; }
.clickable-image:hover { opacity: 0.8; }

/* 13. ADMIN PANEL STYLING
-------------------------------------------------- */
.admin-card { background-color: var(--surface-color); border-radius: var(--border-radius); padding: 25px; margin-bottom: 25px; box-shadow: var(--box-shadow); }
.admin-card h3 { margin-top: 0; margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--border-color); font-size: 1.2rem; font-weight: 600; }
.admin-card p.description { margin-top: -15px; margin-bottom: 20px; color: var(--on-surface-secondary); }
.admin-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.admin-form-grid .full-width { grid-column: 1 / -1; }
.admin-card .input-group { margin-bottom: 0; }
.admin-card .input-group label { display: block; margin-bottom: 8px; font-weight: 500; font-size: 0.9rem; }
.admin-card .input-group label.checkbox-label { display: flex; align-items: center; cursor: pointer; font-weight: normal; height: 100%; }
.admin-card .input-group input[type="checkbox"] { margin-right: 10px; width: auto; height: auto; }
.admin-form-actions { margin-top: 25px; padding-top: 20px; border-top: 1px solid var(--border-color); }
.table-wrapper { overflow-x: auto; }
.table { width: 100%; min-width: 600px; border-collapse: collapse; }
.table th, .table td { padding: 12px 15px; border-bottom: 1px solid var(--border-color); text-align: left; vertical-align: middle; }
.table th { background-color: #f8f9fa; font-weight: 600; font-size: 0.9rem; white-space: nowrap; }
.table tbody tr:hover { background-color: #f1f1f1; }
.table td .action-links a { margin-right: 10px; font-weight: 500; white-space: nowrap; }
.table td .action-links a:last-child { margin-right: 0; }
.table td .action-links a.delete { color: var(--error-color); }
.card-table { padding: 0; }
.badge { padding: 4px 8px; border-radius: 4px; color: white; font-size: 0.8rem; font-weight: 500; }
.badge-success { background-color: var(--success-color); }
.badge-secondary { background-color: #6c757d; }
.card-header { padding-bottom: 20px; border-bottom: 1px solid #eee; margin-bottom: 20px; }
.card-body { padding-top: 20px; }

/* ================================================= */
/*  STYLING KARTU TANTANGAN YANG DISISIPKAN DI FEED  */
/* ================================================= */

.challenge-wrapper-in-feed {
    margin-bottom: 20px;
}

.challenge-card-in-feed {
    display: flex;
    align-items: stretch; /* Membuat semua item setinggi yang paling tinggi */
    text-decoration: none;
    color: inherit;
    background: linear-gradient(45deg, #1B5E20, #4CAF50); /* Gradient hijau */
    color: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 8px 20px rgba(46, 125, 50, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.challenge-card-in-feed:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 25px rgba(46, 125, 50, 0.4);
}

.challenge-card-in-feed .card-content {
    padding: 20px;
    flex-grow: 1;
}

.challenge-card-in-feed .card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.challenge-card-in-feed .card-header i {
    font-size: 1.2rem;
    color: var(--accent-color);
}
.challenge-card-in-feed .card-header h4 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 0.9;
}

.challenge-card-in-feed .card-body strong {
    font-size: 1.1rem;
    font-weight: 600;
    display: block;
}
.challenge-card-in-feed .card-body p {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.85);
    margin: 5px 0 15px;
}

.challenge-card-in-feed .card-footer {
    margin-top: 10px;
}
.challenge-card-in-feed .card-footer small {
    font-size: 0.75rem;
    opacity: 0.8;
    display: block;
    margin-top: 5px;
}
.challenge-card-in-feed .progress-bar-small {
    background-color: rgba(255, 255, 255, 0.3);
}

.challenge-card-in-feed .card-action {
    background-color: rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 20px;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.action-btn i { margin-right: 5px; }
.action-btn span { font-weight: 500; }
.action-btn.share-btn { margin-left: auto; }

/* Styling untuk Tombol Like */
.like-btn i {
    transition: transform 0.2s ease;
}
.like-btn.liked i {
    color: var(--error-color); /* Warna merah jika sudah di-like */
    transform: scale(1.2);
}
.like-btn .like-count {
    margin-left: 5px;
}

/* ================================================================= */
/*  KOMPONEN: FEED COMMENT SECTION & MODAL (VERSI PERBAIKAN)         */
/* ================================================================= */

/* Area komentar di bawah postingan feed */
.feed-comment-section {
    padding: 10px 15px 15px; /* Sesuaikan padding dengan .feed-card-content */
    font-size: 0.9rem;
}
.view-all-comments {
    display: block;
    color: var(--on-surface-secondary);
    font-weight: 500;
    margin-bottom: 8px;
    text-decoration: none;
}
.view-all-comments:hover {
    color: var(--on-surface-color);
}
.comment-list-preview .comment-item {
    margin-bottom: 4px;
    line-height: 1.4;
    word-break: break-word;
    /* Efek "fade in" saat komentar baru ditambahkan oleh JS */
    animation: fadeIn 0.5s;
}
.comment-list-preview .comment-item strong {
    font-weight: 600;
    margin-right: 5px;
}

/* Form Komentar Inline di Feed */
.comment-form-inline {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
}
.comment-form-inline input[type="text"] {
    flex-grow: 1;
    border: none;
    background-color: var(--background-light);
    padding: 10px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
}
.comment-form-inline input[type="text"]:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(46, 125, 50, 0.2);
}
.comment-form-inline button {
    background: none;
    border: none;
    color: var(--primary-color);
    font-weight: 600;
    cursor: pointer;
    padding: 0 5px;
    flex-shrink: 0;
}
.comment-form-inline button:disabled {
    color: #ccc;
}


/* Modal Komentar Layar Penuh */
.comment-modal {
    display: none;
    position: fixed;
    bottom: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 1010;
    background-color: rgba(0,0,0,0.4);
}
.comment-modal.open { display: block; }

.comment-modal-content {
    position: absolute;
    bottom: 0;
    width: 100%;
    max-height: 90vh;
    background-color: var(--surface-color);
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    box-shadow: 0 -5px 20px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.3s ease-out;
}
.comment-modal.open .comment-modal-content { transform: translateY(0); }

.comment-modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    text-align: center;
    position: relative;
    flex-shrink: 0;
}
.comment-modal-header h3 { margin: 0; }
.close-comment-modal {
    position: absolute;
    right: 15px; top: 50%;
    transform: translateY(-50%);
    font-size: 1.8rem; font-weight: 300;
    background: none; border: none;
    cursor: pointer; color: var(--on-surface-secondary);
}
.comment-modal-body {
    flex-grow: 1;
    overflow-y: auto;
    padding: 15px 20px;
}
.comment-modal-footer {
    padding: 10px 20px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

/* Styling Item Komentar (Induk & Balasan) */
.comment-item {
    display: flex;
    gap: 12px;
    margin-bottom: 15px;
    animation: fadeIn 0.5s;
}
.comment-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}
.comment-avatar img { width: 100%; height: 100%; object-fit: cover; }
.comment-content-wrapper {
    background: var(--background-light);
    padding: 10px 15px;
    border-radius: 15px;
    width: 100%;
}
.comment-content-wrapper strong {
    font-size: 0.9rem;
    font-weight: 600;
}
.comment-content-wrapper p {
    font-size: 0.9rem;
    color: var(--on-surface-color);
    line-height: 1.5;
    margin: 2px 0 5px;
    word-wrap: break-word; /* Pastikan teks panjang turun */
    overflow-wrap: break-word;
}
.comment-meta {
    font-size: 0.75rem;
    color: var(--on-surface-secondary);
}
.comment-meta a { font-weight: 500; text-decoration: none; }

/* Styling Khusus untuk Balasan (Replies) */
.replies-container {
    margin-top: 15px;
    padding-left: 25px; /* Kurangi indentasi */
    border-left: 2px solid var(--border-color);
}
.comment-item.is-reply .comment-avatar {
    width: 30px;
    height: 30px;
}
.comment-item.is-reply .comment-content-wrapper {
    background-color: #f0f4f0; /* Warna sedikit beda untuk balasan */
}

/* Styling untuk Notifikasi Toast */
.toast-notification {
    position: fixed;
    bottom: 80px; /* Di atas navigasi bawah */
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 20px;
    border-radius: 20px;
    font-size: 0.9rem;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none; /* Agar tidak bisa diklik */
}

.toast-notification.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Styling untuk Notifikasi */
.notification-wrapper { position: relative; }
.notification-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background-color: var(--error-color);
    color: white;
    min-width: 18px; /* Gunakan min-width agar bisa membesar jika angka > 9 */
    height: 18px;
    border-radius: 9px; /* Setengah dari height/width */
    font-size: 0.7rem;
    font-weight: 600;
    display: flex; /* Menggunakan flex untuk memusatkan angka */
    align-items: center;
    justify-content: center;
    border: 2px solid var(--surface-color);
    padding: 0 4px; /* Padding horizontal jika angka lebih dari 1 digit */

    /* Default Sembunyi */
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none;
}
.notification-badge.show {
    /* Tampilkan jika ada notif baru */
    opacity: 1;
    transform: scale(1);
}

.notification-panel {
    position: absolute;
    top: 55px; /* Di bawah header */
    right: 0;
    width: 320px;
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    border: 1px solid var(--border-color);
    z-index: 1000;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none; /* Tidak bisa diklik saat tersembunyi */
}
.notification-panel.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.panel-header { display: flex; justify-content: space-between; align-items: center; padding: 15px; border-bottom: 1px solid var(--border-color); }
.panel-header h3 { margin: 0; font-size: 1rem; }
.panel-header a { font-size: 0.8rem; }

.panel-body { max-height: 400px; overflow-y: auto; }

.notification-item {
    display: flex;
    gap: 12px;
    padding: 15px;
    text-decoration: none;
    color: inherit;
    transition: background-color 0.2s;
}
.notification-item:hover { background-color: #f8f9fa; }
.notification-item:not(:last-child) { border-bottom: 1px solid var(--border-color); }

.notification-item.unread { background-color: #E8F5E9; }

.notif-avatar { width: 40px; height: 40px; border-radius: 50%; overflow: hidden; flex-shrink: 0; }
.notif-avatar img { width: 100%; height: 100%; object-fit: cover; }
.notif-content p { font-size: 0.9rem; line-height: 1.4; color: var(--on-surface-color); margin: 0 0 4px; }
.notif-content p strong { font-weight: 600; }
.notif-content small { font-size: 0.75rem; color: var(--on-surface-secondary); }
/* ============================================= */
/*  STYLING GALERI POSTINGAN DI HALAMAN PROFIL   */
/* ============================================= */

.profile-posts-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.profile-posts-header {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--on-surface-secondary);
    justify-content: center;
    margin-bottom: 20px;
    text-transform: uppercase;
    font-size: 0.9rem;
}
.profile-posts-header h3 {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0;
}

.post-gallery-grid {
    display: grid;
    /* Membuat 3 kolom dengan lebar yang sama */
    grid-template-columns: 1fr 1fr 1fr;
    gap: 5px; /* Jarak antar gambar */
}

.gallery-item {
    position: relative;
    /* Membuat gambar menjadi kotak persegi */
    aspect-ratio: 1 / 1;
    background-color: #eee;
    display: block;
    overflow: hidden;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Pastikan gambar memenuhi kotak tanpa distorsi */
    transition: transform 0.3s ease;
}

/* Efek zoom saat hover */
.gallery-item:hover img {
    transform: scale(1.1);
}

/* Styling untuk overlay */
.gallery-item-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    color: white;
    
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    
    font-size: 1rem;
    font-weight: 600;
    
    opacity: 0; /* Sembunyikan secara default */
    transition: opacity 0.3s ease;
}

.gallery-item:hover .gallery-item-overlay {
    opacity: 1; /* Tampilkan saat item di-hover */
}

.gallery-item-overlay span {
    display: flex;
    align-items: center;
    gap: 5px;
}
/* Styling untuk link profil di feed dan leaderboard */
.feed-user-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
    border-radius: var(--border-radius);
}

/* Styling daftar sertifikat di profil */
.achievement-list { margin-top: 15px; }
.achievement-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background-color: var(--background-light);
    border-radius: 10px;
    margin-bottom: 10px;
    text-decoration: none;
    color: inherit;
    transition: background-color 0.2s;
}
.achievement-item:hover { background-color: #e9e9e9; }
.achievement-icon { font-size: 1.8rem; color: var(--accent-color); }
.achievement-info strong { display: block; font-weight: 600; }
.achievement-info small { color: var(--on-surface-secondary); }
.achievement-action { margin-left: auto; color: var(--border-color); }

/* Di bawah styling .button-primary */

.button-danger {
    display: block;
    width: 100%;
    padding: 15px;
    background: var(--error-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
}
.button-danger:hover {
    background-color: #B71C1C; /* Warna merah lebih gelap */
    transform: translateY(-2px);
}
.button-danger i {
    margin-right: 8px;
}

.action-card {
    background-color: #FFF3F3;
    border: 1px solid var(--error-color);
}
.action-card p {
    font-size: 0.9rem;
    margin: 5px 0 15px;
}

/* Styling untuk Carousel Tantangan */
.challenge-carousel-container {
    margin: 15px 0;
}
.challenge-swiper {
    /* Sedikit trik agar slide di kanan terlihat sebagian */
    margin: 0 -20px;
    padding: 0 20px 25px 20px; /* Padding bawah untuk pagination */
}
.swiper-slide {
    height: auto; /* Biarkan tinggi slide menyesuaikan konten */
}
.challenge-card-feed {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-color-dark));
    color: white;
    padding: 15px;
    border-radius: var(--border-radius);
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.challenge-card-feed:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.1);
}

/* Styling pagination swiper */
.swiper-pagination-bullet {
    background: #ccc;
    opacity: 1;
}
.swiper-pagination-bullet-active {
    background: var(--primary-color);
}

/* 14. RESPONSIVE MEDIA QUERIES
-------------------------------------------------- */
@media (max-width: 768px) {
    .admin-form-grid { grid-template-columns: 1fr; }
    .admin-card { padding: 20px; }
    #map { height: calc(100vh - 60px - 61px); }
}

@media (min-width: 451px) {
    body { padding: 20px; }
    .mobile-container { height: calc(100vh - 40px); }
}