/* Green Compass Farms - Ecommerce Styles */

/* Product Card Styles */
.product-card {
    background: var(--white);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    position: relative;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.product-image {
    position: relative;
    width: 100%;
    height: 250px;
    overflow: hidden;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

.product-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--accent-color);
    color: var(--white);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    z-index: 10;
}

.product-badge.featured {
    background: var(--primary-color);
}

.product-badge.sale {
    background: #E53E3E;
}

.product-badge.new {
    background: var(--secondary-color);
}

.product-info {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-category {
    color: var(--text-light);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.product-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.product-description {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    flex: 1;
    line-height: 1.5;
}

.product-price {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.price-current {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.price-original {
    font-size: 1.1rem;
    color: var(--text-light);
    text-decoration: line-through;
}

.product-stock {
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.stock-available {
    color: var(--primary-color);
}

.stock-low {
    color: var(--accent-color);
}

.stock-out {
    color: #E53E3E;
}

.product-actions {
    display: flex;
    gap: 0.5rem;
}

.add-to-cart {
    flex: 1;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    padding: 10px 16px;
    border-radius: var(--border-radius);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.add-to-cart:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.add-to-cart:disabled {
    background: var(--text-light);
    cursor: not-allowed;
    transform: none;
}

.quick-view {
    background: var(--white);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    padding: 10px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.quick-view:hover {
    background: var(--primary-color);
    color: var(--white);
}

/* Shopping Cart Sidebar */
.cart-sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: var(--white);
    box-shadow: var(--shadow-hover);
    transition: var(--transition);
    /* Keep above CVG global nav (z-index: 9999) */
    z-index: 10001;
    display: flex;
    flex-direction: column;
}

.cart-sidebar.active {
    right: 0;
}

.cart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.cart-header h3 {
    color: var(--primary-color);
    margin: 0;
}

.cart-header button {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-light);
    cursor: pointer;
    transition: var(--transition);
    padding: 5px;
}

.cart-header button:hover {
    color: var(--text-color);
}

.cart-items {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
}

.empty-cart {
    text-align: center;
    color: var(--text-light);
    margin-top: 2rem;
}

.cart-item {
    display: flex;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item img {
    width: 60px;
    height: 60px;
    border-radius: var(--border-radius);
    object-fit: cover;
    flex-shrink: 0;
}

.cart-item-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.cart-item-details h4 {
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
    font-size: 0.95rem;
}

.cart-item-price {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.9rem;
}

.quantity-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.quantity-controls button {
    background: var(--primary-color);
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.quantity-controls button:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.quantity-controls span {
    min-width: 35px;
    text-align: center;
    font-weight: 600;
    font-size: 0.95rem;
}

.remove-btn {
    background: none;
    border: none;
    color: #E53E3E;
    cursor: pointer;
    padding: 4px;
    font-size: 1.1rem;
    transition: var(--transition);
    margin-left: auto;
}

.remove-btn:hover {
    color: #C53030;
    transform: scale(1.1);
}

.cart-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    background: var(--background-light);
}

.cart-total {
    text-align: center;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    color: var(--text-color);
}

.checkout-btn {
    width: 100%;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    padding: 12px;
    border-radius: var(--border-radius);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.checkout-btn:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.checkout-btn:disabled {
    background: var(--text-light);
    cursor: not-allowed;
    transform: none;
}

/* Admin Panel */
.admin-panel {
    position: fixed;
    top: 0;
    right: -500px;
    width: 500px;
    height: 100vh;
    background: var(--white);
    box-shadow: var(--shadow-hover);
    transition: var(--transition);
    /* Keep above CVG global nav (z-index: 9999) */
    z-index: 10001;
    display: flex;
    flex-direction: column;
}

.admin-panel.active {
    right: 0;
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--primary-color);
    color: var(--white);
}

.admin-header h3 {
    margin: 0;
}

.admin-header button {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--white);
    cursor: pointer;
    transition: var(--transition);
    padding: 5px;
}

.admin-header button:hover {
    opacity: 0.8;
}

.admin-content {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
}

.admin-section {
    margin-bottom: 2rem;
}

.admin-section h4 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

.admin-section form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.admin-section input,
.admin-section select,
.admin-section textarea {
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    transition: var(--transition);
}

.admin-section input:focus,
.admin-section select:focus,
.admin-section textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.admin-section textarea {
    resize: vertical;
    min-height: 80px;
}

.admin-section button {
    background: var(--primary-color);
    color: var(--white);
    border: none;
    padding: 12px;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.admin-section button:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

/* Inventory List */
.inventory-item {
    background: var(--background-light);
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    border-left: 4px solid var(--primary-color);
}

.inventory-item-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 0.5rem;
}

.inventory-item-title {
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

.inventory-item-price {
    color: var(--primary-color);
    font-weight: 600;
}

.inventory-item-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-light);
}

.inventory-item-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.edit-btn {
    background: var(--secondary-color) !important;
    padding: 6px 12px !important;
    font-size: 0.8rem !important;
}

.delete-btn {
    background: #E53E3E !important;
    padding: 6px 12px !important;
    font-size: 0.8rem !important;
}

.delete-btn:hover {
    background: #C53030 !important;
}

/* Search Results */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    max-height: 300px;
    overflow-y: auto;
    z-index: 10;
    display: none;
}

.search-result-item {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    gap: 1rem;
    align-items: center;
}

.search-result-item:hover {
    background: var(--background-light);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-image {
    width: 50px;
    height: 50px;
    border-radius: var(--border-radius);
    overflow: hidden;
    flex-shrink: 0;
}

.search-result-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.search-result-info h4 {
    margin: 0 0 0.25rem;
    font-size: 0.95rem;
    color: var(--text-color);
}

.search-result-info p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-light);
}

.search-result-price {
    margin-left: auto;
    font-weight: 600;
    color: var(--primary-color);
}

/* Checkout Modal */
.checkout-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    display: none;
    align-items: center;
    justify-content: center;
    /* Keep above cart/admin panels */
    z-index: 10002;
}

.checkout-content {
    background: var(--white);
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.checkout-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--primary-color);
    color: var(--white);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.checkout-header h3 {
    margin: 0;
}

.checkout-body {
    padding: 1.5rem;
}

.checkout-section {
    margin-bottom: 2rem;
}

.checkout-section h4 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 500;
    color: var(--text-color);
}

.form-group input,
.form-group select {
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.checkout-summary {
    background: var(--background-light);
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.summary-total {
    font-weight: 600;
    font-size: 1.1rem;
    border-top: 1px solid var(--border-color);
    padding-top: 0.5rem;
    margin-top: 0.5rem;
}

/* Mobile Responsiveness for Ecommerce */
@media (max-width: 768px) {
    .cart-sidebar,
    .admin-panel {
        width: 100%;
        right: -100%;
    }

    .product-grid,
    .products-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }

    .checkout-content {
        width: 95%;
        margin: 20px auto;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .product-grid,
    .products-grid {
        grid-template-columns: 1fr;
    }

    .cart-item {
        flex-direction: column;
        gap: 0.5rem;
    }

    .cart-item-image {
        width: 100%;
        height: 150px;
    }

    .cart-item-controls {
        justify-content: space-between;
    }

    .product-actions {
        flex-direction: column;
    }

    .quick-view {
        width: 100%;
    }
}
