* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    background: #f5f5f5; color: #333; line-height: 1.6;
}

a { color: #3498db; text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
header {
    background: #2c3e50; color: #fff; padding: 1rem 2rem;
    display: flex; justify-content: space-between; align-items: center;
}
header .logo { font-size: 1.5rem; font-weight: bold; color: #fff; text-decoration: none; }
header .logo:hover { text-decoration: none; }
header nav { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
header nav a { color: #ecf0f1; text-decoration: none; font-size: 0.85rem; padding: 0.3rem 0.5rem; border-radius: 4px; }
header nav a:hover { background: rgba(255,255,255,0.1); text-decoration: none; }

/* Impersonation banner */
.impersonation-banner {
    background: #e74c3c; color: #fff; padding: 0.25rem 0.75rem;
    border-radius: 4px; font-size: 0.8rem; display: inline-flex;
    align-items: center; gap: 0.5rem;
}
.impersonation-banner a { color: #fff; font-weight: bold; text-decoration: underline; }

/* Buttons */
.btn-sell {
    background: #e67e22; color: #fff !important; font-weight: bold;
    padding: 0.4rem 1rem !important; border-radius: 20px !important;
}
.btn-sell:hover { background: #d35400 !important; text-decoration: none !important; }
.btn {
    display: inline-block; padding: 0.5rem 1rem; border-radius: 4px;
    text-decoration: none; font-size: 0.9rem; cursor: pointer; border: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: #3498db; color: #fff; }
.btn-primary:hover { background: #2980b9; }
.btn-success { background: #27ae60; color: #fff; }
.btn-success:hover { background: #219a52; }
.btn-danger { background: #e74c3c; color: #fff; }
.btn-danger:hover { background: #c0392b; }
.btn-warning { background: #f39c12; color: #fff; }
.btn-warning:hover { background: #d68910; }
.btn-secondary { background: #95a5a6; color: #fff; }
.btn-secondary:hover { background: #7f8c8d; }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.8rem; }

/* Alerts */
.alert { padding: 0.75rem 1rem; border-radius: 4px; margin-bottom: 1rem; }
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

/* Cards & Layout */
main { max-width: 1000px; margin: 2rem auto; padding: 0 1rem; }
.card {
    background: #fff; border-radius: 8px; padding: 1.5rem; margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.card h1, .card h2 { color: #2c3e50; margin-bottom: 1rem; }
.text-muted { color: #999; }
.text-center { text-align: center; }
.mt-1 { margin-top: 1rem; }
.mb-1 { margin-bottom: 1rem; }

/* Hero */
.hero {
    text-align: center; padding: 3rem 1rem;
    background: linear-gradient(135deg, #3498db, #2c3e50);
    color: #fff; border-radius: 8px; margin-bottom: 2rem;
}
.hero h1 { font-size: 2.5rem; margin-bottom: 0.5rem; }
.hero p { font-size: 1.1rem; opacity: 0.9; margin-bottom: 1.5rem; }
.hero-search { display: flex; max-width: 500px; margin: 0 auto; }
.hero-search input {
    flex: 1; padding: 0.75rem; border: none; border-radius: 4px 0 0 4px; font-size: 1rem;
}
.hero-search button {
    padding: 0.75rem 1.5rem; background: #e67e22; color: #fff;
    border: none; border-radius: 0 4px 4px 0; font-size: 1rem; cursor: pointer;
}
.hero-search button:hover { background: #d35400; }

/* Tags */
.tags { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tag {
    display: inline-block; padding: 0.3rem 0.8rem; background: #ecf0f1;
    border-radius: 20px; color: #2c3e50; text-decoration: none; font-size: 0.9rem;
}
.tag:hover { background: #3498db; color: #fff; text-decoration: none; }

/* Product Grid */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.product-card {
    background: #fff; border: 1px solid #eee; border-radius: 8px;
    padding: 1rem; text-decoration: none; color: #333;
    transition: box-shadow 0.2s; position: relative;
}
.product-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.15); text-decoration: none; }
.product-card h3 { font-size: 1rem; margin-bottom: 0.5rem; }
.product-card .price { font-size: 1.2rem; font-weight: bold; color: #e67e22; }
.product-card .category { font-size: 0.8rem; color: #999; }
.product-list-img {
    width: 100%; height: 160px; object-fit: cover; border-radius: 6px; margin-bottom: 0.5rem;
    background: #f0f0f0;
}
.product-list-placeholder {
    width: 100%; height: 160px; border-radius: 6px; margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #e0e0e0, #f5f5f5);
    display: flex; align-items: center; justify-content: center;
    color: #999; font-size: 2.5rem;
}
.location-text { font-size: 0.85rem; color: #666; margin-top: 0.25rem; }

/* Carousel */
.carousel {
    position: relative; width: 100%; max-width: 600px; margin: 0 auto 1rem;
    display: flex; align-items: center; gap: 0.5rem;
}
.carousel img {
    width: 100%; height: 400px; object-fit: cover; border-radius: 8px;
    flex-shrink: 0; display: none;
}
.carousel img.active { display: block; }
.carousel-btn {
    background: rgba(0,0,0,0.5); color: #fff; border: none;
    width: 40px; height: 40px; border-radius: 50%; font-size: 1.2rem;
    cursor: pointer; flex-shrink: 0; z-index: 1;
}
.carousel-btn:hover { background: rgba(0,0,0,0.8); }
.carousel-dots {
    display: flex; justify-content: center; gap: 0.4rem; margin-top: 0.5rem;
}
.carousel-dots span {
    width: 10px; height: 10px; border-radius: 50%; background: #ccc; cursor: pointer;
}
.carousel-dots span.active { background: #3498db; }

/* Mini-map */
.mini-map { height: 200px; border-radius: 8px; margin-top: 0.5rem; }

/* Badges */
.badge-sold {
    display: inline-block; padding: 0.25rem 0.75rem;
    background: #e74c3c; color: #fff; border-radius: 4px; font-weight: bold;
}
.badge-pending {
    display: inline-block; padding: 0.25rem 0.75rem;
    background: #f39c12; color: #fff; border-radius: 4px;
}

/* Profile */
.profile-header { display: flex; gap: 1.5rem; align-items: center; }
.profile-avatar { text-align: center; }
.profile-avatar img { width: 100px; height: 100px; border-radius: 50%; object-fit: cover; }
.avatar-placeholder {
    width: 100px; height: 100px; border-radius: 50%; background: #3498db;
    color: #fff; font-size: 2.5rem; display: flex; align-items: center;
    justify-content: center; margin: 0 auto;
}
.avatar-upload { margin-top: 0.5rem; }
.avatar-upload label { cursor: pointer; }
.profile-info h1 { margin-bottom: 0.25rem; }
.profile-email { color: #666; font-size: 0.9rem; margin-top: 0.25rem; }
.trust-stars { display: flex; align-items: center; gap: 2px; margin: 0.5rem 0; }
.star { font-size: 1.2rem; opacity: 0.2; }
.star.filled { opacity: 1; }
.trust-label { margin-left: 0.5rem; font-size: 0.85rem; color: #666; }
.profile-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* User cards */
.user-card {
    display: flex; align-items: center; gap: 1rem; padding: 1rem;
    text-decoration: none; color: inherit;
    border: 1px solid #e0e0e0; border-radius: 8px; margin-bottom: 0.5rem;
}
.user-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.1); text-decoration: none; }
.user-avatar {
    width: 50px; height: 50px; border-radius: 50%; overflow: hidden;
    background: #f0f0f0; flex-shrink: 0;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-avatar-placeholder {
    width: 100%; height: 100%; display: flex; align-items: center;
    justify-content: center; font-size: 1.5rem;
}

/* Tabs */
.tab-bar { display: flex; gap: 0; margin-bottom: 1.5rem; border-bottom: 2px solid #e0e0e0; }
.tab-bar a {
    padding: 0.75rem 1.5rem; text-decoration: none; color: #666;
    border-bottom: 2px solid transparent; margin-bottom: -2px;
}
.tab-bar a:hover { text-decoration: none; }
.tab-bar a.active { color: #333; border-bottom-color: #007bff; font-weight: bold; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.75rem; text-align: left; border-bottom: 1px solid #eee; }
th { font-weight: 600; color: #2c3e50; }

/* Filters */
.filters { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filters select, .filters input { padding: 0.5rem; border: 1px solid #ddd; border-radius: 4px; }

/* Chat */
.chat-product-header {
    display: flex; gap: 1rem; align-items: center; padding: 0.75rem;
    background: #f8f9fa; border-radius: 8px; margin-bottom: 1rem;
}
.chat-product-header img {
    width: 60px; height: 60px; object-fit: cover; border-radius: 6px;
}
.chat-product-header .chat-info { flex: 1; }
.chat-product-header .chat-info h3 { margin: 0 0 0.25rem; font-size: 1rem; }
.chat-product-header .chat-info p { margin: 0; font-size: 0.85rem; color: #666; }
.chat-link { color: #3498db; text-decoration: none; font-size: 0.9rem; }
.chat-link:hover { text-decoration: underline; }
.chat-price { font-weight: bold; color: #e67e22; }

/* Message bubbles */
.msg-bubble {
    max-width: 75%; margin-bottom: 0.75rem; padding: 0.5rem 0.75rem;
    border-radius: 12px; position: relative; word-wrap: break-word;
}
.msg-bubble p { margin: 0.25rem 0; }
.msg-bubble small { font-size: 0.7rem; opacity: 0.7; display: block; margin-top: 0.25rem; }
.msg-self {
    margin-left: auto; background: #dcf8c6; border-bottom-right-radius: 4px;
}
.msg-other {
    margin-right: auto; background: #f1f0f0; border-bottom-left-radius: 4px;
}
.msg-input {
    width: 100%; box-sizing: border-box; padding: 0.5rem;
    border: 1px solid #ddd; border-radius: 4px;
}

/* Checkbox star rating */
.star-rating { display: flex; gap: 0.5rem; margin-top: 0.25rem; }
.star-rating label { cursor: pointer; font-size: 1.5rem; }
.star-rating input { display: none; }

/* Seller card */
.seller-card {
    display: flex; justify-content: space-between; align-items: center;
}
.seller-info {
    display: flex; align-items: center; gap: 1rem;
}
.seller-info a { text-decoration: none; color: inherit; }
.seller-avatar {
    width: 48px; height: 48px; border-radius: 50%; object-fit: cover;
}
.seller-avatar-placeholder {
    width: 48px; height: 48px; border-radius: 50%; background: #3498db;
    color: #fff; display: flex; align-items: center;
    justify-content: center; font-weight: bold;
}
.seller-name { margin: 0; display: inline; }
.seller-actions { display: flex; gap: 0.5rem; }

/* Sold buyer section */
.buyer-section {
    display: flex; justify-content: space-between; align-items: center;
}

/* Report section at bottom */
.report-section {
    text-align: center; padding: 1rem; margin-top: 2rem;
}
.report-section .report-forms {
    display: none; margin-top: 0.5rem;
    max-width: 400px; margin-left: auto; margin-right: auto; text-align: left;
}

/* Footer */
footer {
    background: #2c3e50; color: #ecf0f1; padding: 2rem 0; margin-top: 3rem;
}
footer .footer-grid {
    max-width: 1200px; margin: auto;
    display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem; padding: 0 1rem;
}
footer h3 { margin-top: 0; }
footer ul { list-style: none; padding: 0; }
footer ul li a { color: #ecf0f1; text-decoration: none; }
footer ul li a:hover { text-decoration: underline; }
footer .footer-bottom {
    text-align: center; margin-top: 2rem; padding-top: 1rem;
    border-top: 1px solid #455a64; font-size: 0.85rem;
}

/* Utility classes */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.w-full { width: 100%; }
.block { display: block; }
.hidden { display: none; }
.rounded { border-radius: 4px; }

/* Forms */
.form-input {
    width: 100%; padding: 0.5rem; border: 1px solid #ddd; border-radius: 4px;
    box-sizing: border-box;
}
.form-input:focus { border-color: #3498db; outline: none; }
.form-select {
    width: 100%; padding: 0.5rem; border: 1px solid #ddd; border-radius: 4px;
}
.form-group { margin-bottom: 0.75rem; }
.form-card { max-width: 500px; }
.form-card-wide { max-width: 600px; }
.form-card-narrow { max-width: 400px; }
.form-card-center { margin: 2rem auto; }

/* Map */
.map-container { height: 250px; border-radius: 4px; margin-bottom: 0.5rem; }
.map-container-lg { height: 300px; border-radius: 4px; margin-bottom: 0.5rem; }
.map-input-group { display: flex; gap: 0.5rem; }
.map-input-group input { width: 50%; padding: 0.5rem; }
.map-input-readonly { background: #f5f5f5; }

/* Rating items */
.rating-item { border-bottom: 1px solid #e0e0e0; padding: 0.75rem 0; }
.rating-header { display: flex; justify-content: space-between; }
.rating-product { margin: 0.25rem 0; font-size: 0.9rem; }
.rating-comment { margin: 0.25rem 0; font-style: italic; }

/* Full-width button */
.btn-full { width: 100%; padding: 0.75rem; font-size: 1.1rem; }

/* Nav links in admin */
.admin-nav { margin-top: 1rem; display: flex; gap: 0.5rem; flex-wrap: wrap; }
.admin-dash-links { display: flex; gap: 2rem; margin-top: 1rem; }

/* Nav badge */
.nav-badge {
    background: #dc3545; color: #fff; border-radius: 10px;
    padding: 1px 6px; font-size: 0.7rem; margin-left: 2px;
    vertical-align: super;
}
.nav-badge-sub {
    background: #dc3545; color: #fff; border-radius: 10px;
    padding: 1px 6px; font-size: 0.7rem; margin-left: 4px;
}

/* User menu dropdown */
.user-menu {
    position: relative; display: inline-block;
}
.user-menu-trigger {
    display: flex; align-items: center; gap: 0.4rem;
    cursor: pointer; padding: 0.3rem 0.5rem; border-radius: 4px;
    color: #ecf0f1; font-size: 0.85rem;
}
.user-menu-trigger:hover { background: rgba(255,255,255,0.1); }
.user-avatar-mini {
    width: 28px; height: 28px; border-radius: 50%; object-fit: cover;
}
.avatar-placeholder {
    width: 28px; height: 28px; border-radius: 50%; background: #3498db;
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem; font-weight: bold;
}
.user-menu-name { white-space: nowrap; }
.user-menu-arrow { font-size: 0.7rem; }
.user-menu-dropdown {
    display: none; position: absolute; top: 100%; right: 0;
    background: #fff; border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 180px; z-index: 100; padding: 0.4rem 0;
}
.user-menu-dropdown a {
    display: block; padding: 0.5rem 1rem; color: #333; font-size: 0.85rem;
    text-decoration: none; white-space: nowrap;
}
.user-menu-dropdown a:hover { background: #f5f5f5; text-decoration: none; }
.user-menu:hover .user-menu-dropdown { display: block; }

/* Inbox items */
.inbox-img {
    width: 48px; height: 48px; border-radius: 6px; object-fit: cover; flex-shrink: 0;
}
.inbox-placeholder {
    width: 48px; height: 48px; border-radius: 6px; background: #f0f0f0;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 1.2rem;
}
.inbox-flex { flex: 1; }

/* Misc */
.top-user-badge { margin-left: 0.5rem; }
.seller-stars { font-size: 1.1rem; }
.seller-stars-small { font-size: 0.8rem; }
.price-lg { font-size: 1.5rem; }
.carousel-inner { flex: 1; position: relative; }
.text-small { font-size: 0.85rem; }
.star-label { font-size: 0.85rem; }
.hidden-form { display: none; }
.report-form-inner { margin-top: 0.5rem; max-width: 400px; margin-left: auto; margin-right: auto; text-align: left; }
