/* 
  Color Palette:
  - Primary Blue: #004E98
  - Secondary Green: #3A864B
  - Light Neutral: #F5F5F5
  - Dark Text: #333333
  - Accent/CTA Orange: #FF6700
  - White: #FFFFFF
*/

body {
    font-family: Arial, sans-serif;
    margin: 0;
    background-color: #F5F5F5;
    color: #333333;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.header-container {
    background-color: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-top-bar {
    background-color: #f5f5f5;
    padding: 0.5rem 2rem;
    border-bottom: 1px solid #e0e0e0;
}

.header-main {
    padding: 2rem;
}

.header-content-wrapper {
    max-width: 1200px; /* Adjust this value as needed */
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-top-bar .header-content-wrapper {
    justify-content: center;
}

.header-main .header-content-wrapper {
    /* No justify-content needed, flex-grow on search bar will handle spacing */
}

.search-bar {
    flex-grow: 1;
    display: flex;
    max-width: 700px;
}

.search-bar input[type="text"] {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid #004E98;
    border-right: none;
    border-radius: 20px 0 0 20px;
    outline: none;
}

.search-bar button {
    padding: 0 25px;
    border: 2px solid #004E98;
    background-color: #004E98;
    color: white;
    font-weight: bold;
    cursor: pointer;
    border-radius: 0 20px 20px 0;
    transition: background-color 0.2s;
}

.search-bar button:hover {
    background-color: #003d7a;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: #004E98;
    text-decoration: none;
    flex-shrink: 0; /* Prevents logo from shrinking */
}

.header-nav {
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-nav a {
    color: #004E98;
    text-decoration: none;
    white-space: nowrap;
}

.header-nav a:hover {
    text-decoration: underline;
}

.user-menu span {
    color: #333;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-sell {
    background-color: #FF6700; /* Accent/CTA Orange */
    color: #FFFFFF !important;
    padding: 8px 15px;
    border-radius: 20px;
    font-weight: bold;
    text-decoration: none !important;
    transition: background-color 0.2s, transform 0.2s;
}

.btn-sell:hover {
    background-color: #e65c00; /* Darker orange on hover */
    transform: scale(1.05); /* Slight zoom effect on hover */
}

.login-prompt {
    display: flex;
    align-items: center;
    gap: 0.8em; /* Increased spacing for better readability */
}

.main-content h1 {
    font-size: 1.8rem;
    color: #333;
    border-bottom: 2px solid #004E98;
    padding-bottom: 0.5rem;
    margin-bottom: 2rem;
}

/* Responsive Header */
@media (max-width: 768px) {
    .header-main .header-content-wrapper {
        flex-direction: column;
        gap: 2rem;
    }

    .search-bar {
        width: 100%;
        order: 2; /* Make search bar appear below logo */
    }

    .logo {
        order: 1;
        align-self: flex-start;
    }

    .header-top-bar {
        padding: 0.5rem 1rem;
        justify-content: center;
    }

    .user-menu { display: none; } /* Hide complex menu on mobile for simplicity */
}

/* Homepage Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.5rem;
}

.product-card {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    overflow: hidden;
    text-decoration: none;
    color: #333;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.3s ease;
}

.product-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.product-image {
    width: 100%;
    padding-top: 100%; /* 1:1 Aspect Ratio */
    position: relative;
    background-color: #f0f0f0;
}

.product-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* Ensures the image covers the area without distortion */
}

.product-info {
    padding: 1rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.product-title {
    font-size: 1rem;
    margin: 0 0 0.5rem 0;
    line-height: 1.3;
    /* Truncate long titles */
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* number of lines to show */
    -webkit-box-orient: vertical;
}

.featured-section {
    background-color: #e7f0f9;
    padding: 2rem;
    margin: -2rem -2rem 2rem -2rem; /* Extend to edges */
}

.featured-section h2 {
    margin-top: 0;
}

.search-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.search-header h1 {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.search-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sort-form {
    margin-bottom: 0; /* Reset margin */
}

.sort-form label {
    margin-right: 0.5rem;
}
.sort-form select {
    padding: 5px;
    border-radius: 3px;
}

.product-price {
    font-size: 1.2rem;
    font-weight: bold;
    color: #3A864B; /* Secondary Green */
    margin: 0 0 0.5rem 0;
}

.product-seller {
    font-size: 0.8rem;
    color: #666;
    margin-top: auto; /* Pushes seller to the bottom */
}

.main-content {
    padding: 2rem;
    flex-grow: 1;
}

.footer {
    background-color: #004E98;
    color: #FFFFFF;
    text-align: center;
    padding: 1rem;
}

.footer-content {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-nav a {
    color: white;
}
/* Form & Login/Register Page Styles */
.form-container {
    max-width: 500px;
    margin: 2rem auto;
    padding: 2rem;
    background-color: #FFFFFF;
    border: 1px solid #DDDDDD;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.form-container h2 {
    text-align: center;
    color: #333;
    margin-top: 0;
}

.form-container p {
    text-align: center;
    color: #666;
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    font-size: 0.9rem;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box; /* Ensures padding doesn't affect width */
}

.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

.btn.btn-primary {
    width: 100%;
    padding: 12px;
    background-color: #004E98;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
}

.btn.btn-primary:hover {
    background-color: #003d7a;
}

.error-box, .success-box, .info-box {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 4px;
    border: 1px solid;
}

.error-box {
    background-color: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

.success-box {
    background-color: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

.info-box {
    background-color: #e7f0f9;
    color: #004E98;
    border-color: #b3d1f0;
}

.form-footer-link {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.9rem;
}

.form-extra-links {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.9rem;
}

/* Registration Page Specific Styles */
fieldset {
    border: 1px solid #ddd;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 5px;
}

legend {
    font-weight: bold;
    color: #004E98;
    padding: 0 0.5rem;
}

.account-type-group {
    display: flex;
    justify-content: space-around;
    gap: 1rem;
}

.account-type-label {
    display: block;
    padding: 1rem;
    border: 2px solid #ccc;
    border-radius: 5px;
    cursor: pointer;
    width: 45%;
    text-align: center;
    position: relative;
}

.account-type-label input[type="radio"] {
    display: none; /* Hide the actual radio button */
}

.account-type-label:has(input:checked) {
    border-color: #004E98;
    background-color: #e7f0f9;
}

.field-description {
    font-size: 0.8rem;
    color: #666;
    margin-top: 4px;
}

.hidden {
    display: none;
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-row .form-group {
    flex: 1;
}
}

/* Admin Panel Styles */
.admin-container {
    max-width: 960px;
    margin: 0 auto;
}

.admin-form {
    max-width: 100%;
    margin-bottom: 2rem;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.admin-table th, .admin-table td {
    padding: 12px 15px;
    border: 1px solid #ddd;
    text-align: left;
}

.admin-table th {
    background-color: #e7f0f9;
    color: #004E98;
    font-weight: bold;
}

.admin-table tr:nth-of-type(even) {
    background-color: #f9f9f9;
}

.admin-table td.actions {
    text-align: center;
}

.btn-delete {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}
.btn-delete:hover {
    background-color: #c82333;
}

.admin-dashboard-links {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 2rem;
}

.dashboard-link {
    display: block;
    background-color: #fff;
    padding: 2rem;
    text-align: center;
    font-size: 1.2rem;
    font-weight: bold;
    color: #004E98;
    text-decoration: none;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.dashboard-link:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.back-link {
    display: inline-block;
    margin-bottom: 1rem;
    color: #004E98;
    text-decoration: none;
}

.back-link:hover {
    text-decoration: underline;
}

.btn-approve {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}
.btn-approve:hover {
    background-color: #218838;
}

.admin-table th.actions-col {
    width: 180px;
}

.btn-secondary-admin {
    background-color: #6c757d;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.9rem;
    text-decoration: none;
    display: inline-block;
    vertical-align: middle;
}
.btn-secondary-admin:hover {
    background-color: #5a6268;
}

.status-badge {
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
    text-transform: uppercase;
    max-width: 400px;
}

.history-h2 {
    margin-top: 3rem;
    border-top: 1px solid #ddd;
    padding-top: 2rem;
}

.status-active {
    background-color: #28a745; /* Green */
}
.status-pending-verification {
    background-color: #ffc107; /* Yellow */
}
.status-suspended {
    background-color: #dc3545; /* Red */
} 

/* My Listings Page */
.product-card-container {
    position: relative;
    display: flex;
    flex-direction: column;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

.product-card-container:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.product-card-container .product-card {
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.status-overlay {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
    text-transform: uppercase;
}

.status-sold {
    background-color: #6c757d; /* Gray */
}

.status-pending-payment {
    background-color: #ffc107; /* Yellow */
}

.card-actions {
    display: flex;
    margin-top: auto;
}

.card-actions > * { /* Target both <a> and <form> */
    flex: 1 1 50%;
}

.form-card-action {
    flex: 1;
}

.btn-card-action {
    display: block;
    width: 100%;
    padding: 10px;
    color: white;
    text-align: center;
    text-decoration: none;
    font-weight: bold;
    border: none;
    cursor: pointer;
    font-family: Arial, sans-serif;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}

.btn-card-action.btn-edit {
    background-color: #004E98; /* Primary Blue */
}
.btn-card-action.btn-edit:hover {
    background-color: #004E98;
}

.btn-card-action.btn-mark-sold {
    background-color: #5a6268; /* Dark Grey */
}
.btn-card-action.btn-mark-sold:hover {
    background-color: #4a4f54;
}

.btn-card-action.btn-relist {
    background-color: #3A864B; /* Secondary Green */
    width: 100%;
}
.btn-card-action.btn-relist:hover {
    background-color: #2e6b3c;
}

.purchase-date {
    font-size: 0.8rem;
    color: #666;
    margin-top: 0.5rem;
}

.reviews-section {
    margin-top: 2rem;
    background-color: #fff;
    padding: 2rem;
    border-radius: 5px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.reviews-section h2 {
    font-size: 1.5rem;
    margin-top: 0;
}

.review-form-container {
    background-color: #f9f9f9;
    border: 1px solid #eee;
    padding: 1.5rem;
    border-radius: 5px;
    margin-bottom: 2rem;
}

.review-form-container h3 {
    margin-top: 0;
    color: #004E98;
}

.star-rating {
    display: flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
    font-size: 2rem;
}

.star-rating input {
    display: none;
}

.star-rating label {
    color: #ccc;
    cursor: pointer;
    transition: color 0.2s;
}

.star-rating input:checked ~ label,
.star-rating label:hover,
.star-rating label:hover ~ label {
    color: #FF6700; /* Accent Orange */
}

.reviews-list {
    margin-top: 2rem;
}

.review-card {
    border-bottom: 1px solid #eee;
    padding: 1.5rem 0;
}

.review-card:last-child {
    border-bottom: none;
}

.review-rating {
    font-size: 1.2rem;
    color: #FF6700;
    margin-bottom: 0.5rem;
}

.review-rating-empty {
    color: #ccc;
}

.review-comment {
    line-height: 1.6;
    margin: 0.5rem 0;
}

.review-meta {
    font-size: 0.9rem;
    color: #666;
}

.review-form-container .error-box {
    background-color: #f8d7da;
    padding: 1rem;
}

/* Messaging System Styles */
.inbox-container, .conversation-view-container {
    max-width: 800px;
    margin: 0 auto;
    background-color: #fff;
    padding: 2rem;
    border-radius: 5px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.conversations-list {
    border: 1px solid #ddd;
    border-radius: 5px;
    overflow: hidden;
}

.conversation-item {
    display: flex;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #eee;
    text-decoration: none;
    color: #333;
    transition: background-color 0.2s;
}

.conversation-item:last-child {
    border-bottom: none;
}

.conversation-item:hover {
    background-color: #f9f9f9;
}

.conversation-item.unread {
    background-color: #e7f0f9;
    font-weight: bold;
}

.convo-details p {
    margin: 0;
    line-height: 1.5;
}

.convo-user {
    font-size: 1.1rem;
}

.convo-listing {
    font-size: 0.9rem;
    color: #666;
}

.convo-meta {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    min-width: 120px;
}

.convo-time {
    font-size: 0.8rem;
    color: #888;
}

.unread-indicator {
    background-color: #FF6700;
    color: white;
    font-size: 0.8rem;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 5px;
}

.unread-badge {
    background-color: #FF6700;
    color: white;
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 5px;
    font-weight: bold;
}

.convo-header {
    border-bottom: 1px solid #eee;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.convo-header h1 {
    border: none;
    margin-bottom: 0.5rem;
}

.convo-header p {
    margin: 0;
    color: #666;
}

.message-thread {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
    max-height: 60vh;
    overflow-y: auto;
    padding: 1rem;
}

.message-bubble {
    max-width: 70%;
    padding: 0.8rem 1rem;
    border-radius: 15px;
    line-height: 1.5;
}

.message-sent {
    background-color: #004E98;
    color: white;
    border-bottom-right-radius: 0;
    align-self: flex-end;
}

.message-received {
    background-color: #e9e9eb;
    color: #333;
    border-bottom-left-radius: 0;
    align-self: flex-start;
}

.message-timestamp {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.7);
    margin-top: 5px;
    text-align: right;
}

.message-received .message-timestamp {
    color: #666;
}

.reply-form textarea {
    resize: vertical;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Profile Page Styles */
.profile-container {
    max-width: 800px;
    margin: 0 auto;
}

.profile-section {
    background-color: #fff;
    padding: 2rem;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.profile-form {
    max-width: 400px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.listing-report-link {
    margin-top: 2rem;
    text-align: right;
    font-size: 0.8rem;
}

    background-color: #fff;
    padding: 2rem;
    border-radius: 5px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.conversations-list {
    border: 1px solid #ddd;
    border-radius: 5px;
    overflow: hidden;
}

.conversation-item {
    display: flex;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #eee;
    text-decoration: none;
    color: #333;
    transition: background-color 0.2s;
}

.conversation-item:last-child {
    border-bottom: none;
}

.conversation-item:hover {
    background-color: #f9f9f9;
}

.conversation-item.unread {
    background-color: #e7f0f9;
    font-weight: bold;
}

.convo-details p {
    margin: 0;
    line-height: 1.5;
}

.convo-user {
    font-size: 1.1rem;
}

.convo-listing {
    font-size: 0.9rem;
    color: #666;
}

.convo-meta {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    min-width: 120px;
}

.convo-time {
    font-size: 0.8rem;
    color: #888;
}

.unread-indicator {
    background-color: #FF6700;
    color: white;
    font-size: 0.8rem;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 5px;
}

.unread-badge {
    background-color: #FF6700;
    color: white;
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 5px;
    font-weight: bold;
}


.statement-actions {
    margin-bottom: 2rem;
    max-width: 250px;
}

/* Account Statement Page */
.statement-container {
    max-width: 960px;

    
.convo-header {
    border-bottom: 1px solid #eee;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.convo-header h1 {
    border: none;
    margin-bottom: 0.5rem;
}

.convo-header p {
    margin: 0;
    color: #666;
}

.message-thread {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
    max-height: 60vh;
    overflow-y: auto;
    padding: 1rem;
}

.message-bubble {
    max-width: 70%;
    padding: 0.8rem 1rem;
    border-radius: 15px;
    line-height: 1.5;
}

.message-sent {
    background-color: #004E98;
    color: white;
    border-bottom-right-radius: 0;
    align-self: flex-end;
}

/* Pagination Styles */
.pagination-container {
    margin-top: 2rem;
    text-align: center;
}

.pagination {
    display: inline-block;
}

.pagination a {
    color: #004E98;
    float: left;
    padding: 8px 16px;
    text-decoration: none;
    transition: background-color .3s;
    border: 1px solid #ddd;
    margin: 0 4px;
    border-radius: 4px;
}

.pagination a.active {
    background-color: #004E98;
    color: white;
    border: 1px solid #004E98;
}

.pagination a:hover:not(.active) {background-color: #ddd;}

/* Saved Searches */
.saved-searches-list {
    margin-top: 2rem;
}

.saved-search-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background-color: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 5px;
    margin-bottom: 1rem;
}

.search-term {
    font-size: 1.2rem;
    font-weight: bold;
    color: #004E98;
    text-decoration: none;
}

.search-term:hover {
    text-decoration: underline;
}

.search-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.search-date {
    font-size: 0.9rem;
    color: #666;
}

.btn-delete-link {
    background: none;
    border: none;
    color: #dc3545;
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.9rem;
}
.message-received {
    background-color: #e9e9eb;
    color: #333;
    border-bottom-left-radius: 0;
    align-self: flex-start;
}

.message-timestamp {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.7);
    margin-top: 5px;
    text-align: right;
}

.message-received .message-timestamp {
    color: #666;
}

.reply-form textarea {
    resize: vertical;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Pagination Styles */
.pagination-container {
    margin-top: 2rem;
    text-align: center;
}

.pagination {
    display: inline-block;
}

.pagination a {
    color: #004E98;
    float: left;
    padding: 8px 16px;
    text-decoration: none;
    transition: background-color .3s;
    border: 1px solid #ddd;
    margin: 0 4px;
    border-radius: 4px;
}

.pagination a.active {
    background-color: #004E98;
    color: white;
    border: 1px solid #004E98;
}

.pagination a:hover:not(.active) {background-color: #ddd;}
