/* CDV Store Frontend Styles */

/* Products Grid */
.cdv-products-grid {
    display: grid;
    gap: 30px;
    margin: 30px 0;
}

.cdv-columns-2 { grid-template-columns: repeat(2, 1fr); }
.cdv-columns-3 { grid-template-columns: repeat(3, 1fr); }
.cdv-columns-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 992px) {
    .cdv-columns-4 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
    .cdv-columns-3,
    .cdv-columns-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
    .cdv-products-grid { grid-template-columns: 1fr; }
}

/* Product Card */
.cdv-product-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
}

.cdv-product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.cdv-product-image {
    position: relative;
    overflow: hidden;
    padding-top: 100%;
    background: #f5f5f5;
}

.cdv-product-image a {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.cdv-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.cdv-product-card:hover .cdv-product-image img {
    transform: scale(1.1);
}

.cdv-sale-badge,
.cdv-out-of-stock-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #ff4444;
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    z-index: 1;
}

.cdv-out-of-stock-badge {
    background: #999;
}

.cdv-product-info {
    padding: 20px;
}

.cdv-product-title {
    margin: 0 0 10px 0;
    font-size: 18px;
    line-height: 1.4;
}

.cdv-product-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s;
}

.cdv-product-title a:hover {
    color: #2271b1;
}

.cdv-product-price {
    margin: 10px 0;
    font-size: 20px;
    font-weight: 700;
    color: #2271b1;
}

.cdv-product-price del {
    color: #999;
    font-size: 16px;
    margin-right: 8px;
}

.cdv-product-price ins {
    text-decoration: none;
    color: #ff4444;
}

.cdv-product-excerpt {
    margin: 10px 0;
    font-size: 14px;
    color: #666;
    line-height: 1.6;
}

.cdv-add-to-cart-btn {
    width: 100%;
    padding: 12px 24px;
    background: #2271b1;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.cdv-add-to-cart-btn:hover:not(:disabled) {
    background: #135e96;
}

.cdv-add-to-cart-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Categories Grid */
.cdv-categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.cdv-category-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
}

.cdv-category-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.cdv-category-card a {
    text-decoration: none;
    color: inherit;
}

.cdv-category-card h3 {
    margin: 0 0 10px 0;
    color: #333;
}

.cdv-category-card p {
    margin: 10px 0;
    color: #666;
    font-size: 14px;
}

.cdv-product-count {
    display: inline-block;
    margin-top: 10px;
    padding: 5px 15px;
    background: #f0f0f0;
    border-radius: 20px;
    font-size: 12px;
    color: #666;
}

/* Cart Icon */
.cdv-cart-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    color: inherit;
    text-decoration: none;
}

.cdv-cart-count {
    position: absolute;
    top: 0;
    right: 0;
    background: #ff4444;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
}

/* Cart Page */
.cdv-cart-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px;
}

.cdv-cart-page h2 {
    margin-bottom: 30px;
}

.cdv-empty-cart {
    text-align: center;
    padding: 60px 20px;
    font-size: 18px;
    color: #666;
}

.cdv-cart-items {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.cdv-cart-item {
    display: grid;
    grid-template-columns: 80px 1fr auto;
    gap: 20px;
    padding: 20px 0;
    border-bottom: 1px solid #e0e0e0;
    align-items: center;
}

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

.cdv-cart-item-image {
    width: 80px;
    height: 80px;
}

.cdv-cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}

.cdv-cart-item-details h4 {
    margin: 0 0 8px 0;
}

.cdv-cart-item-price {
    color: #666;
    margin: 5px 0;
}

.cdv-cart-item-quantity {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px 0;
}

.cdv-qty-minus,
.cdv-qty-plus {
    width: 30px;
    height: 30px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cdv-qty-input {
    width: 60px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 6px;
}

.cdv-cart-item-total {
    font-weight: 700;
    font-size: 18px;
    color: #2271b1;
}

.cdv-remove-item {
    background: none;
    border: none;
    color: #ff4444;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
}

.cdv-cart-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.cdv-coupon-form,
.cdv-cart-totals {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
}

.cdv-coupon-form h3,
.cdv-cart-totals h3 {
    margin-top: 0;
}

.cdv-coupon-input {
    display: flex;
    gap: 10px;
}

.cdv-coupon-input input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
}

.cdv-button {
    padding: 10px 24px;
    background: #2271b1;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: background 0.3s;
}

.cdv-button:hover {
    background: #135e96;
}

.cdv-cart-totals-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #e0e0e0;
}

.cdv-cart-totals-row:last-child {
    border-bottom: none;
}

.cdv-total-row {
    font-size: 18px;
    padding-top: 15px;
    margin-top: 10px;
    border-top: 2px solid #333;
}

.cdv-checkout-btn {
    width: 100%;
    margin-top: 20px;
    padding: 15px;
    font-size: 18px;
}

/* Checkout Page */
.cdv-checkout-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px;
}

.cdv-checkout-container {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 30px;
}

.cdv-checkout-form,
.cdv-checkout-summary {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 30px;
}

.cdv-checkout-form h3,
.cdv-checkout-summary h3 {
    margin-top: 0;
}

.cdv-form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.cdv-form-row.cdv-two-columns {
    grid-template-columns: 1fr 1fr;
}

.cdv-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.cdv-form-group input,
.cdv-form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.cdv-order-items {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.cdv-order-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #e0e0e0;
}

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

.cdv-order-totals {
    margin-top: 20px;
}

.cdv-order-total-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #e0e0e0;
}

.cdv-order-total-row.cdv-total {
    font-size: 18px;
    padding-top: 15px;
    margin-top: 10px;
    border-top: 2px solid #333;
    border-bottom: none;
}

.cdv-payment-section {
    margin-top: 30px;
}

#cdv-paypal-button-container {
    margin-top: 20px;
}

/* Responsive */
@media (max-width: 768px) {
    .cdv-cart-summary,
    .cdv-checkout-container {
        grid-template-columns: 1fr;
    }
    
    .cdv-cart-item {
        grid-template-columns: 60px 1fr;
    }
    
    .cdv-remove-item {
        grid-column: 2;
        justify-self: end;
    }
}

/* Messages */
.cdv-message {
    padding: 15px;
    border-radius: 6px;
    margin: 15px 0;
}

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

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

/* Loading */
.cdv-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

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