/**
 * Havenlytics Price Label Field Styles
 * @package Havenlytics
 * @since 2.1.3
 */

/* ============================================
   Remove spinner arrows from number input
   ============================================ */

/* Chrome, Safari, Edge, Opera */
.hvnly-price-label-price-input::-webkit-inner-spin-button,
.hvnly-price-label-price-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Firefox */
.hvnly-price-label-price-input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Price Label Field Container */
.hvnly-price-label-field-wrapper {
    background: var(--hvnly-color-bg-white, #ffffff);
    border-radius: var(--hvnly-card-radius, 8px);
    box-shadow: var(--hvnly-card-shadow, 0px 4px 24px rgba(189, 189, 189, 0.24));
    overflow: hidden;
    border: var(--hvnly-card-border, 1px solid #E4E4ED);
    transition: all var(--hvnly-transition-time, 0.3s ease);
    margin: var(--hvnly-space-md, 1rem) 0;
}

.hvnly-price-label-field-wrapper:hover {
    box-shadow: var(--hvnly-shadow-card-hover, 0 4px 12px rgba(0,0,0,0.08));
    border-color: var(--hvnly-brand-primary, #6c60fe);
}

/* Toggle Container */
.hvnly-price-label-toggle-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--hvnly-card-padding, 1.5rem) var(--hvnly-card-padding, 1.5rem) 0;
    flex-wrap: wrap;
    gap: var(--hvnly-space-sm, 0.5rem);
}

/* Toggle Switch */
.hvnly-price-label-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
    flex-shrink: 0;
}

.hvnly-price-label-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.hvnly-price-label-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--hvnly-border-color, #E4E4ED);
    transition: var(--hvnly-transition-time, 0.3s ease);
    border-radius: 34px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.hvnly-price-label-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: var(--hvnly-color-white, #ffffff);
    transition: var(--hvnly-transition-time, 0.3s ease);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    z-index: 2;
}

