/*
  Specific styles for the Seller Dashboard.
  This file handles the layout and styling of dashboard-specific components.
*/

/* --- "My Products" Grid Layout (Desktop) --- */
.product-grid-dashboard {
    display: grid;
    /* A single, centered column for product cards on desktop. */
    grid-template-columns: 1fr;
    gap: 2rem; /* Increased gap for more comfortable spacing */
    justify-items: center; /* Center the card within the grid column */
}

/* --- Seller Dashboard Product Card Styles --- */
/* These styles ensure the product cards on the dashboard are displayed correctly,
   overriding any generic .product-card styles from style.css. */
#product-grid .product-card {
    width: 100%; /* Card fills its container */
    max-width: 800px; /* Add a max-width to prevent cards from being excessively wide on large screens */
    box-sizing: border-box; /* Ensure padding is included in the width */
    display: flex;
    flex-direction: column; /* Ensure vertical layout */
    height: auto; /* Let content determine height */
    background: #fff;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    border-radius: 12px;
    overflow: hidden; /* Ensures content respects the border-radius */
}

#product-grid .product-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

#product-grid .product-card img {
    width: 100%;
    height: 200px; /* Consistent image height */
    object-fit: cover;
    border-bottom: 1px solid #f0f0f0;
}

#product-grid .product-card-content {
    padding: 1rem;
    flex-grow: 1;
}

#product-grid .product-card-content h3 {
    margin: 0 0 0.5rem;
    font-size: 1.1rem;
}

#product-grid .product-card-content .price {
    font-size: 1.2rem;
    font-weight: bold;
    color: #c2185b;
    margin-bottom: 0.5rem;
}

#product-grid .product-card-content .date {
    font-size: 0.8rem;
    color: #777;
}


/* --- Mobile-Specific Adjustments --- */
@media (max-width: 768px) {
    .dashboard-container {
        /* Reduce padding and remove the large top margin that causes a gap */
        /* Further reduce padding to make cards wider on mobile, almost edge-to-edge */
        padding-left: 0.5rem;
        padding-right: 0.5rem;
        margin-top: 1rem;
    }
    /* Switch to a single-column layout for mobile, making cards wider */
    .product-grid-dashboard {
        /* Use flexbox to easily center the cards */
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2rem; /* Increase vertical gap to prevent "smooshed" look */
    }

    /* Make image height more proportional on mobile to avoid stretching */
    #product-grid .product-card img {
        height: 180px; /* A more balanced height for mobile cards */
    }
    
    #product-grid .product-card {
        width: 70%; /* Set card width to 70% of the container */
        max-width: 450px; /* Prevent it from getting too large on wide mobile/small tablet screens */
    }

    /* Reduce horizontal padding inside the card on mobile to make content feel wider */
    #product-grid .product-card-content {
        padding: 1rem 0.75rem;
    }
    /* Adjust padding on card sections for better mobile layout */
    .product-card-stock-toggle,
    .product-card-actions {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* --- Detailed Order Card Styles --- */
.order-card.detailed {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    transition: box-shadow 0.2s ease;
    flex-wrap: wrap;
}

.order-card.detailed:hover {
    box-shadow: 0 6px 16px rgba(0,0,0,0.08);
}

.order-product-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.order-details {
    flex-grow: 1;
}

.order-details h4 {
    margin: 0 0 0.5rem;
    font-size: 1.1rem;
    color: #333;
}

.order-details p {
    margin: 0.25rem 0;
    font-size: 0.85rem;
    color: #666;
}

.order-pricing {
    text-align: right;
    margin-left: auto; /* Pushes it to the right */
}

.order-pricing .price {
    font-size: 1.2rem;
    font-weight: bold;
    color: #c2185b;
    margin: 0 0 0.25rem;
}

.order-pricing .date {
    font-size: 0.8rem;
    color: #888;
    margin: 0;
}

.order-actions {
    flex-shrink: 0;
}

/* --- Messages/Conversations List on Seller Dashboard --- */
#conversations-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem; /* A small gap between conversation items */
}

.conversation-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background-color: #fff;
    border: 1px solid #f0f0f0;
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.conversation-item:hover {
    background-color: #f8f9fa;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.convo-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.convo-info {
    flex-grow: 1;
    min-width: 0; /* Prevents text overflow issues in flex containers */
}

.convo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.25rem;
}

.convo-user-name {
    font-weight: 600;
    font-size: 1.05rem;
    color: #333;
}

.convo-product-name {
    font-size: 0.85rem;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px; /* Adjust as needed */
}

.convo-last-message {
    font-size: 0.9rem;
    color: #555;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.convo-meta {
    text-align: right;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
}

.convo-timestamp {
    font-size: 0.8rem;
    color: #999;
}

.unread-dot {
    width: 10px;
    height: 10px;
    background-color: #c2185b;
    border-radius: 50%;
    align-self: flex-end;
}

/* Unread message styling */
.conversation-item.unread .convo-user-name,
.conversation-item.unread .convo-last-message {
    font-weight: bold;
    color: #222;
}

.conversation-item.unread .convo-last-message {
    color: #c2185b;
}

/* Empty/Loading Messages */
.loading-message, .empty-message {
    text-align: center;
    padding: 2rem;
    color: #777;
    background-color: #f9f9f9;
    border-radius: 8px;
}