/* ==========================================================================
   WooPanel — Estilos do Botão Editar e Modal de Edição (Tema Colorido)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Botão Editar na Tabela (Coluna Ações)
   Formato quadrado com bordas arredondadas, cor azul, ícone Lucide Pencil.
   -------------------------------------------------------------------------- */

.woopanel-new-cadastro--theme-coloria .woopanel-btn-edit,
.woopanel-btn-edit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 8px;
    background: var(--coloria-blue, #2fa5ff);
    color: #ffffff;
    border: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 6px rgba(47, 165, 255, 0.25);
    line-height: 1;
}

.woopanel-new-cadastro--theme-coloria .woopanel-btn-edit:hover,
.woopanel-btn-edit:hover {
    background: #1b96f5;
    filter: brightness(1.08);
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(47, 165, 255, 0.4);
}

.woopanel-new-cadastro--theme-coloria .woopanel-btn-edit:active,
.woopanel-btn-edit:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(47, 165, 255, 0.3);
}

.woopanel-btn-edit .woopanel-btn-icon-svg {
    width: 16px;
    height: 16px;
    stroke-width: 2.2;
    flex-shrink: 0;
}

/* Align action buttons in cell */
.woopanel-actions-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* --------------------------------------------------------------------------
   2. Modal Overlay & Container
   -------------------------------------------------------------------------- */

.woopanel-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(36, 26, 61, 0.55);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.woopanel-modal-overlay.is-active {
    opacity: 1;
    visibility: visible;
}

.woopanel-modal-container {
    width: 100%;
    max-width: 540px;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(36, 26, 61, 0.3);
    overflow: hidden;
    transform: scale(0.94) translateY(10px);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    box-sizing: border-box;
    font-family: var(--woopanel-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
}

.woopanel-modal-overlay.is-active .woopanel-modal-container {
    transform: scale(1) translateY(0);
}

/* --------------------------------------------------------------------------
   3. Modal Header
   -------------------------------------------------------------------------- */

.woopanel-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 22px 26px 18px 26px;
    border-bottom: 1px solid #f3f0ff;
    background: linear-gradient(180deg, #fdf6ff 0%, #ffffff 100%);
}

.woopanel-modal-title-group {
    display: flex;
    flex-direction: column;
}

.woopanel-modal-title {
    font-size: 20px;
    font-weight: 800;
    color: #241a3d;
    margin: 0;
    line-height: 1.2;
}

.woopanel-modal-subtitle {
    font-size: 13px;
    font-weight: 700;
    color: #7c3aed;
    margin: 4px 0 0 0;
    letter-spacing: 0.2px;
}

.woopanel-modal-close {
    background: #f3f0ff;
    border: none;
    color: #7c3aed;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
}

.woopanel-modal-close:hover {
    background: #7c3aed;
    color: #ffffff;
    transform: rotate(90deg);
}

/* --------------------------------------------------------------------------
   4. Modal Body & Loader
   -------------------------------------------------------------------------- */

.woopanel-modal-body {
    padding: 20px 26px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.woopanel-modal-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #7c3aed;
    font-weight: 600;
    font-size: 14px;
    gap: 12px;
}

.woopanel-spinner-large {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(124, 58, 237, 0.18);
    border-top-color: #7c3aed;
    border-radius: 50%;
    animation: woopanel-modal-spin 0.8s linear infinite;
}

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

/* Feedback alerts */
.woopanel-modal-alert {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.woopanel-modal-alert-success {
    background: #e6fcf5;
    color: #0ca678;
    border: 1px solid #b2f2bb;
}

.woopanel-modal-alert-error {
    background: #fff5f5;
    color: #e03131;
    border: 1px solid #ffc9c9;
}

/* Product Info Badge */
.woopanel-edit-product-info {
    background: #f7f5ff;
    border: 1px solid #ede9fe;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13px;
    margin-bottom: 16px;
    color: #241a3d;
}

.woopanel-edit-product-label {
    color: #6b7280;
    margin-right: 6px;
}

.woopanel-edit-product-name {
    font-weight: 700;
    color: #7c3aed;
}

/* --------------------------------------------------------------------------
   5. Autocomplete & Search Field
   -------------------------------------------------------------------------- */

.woopanel-search-box {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.woopanel-search-icon {
    position: absolute;
    left: 14px;
    color: #9ca3af;
    pointer-events: none;
}

.woopanel-search-input {
    width: 100%;
    padding: 11px 36px 11px 40px;
    font-size: 14px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    background: #ffffff;
    color: #1f2937;
    outline: none;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.woopanel-search-input:focus {
    border-color: #7c3aed;
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.12);
}

.woopanel-search-clear {
    position: absolute;
    right: 12px;
    background: #e5e7eb;
    border: none;
    color: #6b7280;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.woopanel-search-clear:hover {
    background: #9ca3af;
    color: #ffffff;
}

/* Selected Tags Bar */
.woopanel-selected-tags-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
    min-height: 28px;
}

.woopanel-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: rgba(124, 58, 237, 0.12);
    color: #7c3aed;
    border: 1px solid rgba(124, 58, 237, 0.2);
    transition: all 0.15s ease;
}

.woopanel-tag--uncategorized {
    background: #f1f3f5;
    color: #495057;
    border-color: #dee2e6;
}

.woopanel-tag-remove {
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.15s ease;
}

.woopanel-tag-remove:hover {
    opacity: 1;
}

/* --------------------------------------------------------------------------
   6. Category List Tree (Scrollable Options Box)
   -------------------------------------------------------------------------- */

.woopanel-category-list-container {
    max-height: 260px;
    overflow-y: auto;
    border: 2px solid #f3f0ff;
    border-radius: 14px;
    padding: 8px;
    background: #faf9fe;
}

/* Custom scrollbar */
.woopanel-category-list-container::-webkit-scrollbar {
    width: 6px;
}
.woopanel-category-list-container::-webkit-scrollbar-track {
    background: #f1f3f5;
    border-radius: 10px;
}
.woopanel-category-list-container::-webkit-scrollbar-thumb {
    background: #d0bfff;
    border-radius: 10px;
}
.woopanel-category-list-container::-webkit-scrollbar-thumb:hover {
    background: #7c3aed;
}

/* Group Headers */
.woopanel-cat-group {
    margin-bottom: 10px;
}

.woopanel-cat-group-title {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    color: #7c3aed;
    letter-spacing: 0.6px;
    padding: 6px 10px 4px 10px;
    margin: 4px 0 2px 0;
    border-bottom: 1px solid #ede9fe;
}

/* Item row */
.woopanel-cat-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease;
    user-select: none;
}

