/* Crop Advertisement Form Styles */
.crop-advertisement-form {
    max-width: 600px;
    margin: 2rem auto;
    padding: 2rem;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.crop-advertisement-form .crop-adv-success {
    background: #d4edda;
    color: #155724;
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1.5rem;
    border: 1px solid #c3e6cb;
}

.crop-advertisement-form .crop-adv-error {
    background: #f8d7da;
    color: #721c24;
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1.5rem;
    border: 1px solid #f5c6cb;
}

.crop-adv-form .form-group {
    margin-bottom: 1.5rem;
}

.crop-adv-form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #2c3e50;
}

.crop-adv-form input[type="text"],
.crop-adv-form input[type="email"],
.crop-adv-form input[type="tel"],
.crop-adv-form input[type="number"],
.crop-adv-form select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #ddd !important;
    border-radius: 50px !important;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    background: #ffffff !important;
}

.crop-adv-form input[type="text"]:focus,
.crop-adv-form input[type="email"]:focus,
.crop-adv-form input[type="tel"]:focus,
.crop-adv-form input[type="number"]:focus,
.crop-adv-form select:focus {
    outline: none;
    border-color: #27ae60;
    box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.1);
}

.crop-adv-form .submit-btn {
    background: #27ae60;
    color: white;
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 4px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
    width: 100%;
}

.crop-adv-form .submit-btn:hover {
    background: #219a52;
}

.crop-adv-form .submit-btn:active {
    transform: translateY(1px);
}

/* Responsive design */
@media (max-width: 768px) {
    .crop-advertisement-form {
        margin: 1rem;
        padding: 1.5rem;
    }
    
    .crop-adv-form .submit-btn {
        padding: 0.6rem 1.5rem;
        font-size: 1rem;
    }
}

/* Add styles for the quantity input group */
.quantity-input-group {
    display: flex;
    gap: 0;
}

.quantity-input-group input[type="number"] {
    border-radius: 50px;
    flex: 2;
}

.quantity-input-group select {
    border-radius: 50px;
    flex: 1;
    border-left: none;
}

/* Add styles for the price input group */
.price-input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.price-input-group input[type="number"] {
    padding-left: 35px;
    border-radius: 50px;
}

.currency-symbol {
    position: absolute;
    left: 10px;
    color: #666;
    font-weight: bold;
}

.price-help {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 0.85rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .quantity-input-group {
        flex-direction: column;
        gap: 10px;
    }
    
    .quantity-input-group input[type="number"],
    .quantity-input-group select {
        border-radius: 50px;
        border-left: 2px solid #ddd;
    }
}

/* Crop Advertisements List Styles - Three Column Layout */
.crop-advertisements-list {
    max-width: 800px;
    margin: 0.5rem 0;
}

