/* Algeria COD frontend styles (replace existing frontend.css) */

.algeria-cod-form {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin: 20px 0;
    direction: rtl;
    max-width: 520px;
    box-sizing: border-box;
}

.algeria-cod-form .form-row {
    margin-bottom: 20px;
}

.algeria-cod-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: black;
    text-align: right;
}

.algeria-cod-form input[type="text"],
.algeria-cod-form input[type="tel"],
.algeria-cod-form select {
    width: 100%;
    padding: 12px;
    border: 2px solid #28a745;
    border-radius: 5px;
    background: white;
    color: black;
    font-size: 14px;
    text-align: right;
    box-sizing: border-box;
}

.algeria-cod-form input:focus,
.algeria-cod-form select:focus {
    outline: none;
    border-color: #218838;
    box-shadow: 0 0 5px rgba(40, 167, 69, 0.3);
}

.delivery-options {
    border: 2px solid #28a745;
    border-radius: 5px;
    padding: 15px;
    background: white;
}

.delivery-option {
    margin-bottom: 10px;
}

.delivery-option:last-child {
    margin-bottom: 0;
}

/* Keep the native input for accessibility but visually hide it */
.algeria-cod-form .delivery-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    overflow: hidden;
    pointer-events: none;
}

/* Delivery label box */
.delivery-label {
    display: flex;
    align-items: center;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: black;
    text-align: right;
    gap: 10px;
    justify-content: space-between;
    width: 100%;
    box-sizing: border-box;
}

.delivery-label:hover {
    border-color: #28a745;
}

/* Emoji container (hidden by default) */
.delivery-label .check-emoji {
    display: none;
    font-size: 18px;
    line-height: 1;
}

/* Show emoji when radio is checked.
   Uses input#id + label[for=id] markup in the plugin output, so this selector works. */
.algeria-cod-form input[type="radio"]:checked + label .check-emoji,
.algeria-cod-form input[type="radio"]:focus + label .check-emoji {
    display: inline-block;
}

/* Slight visual tweak when selected */
.algeria-cod-form input[type="radio"]:checked + label {
    box-shadow: 0 0 0 2px rgba(120,185,130,0.12);
    background-color: #f8fff9;
    border-color: #28a745;
}

/* fallback checkmark circle for older markup (kept for compatibility) */
.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-radius: 50%;
    margin-left: 10px;
    position: relative;
    transition: all 0.3s ease;
}
.algeria-cod-form input[type="radio"]:checked + .delivery-label .checkmark,
.algeria-cod-form input[type="radio"]:checked + label .checkmark {
    border-color: #28a745;
    background-color: #28a745;
}

/* enlarge native radios and checkboxes (for browsers that render them) */
.algeria-cod-form input[type="radio"],
.algeria-cod-form input[type="checkbox"] {
    width: 18px;
    height: 18px;
    vertical-align: middle;
    margin-right: 8px;
    -webkit-appearance: none;
    appearance: none;
    border: 1px solid #ccc;
    border-radius: 50%;
    position: relative;
    outline: none;
    cursor: pointer;
    background: #fff;
}

.algeria-cod-form input[type="radio"]:after {
    content: "";
    width: 10px;
    height: 10px;
    background: #007cba;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    transition: transform 0.12s ease-in-out;
}

.algeria-cod-form input[type="radio"]:checked:after {
    transform: translate(-50%, -50%) scale(1);
}

/* checkbox style */
.algeria-cod-form input[type="checkbox"] {
    border-radius: 3px;
}
.algeria-cod-form input[type="checkbox"]:after {
    content: "";
    width: 10px;
    height: 10px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: #007cba;
}
.algeria-cod-form input[type="checkbox"]:checked:after {
    transform: translate(-50%, -50%) scale(1);
}

/* basic layout tweaks (redundant but safe) */
.algeria-cod-form { direction: rtl; max-width: 520px; margin: 20px auto; }
.algeria-cod-form .form-row { margin-bottom: 12px; text-align: right; }
.algeria-cod-form label { display: block; margin-bottom: 6px; }
.algeria-cod-form input[type="text"],
.algeria-cod-form input[type="tel"],
.algeria-cod-form select { width: 100%; padding: 8px; box-sizing: border-box; }
.algeria-cod-form .price-breakdown { text-align: right; }
#cod-message { display: none; padding: 10px; margin-top: 10px; border-radius: 4px; }
#cod-message.success { background: #e6ffef; color: #046a3a; border:1px solid #b8f0ce; }
#cod-message.error { background: #fff0f0; color: #7a1414; border:1px solid #f3c6c6; }

.total-section {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
    border: 2px solid #28a745;
}

.price-breakdown .price-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    color: black;
}

.price-breakdown .total-price {
    border-top: 1px solid #ddd;
    padding-top: 8px;
    margin-top: 8px;
    font-weight: bold;
    font-size: 16px;
}

.confirm-button {
    background: #28a745;
    color: white;
    padding: 15px 30px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    width: 100%;
    transition: background 0.3s ease;
}

.confirm-button:hover {
    background: #218838;
}

.confirm-button:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

#cod-message {
    padding: 10px;
    border-radius: 5px;
    text-align: center;
    font-weight: bold;
}

#cod-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

#cod-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

small {
    color: #666;
    text-align: right;
    display: block;
    margin-top: 5px;
    font-size: 12px;
}

/* Hide WooCommerce proceed-to-checkout areas when plugin is active on cart page */
.woocommerce-cart .wc-proceed-to-checkout,
.woocommerce-cart .proceed-to-checkout,
.woocommerce-cart .cart_totals .checkout {
    display: none !important;
}

/* Utility class applied by JS to disabled checkout links */
.algeria-cod-hidden-checkout {
    opacity: 0.6;
    pointer-events: none !important;
}