.weup-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 99998;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    background: #1d2327;
    color: #fff;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.weup-bar__inner {
    max-width: 720px;
    margin: 0 auto;
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 10px;
    flex-wrap: nowrap;
}

.weup-bar__button {
    appearance: none;
    border: 0;
    border-radius: 8px;
    background: #2271b1;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
    padding: 12px 18px;
    cursor: pointer;
    flex: 1 1 0;
    min-width: 0;
    text-align: center;
}

.weup-bar__button--stock {
    background: #3c434a;
    border: 1px solid #646970;
}

.weup-bar__button:hover,
.weup-bar__button:focus {
    background: #135e96;
    color: #fff;
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.weup-bar__button--stock:hover,
.weup-bar__button--stock:focus {
    background: #2c3338;
}

.weup-bar__button--delete {
    flex: 0 0 auto;
    width: 48px;
    min-width: 48px;
    padding: 12px;
    background: #8b1a1a;
    border: 1px solid #a42828;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.weup-bar__button--delete:hover,
.weup-bar__button--delete:focus {
    background: #6d1515;
}

.weup-icon-trash {
    display: block;
}

.weup-visibility {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #3c434a;
    border: 1px solid #646970;
    border-radius: 8px;
    padding: 8px 12px;
    min-height: 48px;
    box-sizing: border-box;
}

.weup-visibility__label {
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    color: #fff;
    white-space: nowrap;
}

.weup-switch {
    position: relative;
    display: inline-block;
    width: 51px;
    height: 31px;
    flex-shrink: 0;
}

.weup-switch__input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
    z-index: 2;
}

.weup-switch__slider {
    position: absolute;
    inset: 0;
    background: #767577;
    border-radius: 31px;
    transition: background-color 0.2s ease;
    pointer-events: none;
}

.weup-switch__slider::before {
    content: "";
    position: absolute;
    width: 27px;
    height: 27px;
    left: 2px;
    top: 2px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.weup-switch__input:checked + .weup-switch__slider {
    background: #34c759;
}

.weup-switch__input:checked + .weup-switch__slider::before {
    transform: translateX(20px);
}

.weup-switch__input:focus-visible + .weup-switch__slider {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.weup-switch__input:disabled {
    cursor: not-allowed;
}

.weup-switch__input:disabled + .weup-switch__slider {
    opacity: 0.55;
}

.weup-visibility.is-saving {
    opacity: 0.75;
}

.weup-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
}

.weup-loading-overlay[hidden] {
    display: none !important;
}

.weup-loading-overlay__panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    min-width: min(100%, 280px);
    padding: 24px 28px;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.28);
    text-align: center;
}

.weup-loading-overlay__spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #dcdcde;
    border-top-color: #2271b1;
    border-radius: 50%;
    animation: weup-spin 0.8s linear infinite;
}

.weup-loading-overlay__message {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    color: #1d2327;
}

body.weup-loading-active {
    overflow: hidden;
}

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

.weup-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.weup-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.weup-modal[hidden] {
    display: none !important;
}

.weup-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
}

.weup-modal__dialog {
    position: relative;
    width: min(100%, 480px);
    max-height: calc(100vh - 32px);
    overflow: auto;
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.weup-modal__dialog--wide {
    width: min(100%, 560px);
}

.weup-modal__title {
    margin: 0 0 16px;
    font-size: 18px;
    line-height: 1.3;
}

.weup-modal__preview-wrap {
    background: #f0f0f1;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 16px;
}

.weup-modal__preview {
    display: block;
    width: 100%;
    height: auto;
    max-height: 55vh;
    object-fit: contain;
}

.weup-modal__status {
    margin: 0 0 12px;
    font-size: 14px;
}

.weup-modal__status.is-error {
    color: #b32d2e;
}

.weup-modal__status.is-success {
    color: #007017;
}

.weup-modal__actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.weup-btn {
    appearance: none;
    border: 0;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
    padding: 12px 16px;
    cursor: pointer;
    flex: 1 1 140px;
}

.weup-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.weup-btn--primary {
    background: #2271b1;
    color: #fff;
}

.weup-btn--primary:hover:not(:disabled),
.weup-btn--primary:focus:not(:disabled) {
    background: #135e96;
}

.weup-btn--secondary {
    background: #f0f0f1;
    color: #1d2327;
}

.weup-btn--secondary:hover:not(:disabled),
.weup-btn--secondary:focus:not(:disabled) {
    background: #dcdcde;
}

.weup-btn--danger {
    background: #b32d2e;
    color: #fff;
}

.weup-btn--danger:hover:not(:disabled),
.weup-btn--danger:focus:not(:disabled) {
    background: #8a2424;
}

.weup-delete-message {
    margin: 0 0 16px;
    font-size: 15px;
    line-height: 1.45;
    color: #1d2327;
}

body.weup-modal-open {
    overflow: hidden;
}

.weup-stock-fields {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 16px;
}

.weup-stock-field__label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 600;
    color: #1d2327;
}

.weup-stock-field__input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #8c8f94;
    border-radius: 8px;
    font-size: 18px;
    line-height: 1.2;
    padding: 12px 14px;
}

.weup-stock-field__input:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    outline: none;
}