.hvnly-price-label-switch input:checked + .hvnly-price-label-slider {
    background-color: var(--hvnly-brand-primary, #6c60fe) !important;
}

.hvnly-price-label-switch input:checked + .hvnly-price-label-slider:before {
    transform: translateX(26px);
    background-color: var(--hvnly-color-white, #ffffff);
}

/* Mode Text */
.hvnly-price-label-mode-text {
    font-weight: var(--hvnly-font-weight-medium, 500);
    font-size: var(--hvnly-font-size-sm, 0.875rem);
    color: var(--hvnly-text-primary, #1E1E2F);
    display: flex;
    align-items: center;
    gap: var(--hvnly-space-xs, 0.25rem);
    flex: 1;
}

.hvnly-price-label-mode-text i {
    font-size: var(--hvnly-font-size-md, 1rem);
    color: var(--hvnly-brand-primary, #6c60fe);
}

/* Hint Text */
.hvnly-price-label-hint {
    font-size: var(--hvnly-font-size-xs, 0.75rem);
    color: var(--hvnly-text-secondary, #555);
}

/* Standard Price Mode & Custom Mode */
.hvnly-price-label-standard-mode,
.hvnly-price-label-custom-mode {
    padding: var(--hvnly-space-md, 1rem) var(--hvnly-card-padding, 1.5rem);
}

/* Input Group */
.hvnly-price-label-input-group,
.hvnly-price-label-select-group {
    display: flex;
    align-items: center;
    gap: var(--hvnly-space-sm, 0.5rem);
    flex-wrap: wrap;
}

/* Currency Symbol */
.hvnly-price-label-currency {
    background: var(--hvnly-color-bg-off-light, #f3f4f6);
    padding: 8px 12px;
    border-radius: var(--hvnly-input-radius, 4px);
    font-weight: var(--hvnly-font-weight-bold, 700);
    font-size: 14px;
    color: var(--hvnly-text-primary, #1E1E2F);
    border: 2px solid var(--hvnly-border-color, #E4E4ED);
    font-family: monospace;
}

/* Input Fields */
.hvnly-price-label-price-input,
.hvnly-price-label-select {
    flex: 1;
    min-width: 200px;
    padding: 8px 20px !important;
    border: 2px solid var(--hvnly-input-border, #E4E4ED) !important;
    border-radius: var(--hvnly-input-radius, 4px) !important;
    font-size: 15px;
    background: var(--hvnly-color-bg-white, #ffffff);
    font-family: var(--hvnly-bodyFont, 'Poppins', sans-serif);
    transition: all var(--hvnly-transition-time, 0.3s ease);
    box-shadow: 0 1px 2px rgba(var(--hvnly-text-primary-rgb), 0.03) !important;
    height: auto;
    line-height: 1.5;
}

/* Select Dropdown */
.hvnly-price-label-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%239192A3'%3E%3Cpath d='M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1rem;
    padding-right: 2.5rem !important;
    cursor: pointer;
}

/* Preview Section */
.hvnly-price-label-preview {
    padding: var(--hvnly-space-md, 1rem) var(--hvnly-card-padding, 1.5rem);
    border-top: var(--hvnly-card-border, 1px solid #E4E4ED);
    background: var(--hvnly-color-bg-off-light, #f3f4f6);
    font-size: var(--hvnly-font-size-sm, 0.875rem);
}

.hvnly-price-label-preview strong {
    font-weight: var(--hvnly-font-weight-semibold, 600);
    color: var(--hvnly-text-primary, #1E1E2F);
}

.hvnly-price-label-preview-value {
    color: var(--hvnly-brand-primary, #6c60fe);
    font-weight: var(--hvnly-font-weight-medium, 500);
    margin-left: var(--hvnly-space-sm, 0.5rem);
    padding: 4px 12px;
    background: rgba(var(--hvnly-primary-rgb), 0.1);
    border-radius: var(--hvnly-border-radius-md, 8px);
    display: inline-block;
}

/* Description */
.hvnly-price-label-field-wrapper .description {
    margin-top: var(--hvnly-space-sm, 0.5rem);
    font-size: var(--hvnly-font-size-xs, 0.75rem);
    color: var(--hvnly-text-secondary, #555);
    font-style: normal;
    line-height: 1.4;
}

.hvnly-price-label-price-input:focus,
.hvnly-price-label-select:focus {
    border-color: var(--hvnly-input-focus, #6c60fe) !important;
    box-shadow: 0 0 0 2px var(--hvnly-brand-primary) !important;
    outline: none;
    background: var(--hvnly-color-bg-white, #ffffff) !important;
}

/* ============================================
   REQUIRED FIELD ERROR STYLING - FIXED
   Red border ONLY when field has error class
   ============================================ */

/* No border for required class alone */
.hvnly__dyamic_metabox_tab__field.hvnly-field-required .hvnly-price-label-price-input,
.hvnly__dyamic_metabox_tab__field.hvnly-field-required .hvnly-price-label-select {
    border-color: var(--hvnly-input-border, #E4E4ED) !important;
}

/* Red border ONLY for error state (empty required fields) */
.hvnly__dyamic_metabox_tab__field.hvnly-field-error .hvnly-price-label-price-input,
.hvnly__dyamic_metabox_tab__field.hvnly-field-error .hvnly-price-label-select {
    border-color: var(--hvnly-brand-error, #FF4D4F) !important;
    background-color: rgba(220, 50, 50, 0.05);
}

/* Remove red border when input has valid content */
.hvnly__dyamic_metabox_tab__field .hvnly-price-label-price-input:valid:not(:placeholder-shown),
.hvnly__dyamic_metabox_tab__field .hvnly-price-label-select option:checked:not([value=""]) {
    border-color: var(--hvnly-input-border, #E4E4ED) !important;
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
    .hvnly-price-label-field-wrapper {
        background: var(--hvnly-dark-bg-white, #252538);
        border-color: var(--hvnly-dark-border, #444);
    }

    .hvnly-price-label-mode-text {
        color: var(--hvnly-dark-text-primary, #F0F0F0);
    }

    .hvnly-price-label-hint {
        color: var(--hvnly-dark-text-secondary, #B0B0B0);
    }

    .hvnly-price-label-currency {
        background: var(--hvnly-dark-bg-light, #1E1E2F);
        border-color: var(--hvnly-dark-border, #444);
        color: var(--hvnly-dark-text-primary, #F0F0F0);
    }

    .hvnly-price-label-price-input,
    .hvnly-price-label-select {
        background: var(--hvnly-dark-bg-light, #1E1E2F) !important;
        border-color: var(--hvnly-dark-border, #444) !important;
        color: var(--hvnly-dark-text-primary, #F0F0F0) !important;
    }

    .hvnly-price-label-preview {
        background: var(--hvnly-dark-bg-light, #1E1E2F);
        border-top-color: var(--hvnly-dark-border, #444);
    }

    .hvnly-price-label-preview strong {
        color: var(--hvnly-dark-text-primary, #F0F0F0);
    }

    .hvnly-price-label-preview-value {
        background: rgba(var(--hvnly-primary-rgb), 0.2);
    }

    .hvnly-price-label-field-wrapper .description {
        color: var(--hvnly-dark-text-secondary, #B0B0B0);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .hvnly-price-label-toggle-container {
        flex-direction: column;
        align-items: flex-start;
    }

    .hvnly-price-label-hint {
        margin-left: 0;
    }

    .hvnly-price-label-input-group,
    .hvnly-price-label-select-group {
        flex-direction: column;
        align-items: stretch;
    }

    .hvnly-price-label-currency {
        text-align: center;
        width: fit-content;
    }

    .hvnly-price-label-price-input,
    .hvnly-price-label-select {
        width: 100%;
        min-width: auto;
    }
}