:root {
    --primary: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.4);
    --secondary: #ec4899;
    --secondary-glow: rgba(236, 72, 153, 0.4);
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;

    --nav-height: 70px;
    --header-height: 60px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    /* App-like feel */
    display: flex;
    flex-direction: column;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}

/* Header */
header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 100;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.user-auth-btn {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 4px 15px var(--primary-glow);
    transition: all 0.3s ease;
}

.user-auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--secondary-glow);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--primary);
    cursor: pointer;
}

/* Main Content */
main {
    flex: 1;
    margin-top: var(--header-height);
    margin-bottom: var(--nav-height);
    overflow-y: auto;
    position: relative;
    scroll-behavior: smooth;
}

.page {
    display: none;
    padding: 20px;
    padding-bottom: 80px;
    /* Space for FAB */
    animation: fadeIn 0.3s ease;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Bottom Navigation */
nav {
    height: var(--nav-height);
    background: rgba(30, 41, 59, 0.9);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    position: fixed;
    bottom: 0;
    width: 100%;
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.8rem;
    transition: all 0.3s ease;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.nav-item i {
    font-size: 1.4rem;
    margin-bottom: 4px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.nav-item.active {
    color: var(--secondary);
    /* Active color */
}

.nav-item.active i {
    transform: translateY(-4px);
    color: var(--primary);
    text-shadow: 0 4px 10px var(--primary-glow);
}

/* Cards & Lists */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
    position: relative;
    transition: transform 0.2s;
}

.card:active {
    transform: scale(0.98);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.category-tag {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 6px;
    line-height: 1.4;
}

.card-body {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 10px;
}

/* Filter Scroll */
.category-filter {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 15px;
    margin-bottom: 10px;
    scrollbar-width: none;
    /* Firefox */
}

.category-filter::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

.category-chip {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: 20px;
    white-space: nowrap;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.category-chip.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 12px var(--primary-glow);
}

/* FAB */
.fab {
    position: fixed;
    bottom: calc(var(--nav-height) + 20px);
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--secondary), var(--primary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    box-shadow: 0 4px 15px var(--secondary-glow);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 90;
    border: none;
}

.fab:hover {
    transform: scale(1.1) rotate(90deg);
}

/* Profile Section */
.profile-header {
    text-align: center;
    margin-bottom: 30px;
}

.profile-img-large {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 3px solid var(--secondary);
    margin-bottom: 15px;
    box-shadow: 0 0 20px var(--secondary-glow);
}

.profile-name {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.level-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 30px;
}

.level-card {
    background: var(--bg-card);
    padding: 20px;
    border-radius: 16px;
    text-align: center;
    border: 1px solid var(--border);
}

.level-number {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    margin: 10px 0;
    text-shadow: 0 0 10px var(--primary-glow);
}

.exp-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 10px;
}

.exp-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    width: 0%;
    transition: width 0.5s ease;
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s;
}

.modal-overlay.open {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: var(--bg-dark);
    width: 100%;
    max-width: 500px;
    border-radius: 20px;
    border: 1px solid var(--border);
    padding: 24px;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-overlay.open .modal-content {
    transform: translateY(0);
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    background: none;
    border: none;
}

/* Ad Modal and Editor Styling */
#modal-ad .modal-content {
    max-width: 800px;
    width: 95%;
}

#editor-container {
    height: 250px;
    background: white;
    color: black;
    border-radius: 0 0 8px 8px;
    border: 1px solid var(--border);
    border-top: none;
}

.ql-toolbar {
    background: #f1f5f9;
    border-radius: 8px 8px 0 0;
    border-color: var(--border) !important;
}

.ql-container {
    border-color: var(--border) !important;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    font-family: 'Outfit', sans-serif;
}

.ql-editor {
    min-height: 200px;
}

/* Detail Modal Map */
#detail-map {
    width: 100%;
    height: 300px;
    margin-top: 10px;
    border-radius: 12px;
    border: 1px solid var(--border);
    overflow: hidden;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: white;
    font-family: inherit;
    font-size: 1rem;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