.crop-advert-item {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: auto auto; /* Two rows */
    gap: 0.2rem;
    padding: 0.6rem 0.4rem;
    margin-bottom: 0.6rem;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.crop-advert-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

/* First row: Type, crop name, and quantity */
.advert-type {
    grid-column: 1;
    grid-row: 1;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-weight: 600;
    text-align: center;
    font-size: 0.85rem;
    justify-self: start;
    align-self: center;
}

.advert-type.selling {
    background-color: #e6f7ee;
    color: #0c6b3f;
}

.advert-type.buying {
    background-color: #ffe6e6;
    color: #c53030;
}

.crop-name {
    grid-column: 2;
    grid-row: 1;
    margin: 0;
    color: #2c3e50;
    font-size: 1.36rem !important;
    font-weight: 500;
    justify-self: center;
    align-self: center;
}

.quantity-info {
    grid-column: 3;
    grid-row: 1;
    font-weight: 600;
    color: #4a5568;
    justify-self: end;
    align-self: center;
}

/* Second row: Location, phone, and timestamp */
.place-info {
    grid-column: 1;
    grid-row: 2;
    color: #718096;
    justify-self: start;
    align-self: center;
}

.phone-info {
    grid-column: 2;
    grid-row: 2;
    justify-self: center;
    align-self: center;
}

/* Add WhatsApp icon styles */
.phone-info a {
    color: #25D366 !important;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0;
}

.phone-info a:hover {
    text-decoration: underline;
}

.whatsapp-icon {
    width: 16px;
    height: 16px;
    display: inline-block;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="%2325D366" d="M380.9 97.1C339 55.1 283.2 32 223.9 32c-122.4 0-222 99.6-222 222 0 39.1 10.2 77.3 29.6 111L0 480l117.7-30.9c32.4 17.7 68.9 27 106.1 27h.1c122.3 0 224.1-99.6 224.1-222 0-59.3-25.2-115-67.1-157zm-157 341.6c-33.2 0-65.7-8.9-94-25.7l-6.7-4-69.8 18.3L72 359.2l-4.4-7c-18.5-29.4-28.2-63.3-28.2-98.2 0-101.7 82.8-184.5 184.6-184.5 49.3 0 95.6 19.2 130.4 54.1 34.8 34.9 56.2 81.2 56.1 130.5 0 101.8-84.9 184.6-186.6 184.6zm101.2-138.2c-5.5-2.8-32.8-16.2-37.9-18-5.1-1.9-8.8-2.8-12.5 2.8-3.7 5.6-14.3 18-17.6 21.8-3.2 3.7-6.5 4.2-12 1.4-32.6-16.3-54-29.1-75.5-66-5.7-9.8 5.7-9.1 16.3-30.3 1.8-3.7.9-6.9-.5-9.7-1.4-2.8-12.5-30.1-17.1-41.2-4.5-10.8-9.1-9.3-12.5-9.5-3.2-.2-6.9-.2-10.6-.2-3.7 0-9.7 1.4-14.8 6.9-5.1 5.6-19.4 19-19.4 46.3 0 27.3 19.9 53.7 22.6 57.4 2.8 3.7 39.1 59.7 94.8 83.8 35.2 15.2 49 16.5 66.6 13.9 10.7-1.6 32.8-13.4 37.4-26.4 4.6-13 4.6-24.1 3.2-26.4-1.3-2.5-5-3.9-10.5-6.6z"/></svg>');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

/* Responsive adjustments for WhatsApp icon */
@media (max-width: 480px) {
    .phone-info a {
        justify-content: center;
    }
    
    .whatsapp-icon {
        width: 14px;
        height: 14px;
    }
}

.timestamp {
    grid-column: 3;
    grid-row: 2;
    color: #a0aec0;
    font-size: 0.85rem;
    justify-self: end;
    align-self: center;
}

/* Hide price */
.price-info {
    display: none !important;
}

.crop-adv-list-empty {
    text-align: center;
    padding: 2rem;
    background: #f7fafc;
    border-radius: 8px;
    color: #718096;
}

/* Responsive design for smaller screens */
@media (max-width: 768px) {
    .crop-advertisements-list {
        max-width: 100%;
        padding: 0;
    }
    
    .crop-advert-item {
        grid-template-columns: 1fr 1fr 1fr;
        grid-template-rows: auto auto;
        padding: 0.8rem 0.4rem;
        gap: 0.2rem;
    }
    
    .advert-type,
    .crop-name,
    .quantity-info,
    .place-info,
    .phone-info,
    .timestamp {
        font-size: 0.8rem;
        text-align: center;
    }
    
    .advert-type {
        padding: 0.2rem 0.6rem;
    }
    
    .crop-name {
        font-size: 0.8rem;
    }
}

/* For very small screens, adjust font sizes but maintain grid layout */
@media (max-width: 480px) {
    .crop-advert-item {
        grid-template-columns: 1fr 1fr 1fr;
        grid-template-rows: auto auto;
        padding: 0.6rem 0.3rem;
        gap: 0.1rem;
        margin: 0.5rem 0;
    }

    .crop-advertisements-list {
        max-width: 100%;
        padding: 0;
        margin: 0;
    }
    
    .advert-type,
    .crop-name,
    .quantity-info,
    .place-info,
    .phone-info,
    .timestamp {
        font-size: 0.75rem;
    }
    
    .crop-name {
        font-size: 0.6rem;
    }
    
    .advert-type {
        padding: 0.15rem 0.5rem;
    }
}

/* For extremely small screens, switch to a more compact layout */
@media (max-width: 360px) {
    .crop-advert-item {
        grid-template-columns: 1fr 2fr 1fr;
    }
    
    .advert-type,
    .crop-name,
    .quantity-info,
    .place-info,
    .phone-info,
    .timestamp {
        font-size: 0.7rem;
    }
    
    .crop-name {
        font-size: 0.6rem;
    }
}

/* Matches card specific styles */
.crop-advertisements-list .crop-advert-item .price-info {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    text-align: center;
    margin-top: 8px !important;
}

.crop-advertisements-list .crop-advert-item .price-info > div {
    padding: 5px;
}

/* User's current ads specific styles */
.my-crop-advertisements .phone-info {
    color: #718096 !important; /* Grey color */
    justify-self: start !important;
}

.my-crop-advertisements .price-info {
    text-align: left !important;
    justify-content: flex-start !important;
}

/* Add a class to the user's ads container for specific targeting */
.crop-advertisements-list.my-crop-ads .phone-info a {
    color: #718096 !important;
}

.crop-advertisements-list.my-crop-ads .price-info {
    text-align: center;
    padding-left: 10px;
}

/* Reveal Price Button Styles */
.reveal-price-btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-left: 10px;
}

.reveal-price-btn:hover {
    background: #2980b9;
}

.wanted-price-reveal {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

.wanted-price {
    color: #2c3e50;
    font-weight: 600;
    background: #f8f9fa;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #e9ecef;
}

/* Responsive adjustments for reveal button */
@media (max-width: 768px) {
    .wanted-price-reveal {
        flex-direction: column;
        gap: 5px;
    }
    
    .reveal-price-btn {
        margin-left: 0;
    }
}

/* Trading Table Styles */
.crop-adv-trading-table {
    max-width: 800px;
    margin: 0.4rem auto;
    padding: 0.5rem;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.crop-adv-trading-table h5 {
    margin: 0 0 0.5rem 0;
    color: #2c3e50;
    text-align: left;
}

.trading-table-description {
    text-align: left;
    color: #718096;
    margin-bottom: 1.5rem;
}

.trading-prices-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

.trading-prices-table th {
    background: #f7fafc;
    padding: 0.8rem 0.5rem;
    text-align: left;
    font-weight: 600;
    color: #2c3e50;
    border-bottom: 1px solid #e2e8f0;
}

.trading-prices-table td {
    padding: 0.5rem 0.25rem;
    border-bottom: 1px solid #e2e8f0;
}

.trading-prices-table tr:hover {
    background: #f8f9fa;
}

.prices-crop-name {
    font-size: 15px !important;
    font-weight: 600;
    color: #2c3e50;
    text-align: left !important;
}

.market-price {
    font-weight: 600;
    color: #2b6cb0;
    text-align: center;
}

.avg-selling {
    color: #38a169 !important;
    text-align: center;
}

.avg-buying {
    color: #e53e3e !important;
    text-align: center;
}

.price-difference {
    text-align: center;
}


.price-difference .diff.positive {
    color: #38a169 !important;
    font-weight: 600;
}

.price-difference .diff.negative {
    color: #e53e3e !important;
    font-weight: 600;
}

.no-data {
    color: #a0aec0;
    font-style: italic;
}

.trading-table-footer {
    display: flex;
    justify-content: space-between;
    padding-top: 1rem;
}

.trading-table-footer small {
    color: #718096;
}

.crop-adv-trading-table-empty {
    text-align: center;
    padding: 2rem;
    background: #f7fafc;
    border-radius: 8px;
    color: #718096;
}

/* Responsive trading table */
@media (max-width: 768px) {
    .trading-prices-table {
        display: block;
        overflow-x: auto;
    }
    
    .trading-table-footer {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
}

/* Remove all borders from trading table */
.trading-prices-table {
    border: none !important;
}

.trading-prices-table th,
.trading-prices-table td {
    border: none !important;
}

.trading-prices-table tr {
    border: none !important;
}

/* Remove any remaining border from the table container */
.crop-adv-trading-table {
    border: none !important;
    box-shadow: none !important; /* Optional: remove the shadow too for a completely flat look */
}

/* Delete Advertisement Button Styles */
.delete-ad-btn {
    background: #808080 !important;
    color: white !important;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.delete-ad-btn:hover {
    background: #000000 !important;
}

.delete-ad-container {
    border-top: 1px solid #e2e8f0;
    padding-top: 10px;
}

/* Make sure the delete button is properly spaced */
.my-crop-ads .crop-advert-item {
    position: relative;
}

/* Responsive adjustments for delete button */
@media (max-width: 768px) {
    .delete-ad-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
}