/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Arial', sans-serif;
}

body {
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

header {
    background-color: #002f34;
    color: white;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
}

nav a {
    color: white;
    text-decoration: none;
    margin-left: 1rem;
}

.post-ad-btn {
    background-color: white;
    color: #002f34;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-weight: bold;
}

main {
    padding: 1rem;
    min-height: 80vh;
}

.search-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.search-bar input, .search-bar select {
    padding: 0.5rem;
    flex-grow: 1;
}

.search-bar button {
    padding: 0.5rem 1rem;
    background-color: #002f34;
    color: white;
    border: none;
    border-radius: 4px;
}

.listings {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

footer {
    background-color: #002f34;
    color: white;
    text-align: center;
    padding: 1rem;
    margin-top: 2rem;
}

.language-toggle button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0.2rem 0.5rem;
}

.language-toggle button.active {
    font-weight: bold;
    text-decoration: underline;
}

/* Auth Pages */
.auth-container {
    max-width: 400px;
    margin: 2rem auto;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.auth-container h1 {
    margin-bottom: 1rem;
    text-align: center;
}

.auth-container form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-container input {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.auth-container button {
    padding: 0.5rem;
    background-color: #002f34;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.auth-container p {
    text-align: center;
    margin-top: 1rem;
}
/* Additional Styles for Listings and Forms */

/* Listing Card Styles */
.listing-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}

.listing-card:hover {
    transform: translateY(-5px);
}

.listing-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.listing-details {
    padding: 1rem;
}

.listing-title {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.listing-price {
    font-weight: bold;
    color: #002f34;
    font-size: 1.2rem;
}

.listing-location, .listing-date {
    color: #666;
    font-size: 0.9rem;
    margin-top: 0.3rem;
}

/* Product Detail Page */
.product-detail {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    background: white;
    padding: 1rem;
    border-radius: 8px;
}

.product-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.5rem;
}

.main-image {
    grid-column: 1 / -1;
    height: 400px;
    object-fit: contain;
    background: #f5f5f5;
}

.thumbnail {
    height: 80px;
    object-fit: cover;
    cursor: pointer;
    border: 2px solid transparent;
}

.thumbnail.active {
    border-color: #002f34;
}

.product-info h1 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
}

.product-price {
    font-size: 1.5rem;
    color: #002f34;
    font-weight: bold;
    margin: 1rem 0;
}

.product-meta {
    display: flex;
    gap: 1rem;
    margin: 1rem 0;
    color: #666;
}

.product-description {
    margin: 1rem 0;
    line-height: 1.7;
}

.seller-info {
    background: #f5f5f5;
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
}

.contact-btn {
    display: inline-block;
    background: #002f34;
    color: white;
    padding: 0.7rem 1.5rem;
    border-radius: 4px;
    text-decoration: none;
    margin-top: 1rem;
}

/* Post Ad Form */
.post-ad-form {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    max-width: 800px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.7rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.form-group textarea {
    min-height: 150px;
    resize: vertical;
}

.image-upload {
    border: 2px dashed #ddd;
    padding: 1rem;
    text-align: center;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.image-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.5rem;
    margin-top: 1rem;
}

.preview-image {
    height: 100px;
    object-fit: cover;
    border-radius: 4px;
    position: relative;
}

.remove-image {
    position: absolute;
    top: 0;
    right: 0;
    background: red;
    color: white;
    border: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
}

.submit-btn {
    background: #002f34;
    color: white;
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    width: 100%;
}

/* User Dashboard */
.dashboard {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.sidebar {
    background: white;
    border-radius: 8px;
    padding: 1rem;
}

.sidebar-menu {
    list-style: none;
}

.sidebar-menu li {
    margin-bottom: 0.5rem;
}

.sidebar-menu a {
    display: block;
    padding: 0.7rem;
    color: #333;
    text-decoration: none;
    border-radius: 4px;
}

.sidebar-menu a.active,
.sidebar-menu a:hover {
    background: #f0f0f0;
    color: #002f34;
}

.dashboard-content {
    background: white;
    border-radius: 8px;
    padding: 1rem;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .product-detail {
        grid-template-columns: 1fr;
    }
    
    .dashboard {
        grid-template-columns: 1fr;
    }
    
    .main-image {
        height: 300px;
    }
}

@media (max-width: 480px) {
    .main-image {
        height: 200px;
    }
    
    .product-info h1 {
        font-size: 1.4rem;
    }
}

/* Responsive */
@media (max-width: 600px) {
    .search-bar {
        flex-direction: column;
    }
    
    nav a {
        font-size: 0.9rem;
    }
}
/* Enhanced Post Ad Form Styles */
.post-ad-form h1 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: #002f34;
}

.hint {
    font-size: 0.8rem;
    color: #666;
    margin-top: 0.3rem;
}

.price-options {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.price-option {
    padding: 0.3rem 0.6rem;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
}

.price-option:hover {
    background: #e0e0e0;
}

.preview-container {
    position: relative;
    display: inline-block;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

.preview-image {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.remove-image {
    position: absolute;
    top: 5px;
    right: 5px;
    background: red;
    color: white;
    border: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    line-height: 1;
}

.drag-handle {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: rgba(0, 47, 52, 0.7);
    color: white;
    border: none;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    cursor: move;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.no-images {
    padding: 1rem;
    text-align: center;
    color: #666;
    background: #f5f5f5;
    border-radius: 4px;
}

#uploadBtn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1rem;
    background: #f0f0f0;
    border: 1px dashed #002f34;
    border-radius: 4px;
    cursor: pointer;
}

#uploadBtn svg {
    width: 18px;
    height: 18px;
}

#uploadBtn:hover {
    background: #e0e0e0;
}

/* Loading state for submit button */
.submit-btn:disabled {
    background: #cccccc;
    cursor: not-allowed;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .preview-image {
        width: 80px;
        height: 80px;
    }
    
    .price-options {
        flex-wrap: wrap;
    }
}
/* Messaging Styles */
.messaging-section {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    margin-top: 2rem;
}

.messages-container {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 1rem;
    border: 1px solid #ddd;
    padding: 1rem;
    border-radius: 4px;
}

.message {
    margin-bottom: 1rem;
    padding: 0.5rem;
    border-radius: 4px;
    background: #f5f5f5;
}

.message.sent {
    background: #e3f2fd;
    margin-left: 20%;
}

.message.received {
    background: #f1f1f1;
    margin-right: 20%;
}

.message-sender {
    font-weight: bold;
    color: #002f34;
}

.message-time {
    font-size: 0.8rem;
    color: #666;
    margin-left: 0.5rem;
}

#messageForm {
    display: flex;
    gap: 0.5rem;
}

#messageForm input {
    flex-grow: 1;
    padding: 0.7rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

#messageForm button {
    padding: 0.7rem 1.5rem;
    background: #002f34;
    color: white;
    border: none;
    border-radius: 4px;
}
/* Admin Panel Styles */
.admin-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1rem 0 2rem;
}