.woopanel-cat-item:hover {
    background: #ffffff;
    box-shadow: 0 2px 6px rgba(124, 58, 237, 0.08);
}

.woopanel-cat-item.is-selected {
    background: #ffffff;
    border-left: 3px solid #7c3aed;
}

/* Custom Checkbox */
.woopanel-checkbox {
    width: 18px;
    height: 18px;
    accent-color: #7c3aed;
    cursor: pointer;
    flex-shrink: 0;
}

.woopanel-cat-name {
    font-size: 13px;
    font-weight: 500;
    color: #241a3d;
    line-height: 1.4;
}

.woopanel-cat-item.is-selected .woopanel-cat-name {
    font-weight: 700;
    color: #7c3aed;
}

.woopanel-no-results {
    padding: 24px;
    text-align: center;
    color: #6b7280;
    font-size: 13px;
    font-weight: 500;
}

/* --------------------------------------------------------------------------
   7. Modal Footer & Action Buttons
   -------------------------------------------------------------------------- */

.woopanel-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 26px;
    background: #faf9fe;
    border-top: 1px solid #f3f0ff;
}

.woopanel-modal-footer .woopanel-btn {
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    padding: 10px 20px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.woopanel-btn-cancel {
    background: #edf2f7;
    color: #4a5568;
}

.woopanel-btn-cancel:hover {
    background: #e2e8f0;
    color: #1a202c;
}

.woopanel-btn-save {
    background: linear-gradient(135deg, #7c3aed 0%, #2fa5ff 100%);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.3);
}

.woopanel-btn-save:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(124, 58, 237, 0.4);
}

.woopanel-btn-save:disabled,
.woopanel-btn-cancel:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Inline Spinner for save button */
.woopanel-btn-spinner-sm {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: woopanel-modal-spin 0.8s linear infinite;
}
