/* ACOD design tokens */
:root {
    --acod-primary: #ff6b35;
    --acod-primary-hover: #e55a2b;
    --acod-accent: #ffc107;
    --acod-accent-hover: #e0a800;
    --acod-success: #28a745;
    --acod-danger: #ff4444;
    --acod-border: #ddd;
    --acod-muted: #666;
    --acod-text: #333;
    --acod-bg: #ffffff;
    --acod-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    --acod-radius: 5px;
    --acod-radius-lg: 10px;
    --acod-space-1: 5px;
    --acod-space-2: 8px;
    --acod-space-3: 10px;
    --acod-space-4: 12px;
    --acod-space-5: 15px;
    --acod-space-6: 20px;
    --acod-transition: 0.2s ease;
}

@media (prefers-reduced-motion: reduce) {
    :root { --acod-transition: 0s; }
}
/* Cash on Delivery Button */
.acod-button {
    background: var(--acod-primary);
    color: #fff;
    border: none;
    padding: var(--acod-space-4) var(--acod-space-6);
    border-radius: var(--acod-radius);
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: var(--acod-space-2);
    margin-top: var(--acod-space-3);
    width: 100%;
    justify-content: center;
    transition: background-color var(--acod-transition), box-shadow var(--acod-transition);
}

.acod-button:hover {
    background: var(--acod-primary-hover);
}

.acod-cart-icon {
    font-size: 18px;
}

/* Popup Styles */
.acod-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.acod-popup-content {
    background: var(--acod-bg);
    border-radius: var(--acod-radius-lg);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--acod-shadow);
}

/* Popup Header */
.acod-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.acod-popup-header h3 {
    margin: 0;
    font-size: 16px !important;
}

.acod-close {
	font-size: 40px;
	cursor: pointer;
	color: var(--acod-primary);
	transition: .3s;
}

.acod-close:hover {
    color: var(--acod-danger);
}

/* Form Styles */
#acod-order-form {
    padding: 20px;
}

/* Form fields without labels */
.acod-field:not(:has(label)) input {
    margin-top: 0;
}

/* Customer Info Section */
.acod-customer-info {
    margin-bottom: 25px;
}

.acod-field {
    position: relative;
    margin-bottom: 8px;
}

.acod-field label {
	display: block;
	margin-bottom: 8px;
	font-weight: 600;
	font-size: 14px !important;
}

.acod-field input, .acod-order-note input {
    width: 100%;
    padding: var(--acod-space-2) var(--acod-space-4) !important;
    border: 1px solid var(--acod-border);
    border-radius: var(--acod-radius);
    font-size: 14px;
    box-sizing: border-box;
}

.acod-field input:focus, .acod-order-note input:focus, .acod-coupon-section input:focus {
    outline: none !important;
    border-color: var(--acod-primary) !important;
}

.acod-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    color: #999;
    pointer-events: none;
}

/* Shipping Method Section */
.acod-shipping-method {
    margin-bottom: 25px;
}

.acod-shipping-method h4 {
	font-size: 16px !important;
}

.acod-radio-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.acod-radio-label {
	display: flex;
	align-items: center;
	cursor: pointer;
	padding: 8px;
	border: 1px solid #ddd;
	border-radius: 5px;
	transition: border-color 0.3s ease;
	font-size: 14px;
	font-weight: 500;
}

.acod-radio-label:hover {
    border-color: var(--acod-primary);
}

.acod-radio-label input[type="radio"] {
    display: none;
}

.acod-radio-custom {
    width: 15px;
    height: 15px;
    border: 2px solid #ddd;
    border-radius: 50%;
    margin-right: 10px;
    position: relative;
    transition: border-color 0.3s ease;
}

.acod-radio-label input[type="radio"]:checked + .acod-radio-custom {
    border-color: var(--acod-primary);
}

.acod-radio-label input[type="radio"]:checked + .acod-radio-custom::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 49%;
	transform: translate(-50%, -50%);
	width: 5px;
	height: 5px;
	background: var(--acod-primary);
	border-radius: 50%;
}

/* Coupon Section */
.acod-coupon-section {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
}