.stat-card {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
}

.stat-card h3 {
    color: #666;
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.stat-card p {
    font-size: 1.5rem;
    font-weight: bold;
    color: #002f34;
}

.admin-tabs {
    display: flex;
    border-bottom: 1px solid #ddd;
    margin-bottom: 1rem;
}

.tab-btn {
    padding: 0.7rem 1.5rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 1rem;
}

.tab-btn.active {
    border-bottom-color: #002f34;
    font-weight: bold;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    background: #f5f5f5;
    font-weight: bold;
}

.action-btn {
    padding: 0.3rem 0.7rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.ban-btn {
    background: #ffebee;
    color: #f44336;
}

.remove-btn {
    background: #fff8e1;
    color: #ff9800;
}
/* Favorite Button Styles */
.favorite-btn {
    background: none;
    border: 1px solid #002f34;
    color: #002f34;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 1rem;
}

.favorite-btn.favorited {
    background: #ffebee;
    border-color: #f44336;
    color: #f44336;
}

.favorite-btn.favorited #favoriteIcon {
    color: #f44336;
}
:root {
  --primary-color: #002f34;
  --secondary-color: #f5f5f5;
  --danger-color: #f44336;
}
input:invalid {
  border-color: var(--danger-color);
}
.listing-card {
  transition: transform 0.3s ease-in-out;
}
/* Navigation Links */
nav a#favoritesLink {
    display: none; /* Hidden by default */
}

/* Show favorites link when logged in */
.auth nav a#favoritesLink {
    display: inline-block;
}
.error-message {
    background: #ffebee;
    color: #d32f2f;
    padding: 1rem;
    border-radius: 4px;
    margin: 1rem 0;
}
/* Messaging System Styles */
.loading-messages, .no-messages, .error-messages {
    padding: 1rem;
    text-align: center;
    color: #666;
}

.no-messages {
    font-style: italic;
}

.error-messages {
    color: #d32f2f;
}

/* Message Form Submit Button */
#messageForm button[type="submit"]:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.contact-links {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.contact-btn {
    padding: 8px 14px;
    border-radius: 6px;
    font-weight: bold;
    text-decoration: none;
    color: white;
    transition: background 0.3s ease;
}

.whatsapp-btn {
    background-color: #25D366;
}

.telegram-btn {
    background-color: #0088cc;
}

.instagram-btn {
    background-color: #C13584;
}

.contact-btn {
  display: inline-block;
  margin: 5px;
  padding: 8px 14px;
  background-color: #eee;
  color: #000;
  border: none;
  border-radius: 8px;
  text-decoration: none;
  font-weight: bold;
  transition: 0.2s;
}
.contact-btn:hover {
  background-color: #ddd;
}

.whatsapp-btn { color: green; }
.telegram-btn { color: #0088cc; }
.instagram-btn { color: #d62976; }

.listings {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px;
    box-sizing: border-box;
    font-size: 0; /* Remove whitespace between inline-block elements */
}

@media (max-width: 767px) {
    .listings {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
    }
}

@media (min-width: 768px) {
    .listings {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
        gap: 20px;
    }
}

@media (max-width: 767px) {
  .listing-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px; /* space between columns */
    align-items: start;
  }

  .listing-container > .listingElement {
    vertical-align: top; /* optional if you're using grid */
  }
}

/* Google Sign-In Button Styles */
.google-signin-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 10px 15px;
    background-color: #fff;
    color: #757575;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s;
    margin-bottom: 15px;
}

.google-signin-btn:hover {
    background-color: green;
}

.google-signin-btn img {
    width: 18px;
    height: 18px;
    margin-right: 10px;
}

.auth-divider {
    display: flex;
    align-items: center;
    margin: 15px 0;
    color: #777;
    font-size: 14px;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    border-bottom: 1px solid #ddd;
}

.auth-divider::before {
    margin-right: 10px;
}

.auth-divider::after {
    margin-left: 10px;
}
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    margin-right: 8px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
