/* Simple Order Pro - Frontend Styles */

/* Removed debugging red background */

/* Reset and Base Styles */
.sop-products-grid,
.sop-cart-container,
.sop-checkout-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
}

/* Product Grid */
.sop-products-grid {
    display: grid;
    gap: 20px;
    margin: 20px 0;
}

/* Product Items - Equal Height */
.sop-product-item {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.sop-product-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #fff;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.sop-product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.sop-product-content {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.sop-product-title {
    margin: 0 0 10px 0;
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    line-height: 1.3;
}

.sop-product-description {
    margin: 0 0 15px 0;
    color: #6c757d;
    font-size: 14px;
    line-height: 1.5;
    flex-grow: 1;
}

.sop-product-price {
    margin: 0 0 15px 0;
    font-size: 20px;
    font-weight: 700;
    color: #27ae60;
}

.sop-product-actions {
    margin-top: auto;
    padding-top: 15px;
}

/* Product Images - Consistent Dimensions */
.sop-product-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sop-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.sop-product-card:hover .sop-product-image img {
    transform: scale(1.05);
}

/* Product Variations - Consistent Styling */
.sop-product-variations {
    margin: 10px 0;
}

.sop-variation-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.sop-variation-select:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* Simple Product Controls - Consistent Styling */
.sop-simple-product-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.sop-quantity-input {
    width: 80px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.sop-quantity-input:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* Cart Item Styles */
.sop-cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border: 1px solid #e1e5e9;
    border-radius: 6px;
    margin-bottom: 10px;
    background: #fff;
    transition: box-shadow 0.3s ease;
}

.sop-cart-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.sop-cart-item-info {
    flex: 1;
    margin-right: 15px;
}

.sop-cart-item-info strong {
    display: block;
    font-size: 16px;
    color: #2c3e50;
    margin-bottom: 5px;
}

.sop-cart-item-info .sop-variation {
    color: #6c757d;
    font-size: 13px;
    font-style: italic;
}

.sop-cart-item-info .sop-unit-price {
    color: #27ae60;
    font-size: 12px;
    font-weight: 600;
}

.sop-cart-item-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
}

.sop-quantity-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sop-quantity-controls label {
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
}