.weup-stock-table-wrap {
    max-height: 50vh;
    overflow: auto;
    border: 1px solid #dcdcde;
    border-radius: 8px;
}

.weup-stock-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.weup-stock-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f6f7f7;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: #1d2327;
    padding: 10px 12px;
    border-bottom: 1px solid #dcdcde;
}

.weup-stock-table__qty-col {
    width: 110px;
    text-align: center;
}

.weup-stock-table tbody td {
    padding: 8px 12px;
    border-bottom: 1px solid #f0f0f1;
    vertical-align: middle;
}

.weup-stock-table tbody tr:last-child td {
    border-bottom: 0;
}

.weup-stock-table__label {
    color: #1d2327;
    line-height: 1.35;
}

.weup-stock-table__qty {
    text-align: center;
}

.weup-stock-table__input {
    width: 80px;
    padding: 10px 8px;
    font-size: 16px;
    text-align: center;
}

@media (max-width: 480px) {
    .weup-bar__button {
        font-size: 13px;
        padding: 12px 10px;
    }

    .weup-bar__button--delete {
        width: 44px;
        min-width: 44px;
        padding: 12px 8px;
    }

    .weup-visibility {
        padding: 8px 10px;
        gap: 6px;
    }

    .weup-visibility__label {
        font-size: 12px;
    }

    .weup-switch {
        width: 46px;
        height: 28px;
    }

    .weup-switch__slider::before {
        width: 24px;
        height: 24px;
    }

    .weup-switch__input:checked + .weup-switch__slider::before {
        transform: translateX(18px);
    }

    .weup-modal__actions {
        flex-direction: row;
        gap: 8px;
    }

    .weup-modal .weup-btn {
        flex: 1 1 0;
        width: auto;
        min-width: 0;
        font-size: 13px;
        padding: 9px 10px;
    }
}

.weup-modal__dialog--form {
    width: min(100%, 520px);
}

.weup-quick-add-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.weup-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.weup-form-field__label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 600;
    color: #1d2327;
}

.weup-form-field__input,
.weup-form-field__select {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #8c8f94;
    border-radius: 8px;
    font-size: 16px;
    line-height: 1.2;
    padding: 10px 12px;
    background: #fff;
    color: #1d2327;
}

.weup-form-field__select[multiple] {
    min-height: 140px;
}

.weup-form-field__input:focus,
.weup-form-field__select:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    outline: none;
}

.weup-form-field__file {
    width: 100%;
    font-size: 14px;
}

.weup-category-checklist {
    margin: 0;
    padding: 0;
    border: 0;
    min-width: 0;
}

.weup-category-checklist__scroll {
    max-height: 180px;
    overflow: auto;
    border: 1px solid #dcdcde;
    border-radius: 8px;
    padding: 8px;
    background: #fff;
}

.weup-category-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 6px;
    border-radius: 6px;
    cursor: pointer;
}

.weup-category-check:hover {
    background: #f6f7f7;
}

.weup-category-check input {
    margin: 2px 0 0;
    flex-shrink: 0;
}

.weup-category-check__label {
    font-size: 14px;
    line-height: 1.35;
    color: #1d2327;
}

.weup-qa-image-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.weup-qa-image-btn {
    flex: 1 1 0;
    min-width: 0;
}

.weup-qa-image-preview-wrap {
    margin-top: 10px;
    background: #f0f0f1;
    border-radius: 8px;
    overflow: hidden;
}

.weup-qa-image-preview {
    display: block;
    width: 100%;
    height: auto;
    max-height: 200px;
    object-fit: contain;
}

#wpadminbar #wp-admin-bar-weup-quick-add > .ab-item {
    display: flex;
    align-items: center;
}

#wpadminbar #wp-admin-bar-weup-quick-add .ab-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 6px;
}

#wpadminbar #wp-admin-bar-weup-quick-add .weup-ab-icon {
    width: 22px;
    height: 22px;
    display: block;
}

@media screen and (max-width: 782px) {
    #wpadminbar li#wp-admin-bar-customize {
        display: none !important;
    }

    #wpadminbar li#wp-admin-bar-weup-quick-add {
        display: block;
        position: static;
    }

    #wpadminbar #wp-admin-bar-weup-quick-add > .ab-item {
        width: 52px;
        height: 46px;
        padding: 0;
        overflow: hidden;
        text-indent: 100%;
        white-space: nowrap;
        position: relative;
        display: block;
    }

    #wpadminbar #wp-admin-bar-weup-quick-add .ab-label {
        border: 0;
        clip-path: inset(50%);
        height: 1px;
        margin: -1px;
        overflow: hidden;
        padding: 0;
        position: absolute;
        width: 1px;
    }

    #wpadminbar #wp-admin-bar-weup-quick-add .ab-icon {
        font: inherit !important;
        position: absolute;
        left: 0;
        top: 0;
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        width: 52px;
        height: 46px;
        margin: 0;
        padding: 0;
        text-indent: 0;
    }

    #wpadminbar #wp-admin-bar-weup-quick-add .weup-ab-icon {
        width: 28px;
        height: 28px;
    }
}

@media (max-width: 480px) {
    .weup-form-grid {
        grid-template-columns: 1fr;
    }
}
