/* =============================================================
   Adverto Price Look Up — Public / Frontend CSS
   ============================================================= */

/* ----------------------------------------------------------
   Calculator wrapper
---------------------------------------------------------- */
.adverto-calculator {
    margin: 24px 0;
    padding: 24px;
    background: #fff;
    border: 1px solid #e2e4e7;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    font-size: 15px;
    color: #1d2327;
    max-width: 100%;
    box-sizing: border-box;
}

.adverto-calculator * {
    box-sizing: border-box;
}

.adverto-calc-title {
    font-size: 18px;
    font-weight: 600;
    color: #1d2327;
    margin: 0 0 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f0f0f1;
    display: flex;
    align-items: center;
}
.adverto-calc-title:before {
    content: "\f540"; /* dashicons-calculator */
    font-family: dashicons;
    margin-right: 10px;
    color: #FF9800;
    font-size: 20px;
}

/* ----------------------------------------------------------
   Dimensions row (Width + Height side by side)
---------------------------------------------------------- */
.adverto-dimensions-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 480px) {
    .adverto-dimensions-row {
        grid-template-columns: 1fr;
    }
}

/* ----------------------------------------------------------
   Field wrapper (all field types)
---------------------------------------------------------- */
.adverto-field-wrap {
    margin-bottom: 18px;
}

.adverto-field-label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #3c434a;
}
.adverto-required {
    color: #d63638;
}

/* Inputs & Selects */
.adverto-input {
    width: 100%;
    padding: 10px 12px;
    font-size: 15px;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    background: #fff;
    color: #2c3338;
    transition: box-shadow 0.1s linear;
}

.adverto-input:focus {
    border-color: #FF9800;
    box-shadow: 0 0 0 1px #FF9800;
    outline: none;
}

.adverto-select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M5%206l5%205%205-5%202%201-7%207-7-7%202-1z%22%20fill%3D%22%23555%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 10px top 50%;
    background-size: 16px auto;
    padding-right: 30px;
}

/* Checkbox & Radio groups */
.adverto-radio-group,
.adverto-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.adverto-radio-label,
.adverto-checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
}
.adverto-radio-label input,
.adverto-checkbox-label input {
    margin-right: 10px;
    margin-top: 0;
}
.adverto-radio-text small,
.adverto-checkbox-text small {
    color: #646970;
    margin-left: 4px;
}

/* Text block */
.adverto-field-text-block {
    background: #f6f7f7;
    padding: 12px;
    border-radius: 4px;
    font-size: 13px;
    color: #50575e;
    line-height: 1.5;
    border-left: 3px solid #FF9800;
}

/* ----------------------------------------------------------
   Price Result Display
---------------------------------------------------------- */
.adverto-price-result {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #f0f0f1;
    display: flex;
    align-items: baseline;
    justify-content: flex-end; /* Align right like total */
    gap: 10px;
}

.adverto-price-label {
    font-size: 16px;
    font-weight: 500;
    color: #50575e;
}

.adverto-price-value {
    font-size: 24px;
    font-weight: 700;
    color: #FF9800;
}

/* ----------------------------------------------------------
   Calculation debug/info (optional)
---------------------------------------------------------- */
.adverto-calc-display-label {
    font-weight: 600;
    margin-right: 5px;
}
.adverto-calc-display-value {
    font-weight: bold; 
    color: #2271b1;
}

/* Calculating spinner */
.adverto-calculating {
    font-size: 0.75em;
    color: #787c82;
    font-weight: normal;
    animation: adverto-pulse 1.2s infinite;
}
@keyframes adverto-pulse {
    0%   { opacity: 1; }
    50%  { opacity: 0.4; }
    100% { opacity: 1; }
}

/* Error text */
.adverto-error-message {
    font-size: 0.75em;
    color: #d63638;
    font-weight: 500;
}

/* Inline range-validation error shown below a number input */
.adverto-field-error {
    display: none;
    color: #d63638;
    font-size: 12px;
    font-weight: 500;
    margin-top: 5px;
    line-height: 1.4;
}

/* Red border on an out-of-range input */
.adverto-input.adverto-input-error {
    border-color: #d63638 !important;
    box-shadow: 0 0 0 2px rgba(214, 54, 56, 0.15) !important;
}

/* Add-to-cart loading state */
button.single_add_to_cart_button.adverto-btn-loading {
    opacity: 0.6;
    cursor: wait;
}

/* ----------------------------------------------------------
   Image Selector
---------------------------------------------------------- */
.adverto-image-selector {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    margin-top: 10px;
}

.adverto-image-option {
    border: 2px solid #e2e4e7;
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
    position: relative;
    overflow: hidden;
}

.adverto-image-option:hover {
    border-color: #b3b8bd;
    background: #f6f7f7;
}

.adverto-image-option.selected {
    border-color: #FF9800;
    background: #FFF3E0;
    box-shadow: 0 0 0 1px #FF9800;
}

.adverto-image-option img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin-bottom: 8px;
    display: block;
    object-fit: cover;
    aspect-ratio: 1 / 1;
}

.adverto-image-option-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #3c434a;
    line-height: 1.3;
}

.adverto-image-option-label small {
    display: block;
    color: #646970;
    margin-top: 2px;
    font-size: 11px;
}

/* Checkmark for selected state */
.adverto-image-option::after {
    content: "\f147"; /* dashicons-yes */
    font-family: dashicons;
    position: absolute;
    top: 8px;
    right: 8px;
    background: #FF9800;
    color: #fff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 14px;
    line-height: 20px;
    text-align: center;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.2s ease;
}

.adverto-image-option.selected::after {
    opacity: 1;
    transform: scale(1);
}

/* Dynamic price note (shown when no WooCommerce price is set) */
.adverto-dynamic-price-note {
    display: inline-block;
    font-size: 14px;
    font-weight: 500;
    color: #FF9800;
    font-style: italic;
}
