/**
 * Public stylesheet for CB Save Carts.
 */

.cb-saved-cart-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.cb-saved-cart {
    margin-bottom: 2rem;
}

.cart-name {
    margin-bottom: 1rem;
}

.cart-status {
    padding: 1rem;
    margin-bottom: 2rem;
    border-radius: 4px;
}

.cart-pending {
    background-color: #fff8e5;
    border-left: 4px solid #ffb900;
}

.cart-approved {
    background-color: #ecf7ed;
    border-left: 4px solid #46b450;
}

.cart-items {
    margin-bottom: 2rem;
}

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

.cart-items-table th,
.cart-items-table td {
    padding: 0.75rem;
    border: 1px solid #ddd;
}

.cart-items-table th {
    background-color: #f9f9f9;
    font-weight: bold;
    text-align: left;
}

.product-name {
    display: flex;
    align-items: center;
}

.product-image {
    margin-right: 1rem;
    flex-shrink: 0;
}

.product-image img {
    max-width: 60px;
    height: auto;
    display: block;
}

.product-details {
    flex: 1;
}

.product-title {
    display: block;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.product-variation {
    font-size: 0.9em;
    color: #666;
}

.product-variation span {
    display: block;
}

.cart-items-table tfoot th,
.cart-items-table tfoot td {
    border-top: 2px solid #ddd;
    font-weight: bold;
}

.comments-list {
    margin-bottom: 2rem;
}

.comment {
    margin-bottom: 1rem;
    padding: 1rem;
    border-radius: 4px;
}

.admin-comment {
    background-color: #e6f3ff;
    border-left: 3px solid #0073aa;
}

.customer-comment {
    background-color: #f9f9f9;
    border-left: 3px solid #72aee6;
}

.comment-meta {
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
}

.comment-author {
    font-weight: bold;
}

.comment-date {
    color: #999;
    font-size: 0.9em;
}

.add-comment {
    margin-bottom: 2rem;
}

.comment-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: vertical;
}

.comment-submit,
.approve-button {
    background-color: #0073aa;
    color: #fff;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    text-transform: uppercase;
}

.comment-submit:hover,
.approve-button:hover {
    background-color: #005f8b;
}

.approve-button {
    background-color: #46b450;
}

.approve-button:hover {
    background-color: #389e42;
}

@media (max-width: 767px) {
    .cb-saved-cart-container {
        padding: 1rem;
    }
    
    .cart-items-table,
    .cart-items-table thead,
    .cart-items-table tbody,
    .cart-items-table th,
    .cart-items-table td,
    .cart-items-table tr {
        display: block;
    }
    
    .cart-items-table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    
    .cart-items-table tr {
        margin-bottom: 1rem;
        border: 1px solid #ddd;
    }
    
    .cart-items-table td {
        border: none;
        border-bottom: 1px solid #ddd;
        position: relative;
        padding-left: 50%;
    }
    
    .cart-items-table td:before {
        position: absolute;
        top: 0.75rem;
        left: 0.75rem;
        width: 45%;
        padding-right: 0.75rem;
        white-space: nowrap;
        font-weight: bold;
    }
    
    .cart-items-table td:nth-of-type(1):before { content: "Product"; }
    .cart-items-table td:nth-of-type(2):before { content: "Quantity"; }
    .cart-items-table td:nth-of-type(3):before { content: "Price"; }
    .cart-items-table td:nth-of-type(4):before { content: "Subtotal"; }
    
    .product-name {
        display: block;
    }
    
    .product-image {
        margin-right: 0;
        margin-bottom: 0.5rem;
    }
    
    .cart-items-table tfoot tr {
        margin-top: 1rem;
    }
    
    .cart-items-table tfoot th {
        display: none;
    }
    
    .cart-items-table tfoot td {
        padding-left: 50%;
    }
    
    .cart-items-table tfoot td:before {
        content: attr(data-title);
    }
}

/* Add loading spinner */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: #3498db;
    animation: spin 1s ease-in-out infinite;
    -webkit-animation: spin 1s ease-in-out infinite;
    vertical-align: middle;
    margin-right: 5px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@-webkit-keyframes spin {
    to { -webkit-transform: rotate(360deg); }
}

/* Message styles */
.cart-action-message {
    margin-top: 15px;
}

.cart-action-message.success {
    color: #0f834d;
    background-color: #f8f8f8;
    padding: 10px;
    border-left: 3px solid #0f834d;
}