.sop-cart-quantity {
    width: 60px;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.sop-cart-quantity:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.sop-cart-item-total {
    font-size: 16px;
    font-weight: 700;
    color: #27ae60;
    min-width: 80px;
    text-align: right;
}

.sop-btn-danger {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.sop-btn-danger:hover {
    background: #c0392b;
}

.sop-btn-secondary {
    background: #6c757d;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.sop-btn-secondary:hover {
    background: #5a6268;
}

/* Variable Product Quantity Controls */
.sop-variable-quantity-controls {
    display: flex; /* Always visible for testing */
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    position: relative;
    width: 100%;
    box-sizing: border-box;
    background: #fff;
    border: 1px solid #e1e5e9;
    border-radius: 4px;
    padding: 10px;
}

/* Variable Product Add to Cart Button */
.sop-add-to-cart-variable {
    display: inline-block !important;
    background: #e74c3c !important; /* Red for testing */
    color: white !important;
    border: 3px solid #2c3e50 !important; /* Dark border for testing */
    padding: 12px 24px !important;
    border-radius: 6px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: background-color 0.3s ease !important;
    margin-top: 10px !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.sop-add-to-cart-variable:disabled {
    background: #95a5a6 !important;
    cursor: not-allowed !important;
}

.sop-add-to-cart-variable:hover {
    background: #2980b9 !important;
}

.sop-variable-quantity-controls.show {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.sop-variable-quantity-controls label {
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
}

.sop-variable-quantity-input {
    width: 80px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.sop-variable-quantity-input:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* Price Range Display */
.sop-price-range {
    margin-bottom: 15px;
}

/* Bulk Pricing Display */
.sop-product-bulk-pricing,
.sop-variation-bulk-pricing {
    border: 1px solid #e1e5e9;
    border-radius: 4px;
    background: #f8f9fa;
    margin-top: 10px;
    padding: 10px;
    min-height: 60px;
    max-height: 120px;
    overflow-y: auto;
    display: block !important;
    visibility: visible !important;
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

.sop-variation-bulk-pricing h5 {
    margin: 0 0 8px 0;
    font-size: 13px;
    color: #666;
    font-weight: 600;
}

.sop-bulk-rule {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 12px;
    padding: 4px 0;
    border-bottom: 1px solid #e9ecef;
}

.sop-bulk-rule:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.sop-price-range .sop-price {
    font-size: 18px;
    font-weight: 700;
    color: #27ae60;
}

/* Hidden class for variable product buttons */
.sop-hidden {
    display: none !important;
}

/* Ensure add to cart variable button is visible when not hidden */
.sop-add-to-cart-variable:not(.sop-hidden) {
    display: inline-block !important;
}

/* Variable product add to cart button styling */
.sop-add-to-cart-variable {
    display: inline-block !important; /* Always visible */
}

/* Debug: Make sure elements are visible when they should be */
.sop-variation-bulk-pricing {
    display: none; /* Hidden by default */
}

.sop-variation-bulk-pricing:not(:empty) {
    display: block !important; /* Show when has content */
}

/* Temporary debugging - make elements more visible */
.sop-variable-quantity-controls.show {
    background: #e8f5e8 !important;
    border: 2px solid #28a745 !important;
    padding: 10px !important;
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.sop-add-to-cart-variable:not(.sop-hidden) {
    background: #007bff !important;
    color: white !important;
    border: 2px solid #0056b3 !important;
    padding: 10px 20px !important;
    font-weight: bold !important;
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.sop-variation-bulk-pricing:not(:empty) {
    background: #fff3cd !important;
    border: 2px solid #ffc107 !important;
    padding: 15px !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Force visibility for debugging */
.sop-variable-quantity-controls.show,
.sop-add-to-cart-variable:not(.sop-hidden),
.sop-variation-bulk-pricing:not(:empty) {
    position: relative !important;
    z-index: 9999 !important;
}

/* Removed NUCLEAR OPTION debugging CSS */

/* Removed debugging CSS rule */

/* Removed debugging CSS rule */

/* Responsive Cart Items */
@media (max-width: 768px) {
    .sop-cart-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .sop-cart-item-controls {
        width: 100%;
        justify-content: space-between;
    }
    
    .sop-quantity-controls {
        flex: 1;
    }
    
    .sop-cart-item-total {
        text-align: left;
        min-width: auto;
    }
}

.sop-grid-1 { grid-template-columns: 1fr; }
.sop-grid-2 { grid-template-columns: repeat(2, 1fr); }
.sop-grid-3 { grid-template-columns: repeat(3, 1fr); }
.sop-grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 768px) {
    .sop-grid-2,
    .sop-grid-3,
    .sop-grid-4 {
        grid-template-columns: 1fr;
    }
    
    .sop-product-image {
        height: 150px;
    }
    
    .sop-product-content {
        padding: 15px;
    }
    
    .sop-product-title {
        font-size: 16px;
    }
    
    .sop-product-price {
        font-size: 18px;
    }
    
    .sop-simple-product-controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .sop-quantity-input {
        width: 100px;
    }
}



/* Buttons */
.sop-btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    line-height: 1;
}

.sop-btn-primary {
    background: #3498db;
    color: white;
}

.sop-btn-primary:hover {
    background: #2980b9;
    transform: translateY(-1px);
}

.sop-btn-secondary {
    background: #95a5a6;
    color: white;
}

.sop-btn-secondary:hover {
    background: #7f8c8d;
}

.sop-btn-success {
    background: #27ae60;
    color: white;
}

.sop-btn-success:hover {
    background: #229954;
}

.sop-btn-danger {
    background: #e74c3c;
    color: white;
}

.sop-btn-danger:hover {
    background: #c0392b;
}

/* Product Variations */
.sop-product-variations {
    margin-top: 10px;
}

.sop-variation-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

/* Cart Summary */
.sop-cart-summary {
    background: #f8f9fa;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 20px;
    margin-top: 30px;
}

.sop-cart-summary h3 {
    margin: 0 0 15px 0;
    color: #2c3e50;
}

.sop-cart-items {
    margin-bottom: 15px;
}

.sop-cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #e1e5e9;
}

.sop-cart-item:last-child {
    border-bottom: none;
}

.sop-cart-total {
    font-size: 1.2rem;
    font-weight: 700;
    color: #2c3e50;
    padding-top: 15px;
    border-top: 2px solid #3498db;
}

.sop-cart-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Coupon Section */
.sop-coupon-section {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 6px;
    padding: 15px;
    margin-top: 20px;
}

.sop-coupon-section h4 {
    margin: 0 0 10px 0;
    color: #856404;
}

.sop-coupon-form {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.sop-coupon-code {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.sop-coupon-message {
    font-size: 14px;
    font-weight: 600;
}

.sop-coupon-message.success {
    color: #27ae60;
}

.sop-coupon-message.error {
    color: #e74c3c;
}

/* Checkout Form */
.sop-checkout-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.sop-checkout-title {
    color: #2c3e50;
    margin-bottom: 30px;
    text-align: center;
}

.sop-checkout-form {
    background: #fff;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.sop-checkout-fields {
    margin-bottom: 30px;
}

.sop-field-group {
    margin-bottom: 20px;
}

.sop-field-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #2c3e50;
}

.sop-required {
    color: #e74c3c;
}

.sop-field-group input,
.sop-field-group textarea,
.sop-field-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.sop-field-group input:focus,
.sop-field-group textarea:focus,
.sop-field-group select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.sop-checkout-summary {
    background: #f8f9fa;
    border: 1px solid #e1e5e9;
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 30px;
}

.sop-checkout-summary h3 {
    margin: 0 0 15px 0;
    color: #2c3e50;
}

.sop-order-items {
    margin-bottom: 15px;
}

.sop-order-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #e1e5e9;
}

.sop-order-item:last-child {
    border-bottom: none;
}

.sop-order-totals {
    border-top: 2px solid #e1e5e9;
    padding-top: 15px;
}

.sop-order-totals > div {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.sop-order-totals .sop-total {
    font-weight: 700;
    font-size: 1.1rem;
    color: #2c3e50;
    border-top: 1px solid #e1e5e9;
    padding-top: 10px;
    margin-top: 10px;
}

.sop-payment-info {
    background: #e7f3ff;
    border: 1px solid #b3d9ff;
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 30px;
}

.sop-payment-info h3 {
    margin: 0 0 10px 0;
    color: #1e3a8a;
}

.sop-payment-instructions {
    color: #1e3a8a;
    line-height: 1.6;
}

.sop-checkout-actions {
    text-align: center;
}

.sop-checkout-messages {
    margin-top: 20px;
}

.sop-message {
    padding: 12px 20px;
    border-radius: 6px;
    margin-bottom: 10px;
    font-weight: 600;
}

.sop-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.sop-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Cart Container */
.sop-cart-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.sop-cart-title {
    color: #2c3e50;
    margin-bottom: 30px;
    text-align: center;
}

.sop-cart-content {
    background: #fff;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.sop-empty-cart {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    margin: 20px 0;
}

.sop-cart-totals {
    border-top: 2px solid #e1e5e9;
    padding-top: 20px;
    margin-top: 20px;
}

.sop-cart-totals > div {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.sop-cart-totals .sop-total {
    font-weight: 700;
    font-size: 1.2rem;
    color: #2c3e50;
    border-top: 1px solid #e1e5e9;
    padding-top: 10px;
    margin-top: 10px;
}

.sop-cart-actions {
    margin-top: 20px;
    text-align: center;
}

/* Responsive Design */
@media (max-width: 768px) {
    .sop-checkout-container,
    .sop-cart-container {
        padding: 10px;
    }
    
    .sop-checkout-form,
    .sop-cart-content {
        padding: 20px;
    }
    
    .sop-cart-actions {
        flex-direction: column;
    }
    
    .sop-coupon-form {
        flex-direction: column;
    }
}

/* Loading States */
.sop-loading {
    opacity: 0.6;
    pointer-events: none;
}

.sop-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: sop-spin 1s linear infinite;
}

@keyframes sop-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Status Indicators */
.sop-status {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.sop-status-active {
    background: #d4edda;
    color: #155724;
}

.sop-status-inactive {
    background: #f8d7da;
    color: #721c24;
}

.sop-status-pending {
    background: #fff3cd;
    color: #856404;
}

.sop-status-paid {
    background: #d4edda;
    color: #155724;
}

.sop-status-cancelled {
    background: #f8d7da;
    color: #721c24;
}

/* Variable Product Styles */
.sop-product-variations {
    margin: 15px 0;
}

.sop-variation-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.sop-variation-select:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* Removed conflicting CSS rules */

/* Variation Bulk Pricing Styles */
.sop-variation-bulk-pricing {
    border: 1px solid #e1e5e9;
    border-radius: 4px;
    background: #f8f9fa;
    margin-top: 10px;
    padding: 10px;
    min-height: 80px;
    max-height: 120px;
    overflow-y: auto;
}

.sop-variation-bulk-pricing h5 {
    margin: 0 0 8px 0;
    font-size: 13px;
    color: #666;
    font-weight: 600;
}

.sop-bulk-rule {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 12px;
    padding: 2px 0;
}

.sop-bulk-rule:last-child {
    margin-bottom: 0;
}

.sop-bulk-rule span:first-child {
    color: #666;
}

.sop-bulk-rule span:last-child {
    color: #27ae60;
    font-weight: 600;
}

/* Simple Product Bulk Pricing Styles */
.sop-product-bulk-pricing {
    border: 1px solid #e1e5e9;
    border-radius: 4px;
    background: #f8f9fa;
    margin-top: 10px;
    padding: 10px;
    min-height: 80px;
    max-height: 120px;
    overflow-y: auto;
}

.sop-product-bulk-pricing h5 {
    margin: 0 0 8px 0;
    font-size: 13px;
    color: #666;
    font-weight: 600;
}

/* Variation Bulk Pricing Styles */
.sop-variation-bulk-pricing {
    border: 1px solid #e1e5e9;
    border-radius: 4px;
    background: #f8f9fa;
    margin-top: 10px;
    padding: 10px;
    min-height: 80px;
    max-height: 120px;
    overflow-y: auto;
}

.sop-variation-bulk-pricing h5 {
    margin: 0 0 8px 0;
    font-size: 13px;
    color: #666;
    font-weight: 600;
}

/* Simple Product Controls */
.sop-simple-product-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

.sop-quantity-input {
    width: 80px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.sop-quantity-input:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}