.acod-coupon-section input {
    flex: 1;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.acod-apply-coupon {
	background: var(--acod-primary);
	padding: var(--acod-space-3) var(--acod-space-5) !important;
}

.acod-apply-coupon:hover {
    background: var(--acod-primary-hover);
}

.acod-apply-coupon:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.acod-coupon-applied {
    background: #28a745 !important;
    color: white !important;
}

/* Messages */
.acod-message {
    padding: 10px 15px;
    border-radius: 5px;
    margin: 10px 0;
    font-size: 14px;
    font-weight: 500;
}

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

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

/* Order Items */
.acod-order-items {
    margin-bottom: 20px;
}

.acod-cart-item {
    display: flex;
    align-items: flex-start;
    padding: 15px;
    border: 1px solid #eee;
    border-radius: 5px;
    margin-bottom: 10px;
    position: relative;
    gap: 15px;
}

.acod-item-image {
	width: 60px;
	height: 60px;
	flex-shrink: 0;
	border: 1px solid #ddd;
	border-radius: 5px;
}

.acod-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 5px;
}

.acod-item-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.acod-item-details h5 {
	margin: 0 3rem 0 0;
	font-size: 16px !important;
	display: -webkit-box;
	overflow: hidden;
	-webkit-line-clamp: 1;
	-webkit-box-orient: vertical;
	padding: 0;
}

.acod-variation {
    font-size: 12px;
    color: #333;
    margin: 2px 0;
}

/* Selected Variations Display */
.acod-selected-variations {
    margin: 5px 0;
}

.acod-variation-item {
    display: flex;
    align-items: center;
    margin-bottom: 3px;
    font-size: 12px;
}

.acod-variation-item:last-child {
    margin-bottom: 0;
}

.acod-variation-label {
	font-weight: 600;
	margin-right: 8px;
}

.acod-variation-value {
	color: var(--acod-primary);
	font-weight: 500;
	background: none;
	padding: 0;
	border-radius: 0;
	font-size: 12px;
}

.acod-item-price {
	font-size: 14px;
	font-weight: 500;
}

.acod-quantity-option {
	position: absolute;
	right: 1rem;
	bottom: 1rem;
}

.acod-quantity-controls {
	display: flex;
	align-items: center;
	gap: 5px;
	border: 1px solid #ddd;
	width: 90px;
}

.acod-qty-btn {
	background: transparent !important;
	color: var(--acod-primary) !important;
	padding: 1px 8px !important;
	border-radius: 0 !important;
	font-size: 2rem !important;
	border: none !important;
}

.acod-qty-btn:hover {
    background: var(--acod-primary) !important;
    color: #fff !important;
}

.acod-quantity-input {
	text-align: center;
	font-size: 14px;
	appearance: textfield;
	font-weight: 500;
	border: none !important;
    padding: 0 !important;
    &:focus{
        outline: none !important;
    }
}

.acod-remove-item {
	position: absolute;
	top: 0px;
	right: 14px;
	background: transparent !important;
	font-size: 30px !important;
	color: var(--acod-primary) !important;
	padding: 0 !important;
}

.acod-remove-item:hover {
    color: var(--acod-danger) !important;
}

/* Order Summary */
.acod-order-summary {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 5px;
    margin-top: 15px;
}

.acod-summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 14px;
}

.acod-summary-row:last-child {
    margin-bottom: 0;
}

.acod-total {
    font-weight: bold;
    font-size: 16px;
    color: #333;
    border-top: 1px solid #ddd;
    padding-top: 10px;
    margin-top: 10px;
}

/* Order Note */
.acod-order-note {
    margin-bottom: 25px;
}

.acod-order-note label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.acod-order-note input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    box-sizing: border-box;
}


/* Upsell Section */
.acod-upsell-section {
    margin-bottom: 25px;
}

.acod-upsell-section h4 {
    margin: 0 0 15px 0;
    font-size: 16px;
    color: #333;
    font-weight: 600;
}

.acod-upsell-item {
    background: #e3f2fd;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.acod-upsell-label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    flex: 1;
}

.acod-upsell-label input[type="checkbox"] {
    display: none;
}

.acod-checkbox-custom {
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-radius: 3px;
    margin-right: 10px;
    position: relative;
    flex-shrink: 0;
    margin-top: 2px;
}

.acod-upsell-label input[type="checkbox"]:checked + .acod-checkbox-custom {
    background: #ff6b35;
    border-color: #ff6b35;
}

.acod-upsell-label input[type="checkbox"]:checked + .acod-checkbox-custom::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.acod-upsell-image {
    width: 40px;
    height: 40px;
}

.acod-upsell-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 5px;
}

/* Action Buttons */
.acod-actions {
    text-align: center;
}

.acod-confirm-order {
    background: var(--acod-primary);
    color: #fff;
    border: none;
    padding: var(--acod-space-5) 30px;
    border-radius: var(--acod-radius);
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    margin-bottom: 10px;
    transition: background-color var(--acod-transition);
}

