/* RTL variant of gift-card-view.css, swapped in via wp_style_add_data(...,
   'rtl', 'replace') in enqueue_form_frontend_assets() (class-cgc-blocks.php)
   for RTL locales (eg. Hebrew). WordPress's 'replace' mode loads this file
   INSTEAD of the LTR one, so it needs to be a complete stylesheet, not just
   overrides - see https://developer.wordpress.org/reference/functions/wp_style_add_data/.

   Almost everything here is identical to gift-card-view.css on purpose: the
   base stylesheet is flexbox-first with no physical margin-left/right,
   padding-left/right, text-align, or float properties, so it already mirrors
   correctly under the browser's own RTL handling (flex-start/flex-end and
   justify-content flip automatically with the inherited `dir`). The only
   property that doesn't auto-flip is the loading skeleton's shimmer
   direction, reversed below so it still sweeps in the reading direction. */

.cgc-gift-card-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-width: 640px;
    margin: 0 auto;
    padding: 16px;
    background: hsl(var(--background));
    color: hsl(var(--foreground, 222 47% 11%));
    border-radius: var(--radius, 8px);
}

.cgc-form-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.cgc-design-single,
.cgc-design-picker {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cgc-design-carousel {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
}

.cgc-design-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 220px;
}

.cgc-canvas-mount {
    width: 100%;
    display: flex;
    justify-content: center;
}

.cgc-design-select {
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius, 8px);
    padding: 8px 16px;
    background: hsl(var(--background));
    cursor: pointer;
}

.cgc-design-select.is-selected {
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    border-color: hsl(var(--primary));
}

.cgc-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cgc-field h4 {
    margin: 0;
}

.cgc-amount-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cgc-pill {
    border: 1px solid hsl(var(--input));
    border-radius: var(--radius, 8px);
    padding: 8px 16px;
    background: transparent;
    cursor: pointer;
}

.cgc-pill.is-selected {
    background: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
    border-color: hsl(var(--accent));
}

.cgc-other-amount {
    display: flex;
    align-items: center;
    gap: 4px;
}

.cgc-other-amount input {
    border: 1px solid hsl(var(--input));
    border-radius: var(--radius, 8px);
    padding: 6px 8px;
    width: 140px;
}

.cgc-product-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.cgc-product-card {
    border: 1px solid hsl(var(--input));
    border-radius: var(--radius, 8px);
    padding: 8px;
    width: 160px;
    cursor: pointer;
}

.cgc-product-card.is-unavailable {
    opacity: 0.5;
    cursor: default;
}

.cgc-product-card.is-selected {
    border-color: hsl(var(--accent));
    background: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
}

.cgc-product-card img {
    width: 100%;
    height: 96px;
    object-fit: cover;
    border-radius: calc(var(--radius, 8px) - 2px);
}

.cgc-product-name {
    font-weight: 600;
    margin: 4px 0 0;
}

.cgc-product-price {
    margin: 0;
    font-size: 0.875em;
}

.cgc-unavailable-note {
    margin: 4px 0 0;
    font-size: 0.75em;
    color: #b91c1c;
}

.cgc-product-attributes {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
}

.cgc-product-attributes select {
    border: 1px solid hsl(var(--input));
    border-radius: calc(var(--radius, 8px) - 2px);
    padding: 4px;
}

.cgc-product-addons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.cgc-addon-group {
    border: 0;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cgc-addon-group legend {
    font-weight: 600;
    font-size: 0.875em;
    padding: 0;
}

.cgc-addon-required {
    color: #b91c1c;
}

.cgc-addon-option {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: normal;
    cursor: pointer;
}

.cgc-addon-price {
    font-size: 0.875em;
    opacity: 0.75;
}

.cgc-addon-group select,
.cgc-addon-group input[type="text"],
.cgc-addon-group textarea {
    border: 1px solid hsl(var(--input));
    border-radius: calc(var(--radius, 8px) - 2px);
    padding: 4px;
    width: 100%;
    box-sizing: border-box;
    font: inherit;
}

.cgc-field input[type="text"],
.cgc-field input[type="email"],
.cgc-field textarea {
    border: 1px solid hsl(var(--input));
    border-radius: var(--radius, 8px);
    padding: 8px;
    width: 100%;
    box-sizing: border-box;
    font: inherit;
}

.cgc-repeater-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cgc-repeater-item input {
    border: 1px solid hsl(var(--input));
    border-radius: var(--radius, 8px);
    padding: 8px;
    flex: 1;
}

.cgc-repeater-remove {
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1.25em;
    line-height: 1;
    padding: 4px 8px;
}

.cgc-repeater-add {
    align-self: flex-start;
    border: 1px solid hsl(var(--input));
    border-radius: var(--radius, 8px);
    padding: 6px 12px;
    background: transparent;
    cursor: pointer;
}

.cgc-image-upload-input {
    /* Native file inputs render inconsistently across browsers - hide it and
       use the associated <label> (same for="") as the clickable control. */
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

.cgc-image-upload-label {
    display: inline-block;
    border: 1px solid hsl(var(--input));
    border-radius: var(--radius, 8px);
    padding: 8px 16px;
    cursor: pointer;
    width: fit-content;
}

.cgc-image-preview {
    display: block;
    max-width: 200px;
    max-height: 200px;
    margin-top: 8px;
    border-radius: var(--radius, 8px);
    object-fit: cover;
}

.cgc-messages .cgc-error {
    color: #b91c1c;
}

.cgc-messages .cgc-success {
    color: #15803d;
}

.cgc-submit {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
    border-radius: var(--radius, 8px);
    padding: 10px 24px;
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    cursor: pointer;
    font-weight: 600;
}

.cgc-submit:disabled {
    cursor: default;
    opacity: 0.8;
}

.cgc-submit-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: cgc-spin 0.6s linear infinite;
}

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

.cgc-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.cgc-skeleton {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.cgc-skeleton-block {
    border-radius: var(--radius, 8px);
    background: linear-gradient(270deg, hsl(var(--muted, 210 20% 90%)) 25%, hsl(var(--input)) 37%, hsl(var(--muted, 210 20% 90%)) 63%);
    background-size: 400% 100%;
    animation: cgc-skeleton-shimmer 1.4s ease infinite;
}

.cgc-skeleton-design {
    height: 220px;
}

.cgc-skeleton-field {
    height: 56px;
}

.cgc-skeleton-button {
    height: 44px;
    width: 160px;
}

@keyframes cgc-skeleton-shimmer {
    0% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0 50%;
    }
}
