/*
 * Frontend Product Page - Location Stock Dropdown Styles
 */

:root {
    --wc-api-sync-border: #e6e8ee;
    --wc-api-sync-text: #0f172a;
    --wc-api-sync-muted: #64748b;
    --wc-api-sync-bg: #ffffff;
    --wc-api-sync-soft: #f8fafc;
    --wc-api-sync-primary: #2563eb;
    --wc-api-sync-primary-soft: rgba(37, 99, 235, 0.12);
    --wc-api-sync-danger: #dc2626;
    --wc-api-sync-danger-soft: rgba(220, 38, 38, 0.10);
    --wc-api-sync-success: #16a34a;
    --wc-api-sync-success-soft: rgba(22, 163, 74, 0.12);
    --wc-api-sync-shadow: 0 10px 25px rgba(2, 6, 23, 0.08);
    --wc-api-sync-radius: 12px;
}

.wc-api-sync-location-selector-container {
    margin: 20px 0;
    padding: 16px;
    border: 1px solid var(--wc-api-sync-border);
    border-radius: var(--wc-api-sync-radius);
    background: linear-gradient(180deg, var(--wc-api-sync-bg), var(--wc-api-sync-soft));
}

.wc-api-sync-location-selector-header {
    margin-bottom: 12px;
}

.wc-api-sync-location-selector-title {
    margin: 0 0 4px;
    font-size: 16px;
    line-height: 1.3;
    color: var(--wc-api-sync-text);
}

.wc-api-sync-location-selector-subtitle {
    margin: 0;
    font-size: 13px;
    color: var(--wc-api-sync-muted);
}

.wc-api-sync-location-dropdown {
    position: relative;
}

.wc-api-sync-location-dropdown__toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 12px;
    border: 1px solid var(--wc-api-sync-border);
    border-radius: 10px;
    background: #fff;
    color: var(--wc-api-sync-text);
    font-size: 14px;
    line-height: 1.4;
    cursor: pointer;
}

.wc-api-sync-location-dropdown__toggle:focus-visible {
    outline: none;
    border-color: var(--wc-api-sync-primary);
    box-shadow: 0 0 0 3px var(--wc-api-sync-primary-soft);
}

.wc-api-sync-location-dropdown__label {
    text-align: left;
    font-weight: 600;
}

.wc-api-sync-location-dropdown__chevron {
    width: 10px;
    height: 10px;
    border-right: 2px solid var(--wc-api-sync-muted);
    border-bottom: 2px solid var(--wc-api-sync-muted);
    transform: rotate(45deg);
    transition: transform 160ms ease;
    margin-right: 2px;
    flex: 0 0 auto;
}

.wc-api-sync-location-dropdown.is-open .wc-api-sync-location-dropdown__chevron {
    transform: rotate(-135deg);
}

.wc-api-sync-location-dropdown__menu {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 8px);
    z-index: 999;

    border: 1px solid var(--wc-api-sync-border);
    border-radius: 12px;
    background: #fff;
    box-shadow: var(--wc-api-sync-shadow);

    padding: 6px;
    display: none;
    max-height: min(340px, 55vh);
    overflow: auto;
}

.wc-api-sync-location-dropdown.is-open .wc-api-sync-location-dropdown__menu {
    display: block;
}

.wc-api-sync-location-option {
    display: grid;
    grid-template-columns: 18px 1fr;
    gap: 12px;

    padding: 10px;
    border-radius: 10px;
    cursor: pointer;
}

.wc-api-sync-location-option:hover {
    background: var(--wc-api-sync-soft);
}

.wc-api-sync-location-option__input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.wc-api-sync-location-option__checkbox {
    width: 18px;
    height: 18px;
    border-radius: 6px;
    border: 1px solid var(--wc-api-sync-border);
    background: #fff;
    box-shadow: 0 1px 0 rgba(2, 6, 23, 0.03);
    margin-top: 2px;
}

.wc-api-sync-location-option__input:checked + .wc-api-sync-location-option__checkbox {
    border-color: var(--wc-api-sync-primary);
    background: var(--wc-api-sync-primary);
    box-shadow: 0 0 0 3px var(--wc-api-sync-primary-soft);
}

.wc-api-sync-location-option__input:checked + .wc-api-sync-location-option__checkbox::after {
    content: "";
    display: block;
    width: 6px;
    height: 10px;
    border-right: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(45deg);
    margin: 2px 0 0 6px;
}

.wc-api-sync-location-option.is-disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.wc-api-sync-location-option.is-disabled:hover {
    background: transparent;
}

.wc-api-sync-location-option__content {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.wc-api-sync-location-option__top {
    display: flex;
    align-items: baseline;
    gap: 8px;
    min-width: 0;
}

.wc-api-sync-location-option__name {
    font-weight: 700;
    color: var(--wc-api-sync-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wc-api-sync-location-option__code {
    font-size: 12px;
    color: var(--wc-api-sync-muted);
    flex: 0 0 auto;
}

.wc-api-sync-location-option__meta {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 10px;
    align-items: center;
}

.wc-api-sync-location-option__price {
    font-weight: 700;
    color: var(--wc-api-sync-text);
    white-space: nowrap;
}

.wc-api-sync-location-option__pricecode {
    font-size: 12px;
    color: var(--wc-api-sync-muted);
    background: #f1f5f9;
    border: 1px solid var(--wc-api-sync-border);
    border-radius: 999px;
    padding: 3px 8px;
    white-space: nowrap;
}

.wc-api-sync-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 12px;
    line-height: 1;
    font-weight: 700;
    white-space: nowrap;
}

.wc-api-sync-badge--success {
    color: var(--wc-api-sync-success);
    background: var(--wc-api-sync-success-soft);
    border: 1px solid rgba(22, 163, 74, 0.25);
}

.wc-api-sync-badge--danger {
    color: var(--wc-api-sync-danger);
    background: var(--wc-api-sync-danger-soft);
    border: 1px solid rgba(220, 38, 38, 0.22);
}

.wc-api-sync-location-stock-message {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 13px;
    display: none;
}

.wc-api-sync-location-stock-message.success {
    background-color: #eef6ff;
    border: 1px solid rgba(37, 99, 235, 0.25);
    color: #1e3a8a;
}

.wc-api-sync-location-stock-message.error {
    background-color: #fff1f2;
    border: 1px solid rgba(220, 38, 38, 0.25);
    color: #7f1d1d;
}

/* Responsive */
@media (max-width: 520px) {
    .wc-api-sync-location-selector-container {
        padding: 12px;
    }

    .wc-api-sync-location-option__meta {
        grid-template-columns: 1fr;
        align-items: start;
        gap: 6px;
    }

    .wc-api-sync-location-option__pricecode {
        justify-self: start;
    }
}
