/* RTL Support for COD Hustle Checkout Form */

/* Base RTL support */
.cod-form-input {
    text-align: inherit;
    direction: inherit;
}

/* Text alignment based on settings */
.cod-form-input[data-text-align="left"],
.cod-form-input[data-text-align="left"]::placeholder {
    text-align: left !important;
    direction: ltr !important;
}

.cod-form-input[data-text-align="right"],
.cod-form-input[data-text-align="right"]::placeholder {
    text-align: right !important;
    direction: rtl !important;
}

.cod-form-input[data-text-align="center"],
.cod-form-input[data-text-align="center"]::placeholder {
    text-align: center !important;
}

/* RTL text alignment (when using default/language-based alignment) */
.cod-form-input[dir="rtl"],
.cod-form-input[dir="rtl"]::placeholder {
    text-align: right !important;
    direction: rtl !important;
}

/* LTR text alignment (when using default/language-based alignment) */
.cod-form-input[dir="ltr"],
.cod-form-input[dir="ltr"]::placeholder {
    text-align: left !important;
    direction: ltr !important;
}

/* RTL support for select dropdowns */
.cod-form-input option {
    text-align: inherit;
    direction: inherit;
}

/* RTL support for buttons */
button[dir="rtl"] {
    text-align: right;
}

/* RTL support for form layout */
.custom-cod-checkout[dir="rtl"] {
    text-align: right;
}

/* RTL support for quantity selector */
.custom-cod-checkout[dir="rtl"] .quantity {
    direction: rtl;
}

/* RTL support for form fields */
.custom-cod-checkout[dir="rtl"] input[type="text"],
.custom-cod-checkout[dir="rtl"] input[type="tel"],
.custom-cod-checkout[dir="rtl"] input[type="email"],
.custom-cod-checkout[dir="rtl"] textarea,
.custom-cod-checkout[dir="rtl"] select {
    text-align: right;
    direction: rtl;
}

/* RTL support for placeholders */
.custom-cod-checkout[dir="rtl"] input::placeholder,
.custom-cod-checkout[dir="rtl"] textarea::placeholder {
    text-align: right;
    direction: rtl;
}

/* Additional RTL support for specific elements */
.custom-cod-checkout[dir="rtl"] .cod-form-input {
    padding-right: 10px;
    padding-left: 30px;
}

.custom-cod-checkout[dir="rtl"] select.cod-form-input {
    background-position: left 10px center;
    padding-right: 10px;
    padding-left: 30px;
}

/* RTL support for validation messages */
.custom-cod-checkout[dir="rtl"] .woocommerce-error,
.custom-cod-checkout[dir="rtl"] .woocommerce-message {
    text-align: right;
}

/* RTL support for required field asterisk */
.custom-cod-checkout[dir="rtl"] .required {
    margin-right: 4px;
    margin-left: 0;
}

/* Force RTL for Arabic text input */
input[lang="ar"],
textarea[lang="ar"],
select[lang="ar"],
input[lang="ar"]::placeholder,
textarea[lang="ar"]::placeholder {
    text-align: right !important;
    direction: rtl !important;
}

/* Ensure RTL works in all browsers */
.custom-cod-checkout[dir="rtl"] * {
    unicode-bidi: bidi-override;
}

/* Notice Bar Styles */
.cod-notice-bar {
    background-color: var(--notice-bg-color);
    color: var(--notice-text-color);
    padding: var(--notice-padding);
    text-align: center;
    font-size: var(--notice-font-size);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 999999;
    width: 100%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* Adjust body padding when notice bar is active */
body.has-cod-notice {
    transition: padding-top 0.3s ease;
}

/* Admin bar adjustments */
.admin-bar .cod-notice-bar {
    top: 32px; /* Standard admin bar height */
}

/* Mobile admin bar adjustment */
@media screen and (max-width: 782px) {
    .admin-bar .cod-notice-bar {
        top: 46px; /* Mobile admin bar height */
    }
}

/* Mobile responsiveness */
@media screen and (max-width: 600px) {
    .cod-notice-bar {
        font-size: calc(var(--notice-font-size) * 0.9);
        padding: calc(var(--notice-padding) * 0.8);
    }
}

/* Swatch Styles */
:root {
    --swatch-size: 40px;
    --swatch-border-width: 1px;
    --swatch-border-color: #454545;
    --swatch-border-hover-color: #000000;
    --swatch-border-radius: 4px;
    --swatch-spacing: 5px;
    --swatch-shadow-x: 2px;
    --swatch-shadow-y: 2px;
    --swatch-shadow-blur: 4px;
    --swatch-shadow-opacity: 0.1;
    --swatch-shadow-color: rgba(0, 0, 0, var(--swatch-shadow-opacity));
}

.wd-swatches-product {
    display: flex;
    flex-wrap: wrap;
    gap: var(--swatch-spacing);
    margin: 8px 0;
}

.wd-swatch {
    width: var(--swatch-size);
    height: var(--swatch-size);
    border: var(--swatch-border-width) solid var(--swatch-border-color) !important;
    border-radius: var(--swatch-border-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    transition: all 0.2s ease;
    box-sizing: border-box;
    padding: 4px;
    margin: 0;
    box-shadow: var(--swatch-shadow-x) var(--swatch-shadow-y) var(--swatch-shadow-blur) var(--swatch-shadow-color);
}

.wd-swatch-text {
    font-size: 14px;
    font-weight: 500;
    color: #333333;
    line-height: 1.4;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.wd-swatch.wd-enabled:hover {
    border-color: var(--swatch-border-hover-color) !important;
    transform: translateY(-1px);
    --swatch-shadow-opacity: 0.15;
}

.wd-swatch.wd-enabled.active {
    background-color: var(--swatch-border-hover-color);
    border-color: var(--swatch-border-hover-color) !important;
    transform: translateY(1px);
    --swatch-shadow-opacity: 0.05;
}

.wd-swatch.wd-enabled.active .wd-swatch-text {
    color: #ffffff;
}

@media (max-width: 768px) {
    :root {
        --swatch-size: 35px;
    }
    
    .wd-swatch {
        padding: 3px;
    }
    
    .wd-swatch-text {
        font-size: 13px;
    }
}