/* Modal Footer for Buttons */
.modal-footer {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.btn-submit {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.modal-footer .btn-submit,
.modal-footer .btn-cancel {
    flex: 1;
    margin: 0;
    /* Reset margins */
}

/* Search Button */
.btn-search {
    white-space: nowrap;
    padding: 0 20px;
    background: var(--primary);
    border: none;
    border-radius: 10px;
    color: white;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-search:hover {
    background: var(--secondary);
    box-shadow: 0 0 10px var(--secondary-glow);
}

.btn-cancel {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 14px;
    /* Match btn-submit padding */
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
    text-align: center;
    /* Ensure text is centered */
}

.btn-cancel:hover {
    border-color: var(--text-main);
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

/* Section toggles for My Info */
.toggle-group {
    display: flex;
    background: var(--bg-card);
    padding: 4px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.toggle-btn {
    flex: 1;
    padding: 10px;
    text-align: center;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-muted);
    transition: all 0.2s;
}

.toggle-btn.active {
    background: var(--bg-dark);
    color: white;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Post View */
.post-detail {
    background: var(--bg-dark);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 150;
    padding: 80px 20px 20px 20px;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.post-detail.active {
    transform: translateX(0);
}

.post-detail-close {
    position: absolute;
    top: 25px;
    left: 20px;
    font-size: 1.5rem;
    color: white;
    cursor: pointer;
    z-index: 160;
    background: rgba(30, 41, 59, 0.8);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.comment-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

/* Ad Detail Modal */
.detail-modal-content {
    padding: 0;
    max-height: 90vh;
    overflow-y: hidden;
    /* Header fixed, body scrolls */
    display: flex;
    flex-direction: column;
}

.detail-header {
    background: var(--bg-card);
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.detail-close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
}

.detail-body {
    padding: 20px;
    overflow-y: auto;
}

.detail-actions {
    margin-bottom: 15px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-action-call {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--primary);
    /* Similar to btn-submit but simpler */
    color: white;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.btn-action-call:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px var(--primary-glow);
}

.btn-action-web {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: 1px solid var(--text-muted);
    color: var(--text-muted);
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.btn-action-web:hover {
    border-color: var(--text-main);
    color: var(--text-main);
}

.detail-section-title {
    margin-top: 25px;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
    font-size: 1.1rem;
    font-weight: 600;
}

.detail-map-container {
    width: 100%;
    height: 300px;
    border-radius: 12px;
    border: 1px solid var(--border);
    overflow: hidden;
    position: relative;
    /* For map */
}

.detail-address-text {
    margin-top: 10px;
    color: var(--text-muted);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Like Button */
.fa-heart {
    transition: transform 0.2s, color 0.2s;
    cursor: pointer;
}

.fa-heart:active {
    transform: scale(1.3);
}

.fa-heart.active {
    color: #ef4444;
    /* Red-500 */
    text-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

/* Notification Bell */
.notification-container {
    position: relative;
    cursor: pointer;
    margin-right: 15px;
}

.notification-bell {
    font-size: 1.2rem;
    color: var(--text-muted);
    transition: color 0.3s;
}

.notification-container:hover .notification-bell {
    color: var(--text-main);
}

.notification-dot {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
    display: none;
}

.notification-dot.active {
    display: block;
}

.notification-dropdown {
    position: absolute;
    top: 60px;
    right: 20px;
    width: 300px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0;
    z-index: 200;
    display: none;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    max-height: 400px;
    overflow-y: auto;
}

.notification-dropdown.active {
    display: block;
}

.notification-item {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    display: flex;
    gap: 10px;
    align-items: center;
    cursor: pointer;
    transition: background 0.2s;
}

.notification-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.notification-item.unread {
    background: rgba(99, 102, 241, 0.1);
    /* Indigo tint */
    border-left: 3px solid var(--primary);
}

.notification-item:last-child {
    border-bottom: none;
}

.notif-img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.notif-content {
    flex: 1;
}

.notif-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Badge Tiers */
.badge-tier {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 700;
    margin-left: 5px;
    text-transform: uppercase;
}

.badge-bronze {
    background: #78350f;
    color: #fcd34d;
    border: 1px solid #92400e;
}

.badge-silver {
    background: #334155;
    color: #e2e8f0;
    border: 1px solid #94a3b8;
}

.badge-gold {
    background: #713f12;
    color: #facc15;
    border: 1px solid #ca8a04;
    box-shadow: 0 0 10px rgba(234, 179, 8, 0.3);
}

/* Like & Bookmark Active States */
.fa-heart.active {
    color: #ef4444 !important;
}

.fa-bookmark.active {
    color: #fbbf24 !important;
}