.acod-confirm-order:hover {
    background: var(--acod-primary-hover);
}

.acod-confirm-order:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.acod-pay-online {
    background: var(--acod-accent);
    color: #333;
    border: none;
    padding: var(--acod-space-4) 30px;
    border-radius: var(--acod-radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--acod-space-2);
    transition: background-color var(--acod-transition);
	white-space: wrap !important;
}

.acod-pay-online:hover {
    background: var(--acod-accent-hover);
}

.acod-wallet-icon {
    font-size: 16px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .acod-popup {
        padding: 10px;
    }
    
    .acod-popup-content {
        max-height: 95vh;
    }
    
    .acod-popup-header {
        padding: 15px;
    }
    
    #acod-order-form {
        padding: 15px;
    }
    
    .acod-coupon-section {
        flex-direction: column;
    }
    
    .acod-upsell {
        flex-direction: column;
        text-align: center;
    }
    
    .acod-upsell-label {
        justify-content: center;
    }
}

/* Loading States */
.acod-loading {
    text-align: center;
    padding: 20px;
    color: #666;
    font-style: italic;
}

.acod-error {
    text-align: center;
    padding: 20px;
    color: #ff4444;
    background: #ffe6e6;
    border-radius: 5px;
    margin: 10px 0;
}

.acod-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s ease-in-out infinite;
    margin-right: 8px;
}

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

/* Success States */
.acod-success {
    background: #28a745 !important;
    color: white !important;
}

.acod-success-message {
    text-align: center;
    padding: 15px;
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 5px;
    color: #155724;
}

.acod-success-message h4 {
    margin: 0 0 10px 0;
    color: #155724;
}

.acod-success-message p {
    margin: 5px 0;
    font-size: 14px;
}

/* Checkout Integration */
.acod-checkout-integration .woocommerce-checkout {
    position: relative;
}

.acod-checkout-message {
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Animation */
.acod-popup {
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.acod-popup-content {
    animation: slideIn 0.2s ease;
}

@keyframes slideIn {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Order Confirmation Styles */
.acod-order-confirmation {
    padding: 20px;
}

.acod-order-summary-display {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    border: 1px solid #e0e0e0;
}

.acod-order-summary-display h4 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 18px;
    font-weight: 600;
    border-bottom: 2px solid #ff6b35;
    padding-bottom: 8px;
}

.acod-summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}

.acod-summary-item:last-child {
    border-bottom: none;
}

.acod-summary-item.acod-discount {
    color: #28a745;
    font-weight: 500;
}

.acod-summary-item.acod-total {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    border-top: 2px solid #ff6b35;
    margin-top: 10px;
    padding-top: 15px;
}

.acod-summary-item.acod-variation-details {
    background: #f8f9fa;
    border-radius: 4px;
    padding: 10px 12px;
    margin: 5px 0;
    border-left: 3px solid #ff6b35;
}

.acod-summary-item.acod-variation-details span:first-child {
    font-weight: 600;
    color: #495057;
}

.acod-summary-item.acod-variation-details span:last-child {
    color: #6c757d;
    font-size: 13px;
}

.acod-order-note-display {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 6px;
    padding: 15px;
    margin-top: 15px;
    border-left: 4px solid #f39c12;
}

.acod-order-note-display h5 {
    margin: 0 0 8px 0;
    color: #856404;
    font-size: 14px;
    font-weight: 600;
}

.acod-order-note-display p {
    margin: 0;
    color: #856404;
    font-size: 14px;
    font-style: italic;
    line-height: 1.4;
}

.acod-confirmation-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 25px;
}

.acod-close-popup {
    background: #6c757d;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.acod-close-popup:hover {
    background: #5a6268;
}

.acod-new-order {
    background: #ff6b35;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.acod-new-order:hover {
    background: #e55a2b;
}

/* Enhanced Success Message */
.acod-order-confirmation .acod-success-message {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 20px;
}

.acod-order-confirmation .acod-success-message h4 {
    margin: 0 0 10px 0;
    font-size: 20px;
    border: none;
    padding: 0;
}

.acod-order-confirmation .acod-success-message p {
    margin: 5px 0;
    font-size: 14px;
    opacity: 0.9;
}

/* Responsive Design for Confirmation */
@media (max-width: 768px) {
    .acod-confirmation-actions {
        flex-direction: column;
    }
    
    .acod-close-popup,
    .acod-new-order {
        width: 100%;
    }
    
    .acod-order-summary-display {
        padding: 15px;
    }
    
    .acod-summary-item {
        font-size: 13px;
    }
}
