/* Tunisian COD Checkout Form CSS — v1.1 with !important overrides */
.tn-cod-checkout-wrapper {
    background-color: #f7f7f7 !important;
    border: 1px solid #ddd !important;
    padding: 0 !important;
    margin: 20px 0 !important;
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 100% !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif !important;
    clear: both !important;
    float: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

.tn-cod-checkout-wrapper *,
.tn-cod-checkout-wrapper *::before,
.tn-cod-checkout-wrapper *::after {
    box-sizing: border-box !important;
}

/* Header */
.tn-cod-checkout-wrapper .tn-cod-header {
    background-color: #ed1745 !important;
    color: #ffffff !important;
    height: 40px !important;
    line-height: 40px !important;
    text-align: center !important;
    font-weight: bold !important;
    text-transform: uppercase !important;
    font-size: 15px !important;
    letter-spacing: 0.5px !important;
    width: 100% !important;
    padding: 0 10px !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    display: block !important;
}

/* Form Container */
.tn-cod-checkout-wrapper .tn-cod-form {
    padding: 20px !important;
    margin: 0 !important;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
}

/* Fields Stack */
.tn-cod-checkout-wrapper .tn-cod-fields {
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
}

/* Field Group */
.tn-cod-checkout-wrapper .tn-cod-field-group {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Labels on the same horizontal line */
.tn-cod-checkout-wrapper .tn-cod-label-row {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-bottom: 6px !important;
    font-size: 14px !important;
    font-weight: normal !important;
    color: #222 !important;
    line-height: 1.4 !important;
    padding: 0 !important;
    width: 100% !important;
}

.tn-cod-checkout-wrapper .tn-cod-label-fr {
    text-align: left !important;
    float: none !important;
}

.tn-cod-checkout-wrapper .tn-cod-label-ar {
    text-align: right !important;
    direction: rtl !important;
    float: none !important;
}

/* Input Styling */
.tn-cod-checkout-wrapper .tn-cod-input,
.tn-cod-checkout-wrapper .tn-cod-select {
    width: 100% !important;
    height: 38px !important;
    background-color: #ffffff !important;
    border: 1px solid #222222 !important;
    border-radius: 2px !important;
    padding: 0 12px !important;
    font-size: 14px !important;
    font-family: inherit !important;
    color: #222222 !important;
    outline: none !important;
    box-shadow: none !important;
    transition: border-color 0.2s ease-in-out !important;
    margin: 0 !important;
    min-height: 38px !important;
    max-width: 100% !important;
    display: block !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    line-height: 38px !important;
}

.tn-cod-checkout-wrapper .tn-cod-input:focus,
.tn-cod-checkout-wrapper .tn-cod-select:focus {
    border-color: #ed1745 !important;
    box-shadow: none !important;
    outline: none !important;
}

/* Select wrapper with chevron */
.tn-cod-checkout-wrapper .tn-cod-select-wrapper {
    position: relative !important;
    width: 100% !important;
}

.tn-cod-checkout-wrapper .tn-cod-select {
    padding-right: 30px !important;
    cursor: pointer !important;
}

.tn-cod-checkout-wrapper .tn-cod-select-wrapper::after {
    content: "" !important;
    position: absolute !important;
    right: 12px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 0 !important;
    height: 0 !important;
    border-left: 5px solid transparent !important;
    border-right: 5px solid transparent !important;
    border-top: 5px solid #222 !important;
    pointer-events: none !important;
}

.tn-cod-checkout-wrapper .tn-cod-select:disabled {
    background-color: #f1f1f1 !important;
    color: #777 !important;
    cursor: not-allowed !important;
    border-color: #ccc !important;
}

/* Divider */
.tn-cod-checkout-wrapper .tn-cod-divider {
    border: 0 !important;
    border-top: 1px solid #dddddd !important;
    margin: 25px 0 20px 0 !important;
    padding: 0 !important;
    background: transparent !important;
    height: 0 !important;
}

/* Order Summary */
.tn-cod-checkout-wrapper .tn-cod-summary {
    width: 100% !important;
    margin-bottom: 20px !important;
}

.tn-cod-checkout-wrapper .tn-cod-summary-title {
    font-size: 14px !important;
    font-weight: bold !important;
    text-transform: uppercase !important;
    color: #222222 !important;
    margin: 0 0 15px 0 !important;
    letter-spacing: 0.3px !important;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
    line-height: 1.4 !important;
}

.tn-cod-checkout-wrapper .tn-cod-summary-row {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    font-size: 14px !important;
    margin-bottom: 12px !important;
    padding: 0 !important;
}

.tn-cod-checkout-wrapper .tn-cod-subtotal-row {
    color: #555555 !important;
}

.tn-cod-checkout-wrapper .tn-cod-subtotal-row .tn-cod-summary-value {
    color: #222222 !important;
}

.tn-cod-checkout-wrapper .tn-cod-total-row,
.tn-cod-checkout-wrapper .tn-cod-total-row .tn-cod-summary-label,
.tn-cod-checkout-wrapper .tn-cod-total-row .tn-cod-summary-value {
    color: #ed1745 !important;
    font-weight: bold !important;
}

/* CTA Button */
.tn-cod-checkout-wrapper .tn-cod-button {
    width: 100% !important;
    height: 45px !important;
    background-color: #000000 !important;
    color: #ffffff !important;
    font-weight: bold !important;
    font-size: 16px !important;
    text-transform: uppercase !important;
    border: none !important;
    border-radius: 0 !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background-color 0.2s ease !important;
    margin: 10px 0 0 0 !important;
    letter-spacing: 0.5px !important;
    padding: 0 !important;
    box-shadow: none !important;
    text-decoration: none !important;
    line-height: 45px !important;
    text-align: center !important;
    -webkit-appearance: none !important;
}

.tn-cod-checkout-wrapper .tn-cod-button:hover {
    background-color: #333333 !important;
    color: #ffffff !important;
}

.tn-cod-checkout-wrapper .tn-cod-button:disabled {
    background-color: #666666 !important;
    cursor: not-allowed !important;
}

/* Message box */
.tn-cod-checkout-wrapper .tn-cod-message-box {
    margin-top: 15px !important;
    padding: 10px 12px !important;
    font-size: 14px !important;
    border-radius: 2px !important;
    line-height: 1.4 !important;
}

.tn-cod-checkout-wrapper .tn-cod-message-box.tn-success {
    background-color: #d4edda !important;
    border: 1px solid #c3e6cb !important;
    color: #155724 !important;
}

.tn-cod-checkout-wrapper .tn-cod-message-box.tn-error {
    background-color: #f8d7da !important;
    border: 1px solid #f5c6cb !important;
    color: #721c24 !important;
}

/* Spinner */
.tn-cod-checkout-wrapper .btn-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: tn-spin 0.8s linear infinite;
    margin-left: 10px;
}

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

/* Responsive */
@media (max-width: 768px) {
    .tn-cod-checkout-wrapper {
        margin-left: 10px !important;
        margin-right: 10px !important;
        width: calc(100% - 20px) !important;
    }
    .tn-cod-checkout-wrapper .tn-cod-form {
        padding: 15px 12px !important;
    }
}