.cart-action-message.error {
    color: #e2401c;
    background-color: #f8f8f8;
    padding: 10px;
    border-left: 3px solid #e2401c;
}

.cart-action-loading {
    margin-top: 10px;
    color: #666;
}

/* Cart action area */
.cart-action-area {
    margin-top: 20px;
}

/* Make sure our messages are visible */
#cart-message {
    padding: 10px 15px;
    margin-bottom: 20px;
    border-left: 3px solid #0f834d;
    background-color: #f8f8f8;
}

/* Cart Actions */
.cart-actions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

/* Hide comments section */
.cart-comments {
    display: none;
}

/* Desktop styling */
@media (min-width: 768px) {
    .cb-saved-cart {
        max-width: 90%;
        margin: 0 auto;
    }
}

.approve-button {
    display: inline-block;
    padding: 10px 20px;
    background-color: #3498db;
    color: #fff;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s ease;
}

.approve-button:hover {
    background-color: #2980b9;
}

.approve-button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.approve-info {
    font-size: 14px;
    color: #666;
    margin-top: 10px;
}

/* Quantity input styles */
.quantity-input {
    width: 60px;
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 3px;
    text-align: center;
    font-size: 14px;
}

.quantity-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
}

/* Save quantities button */
.cart-save-changes {
    margin-top: 20px;
    padding: 15px;
    background-color: #f8f8f8;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.save-quantities-btn {
    display: inline-block;
    padding: 10px 20px;
    background-color: #000!important;
    color: #fff!important;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease;
    text-decoration: none;
}

.save-quantities-btn:hover {
    background-color: #444!important;
    color: #fff;
    text-decoration: none;
}

.save-quantities-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.save-message {
    margin-top: 10px;
    padding: 10px;
    border-radius: 3px;
}

.save-message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.save-message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Add to Cart button styles */
.add-to-cart-btn {
    display: inline-block;
    padding: 8px 16px;
    background-color: #000!important;
    color: #fff!important;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.3s ease;
    text-decoration: none;
}

.add-to-cart-btn:hover {
    background-color: #444!important;
    color: #fff;
    text-decoration: none;
}

.add-to-cart-btn:disabled {
    background-color: #cccccc!important;
    cursor: not-allowed;
}

/* Product actions column */
.product-actions {
    text-align: center;
    vertical-align: middle;
}

/* Cart header layout */
.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.cart-name {
    margin: 0;
}

/* Cart items header layout */
.cart-items-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.cart-items-header h2 {
    margin: 0;
}

/* Add all to cart button */
.add-all-to-cart-btn {
    display: inline-block;
    padding: 8px 16px;
    background-color: #0073aa;
    color: #fff;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease;
    text-decoration: none;
}

.add-all-to-cart-btn:hover {
    background-color: #005a87;
    color: #fff;
    text-decoration: none;
}

.add-all-to-cart-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

/* Delete cart button */
.delete-cart-btn {
    display: inline-block;
    padding: 8px 16px;
    background-color: #8b0000!important;
    color: #fff!important;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease;
    text-decoration: none;
}

.delete-cart-btn:hover {
    background-color: #000!important;
    color: #fff;
    text-decoration: none;
}

.delete-cart-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

/* Delete item button */
.delete-item-btn {
    display: inline-block;
    width: 24px;
    height: 24px;
    background-color: #8b0000!important;
    color: #fff!important;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    line-height: 1;
    margin-left: 8px;
    transition: background-color 0.3s ease;
    padding:2px 7px 4px!important;
}

.delete-item-btn:hover {
    background-color: #000!important;
}

.delete-item-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

/* Product actions column */
.product-actions {
    text-align: center;
    vertical-align: middle;
    white-space: nowrap;
}

/* Responsive table adjustments */
@media (max-width: 768px) {
    .cart-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .cart-items-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .cart-items-table th:nth-child(5),
    .cart-items-table td:nth-child(5) {
        display: none;
    }
    
    .cart-items-table th:nth-child(4) {
        border-right: none;
    }
}

/* Clear cart button */
.clear-cart-container {
    margin: 20px 0;
    text-align: center;
}

#clear-cart-btn {
    background-color: #8b0000;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease;
}

#clear-cart-btn:hover {
    background-color: #000;
}

#clear-cart-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
} 