/* ========================================
   Progress Bar Block - Main Styles
   ======================================== */

.bkbg-pb-wrap {
    --bkbg-pb-bar-height: 20px;
    --bkbg-pb-bar-spacing: 24px;
    --bkbg-pb-bar-radius: 10px;
    --bkbg-pb-track-color: #e5e7eb;
    --bkbg-pb-label-color: #1f2937;
    --bkbg-pb-label-size: 16px;
    --bkbg-pb-label-weight: 500;
    --bkbg-pb-percentage-color: #6b7280;
    --bkbg-pb-percentage-size: 14px;
    --bkbg-pb-title-color: #1f2937;
    --bkbg-pb-title-size: 24px;
    --bkbg-pb-animation-duration: 1000ms;
    
    width: 100%;
}

/* Title */
.bkbg-pb-title {
    font-size: var(--bkbg-pb-title-size);
    font-weight: 700;
    color: var(--bkbg-pb-title-color);
    margin-bottom: 24px;
}

/* List container */
.bkbg-pb-list {
    display: flex;
    flex-direction: column;
    gap: var(--bkbg-pb-bar-spacing);
}

/* Individual item */
.bkbg-pb-item {
    width: 100%;
}

/* Header with label and percentage */
.bkbg-pb-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

/* Label */
.bkbg-pb-label {
    font-size: var(--bkbg-pb-label-size);
    font-weight: var(--bkbg-pb-label-weight);
    color: var(--bkbg-pb-label-color);
    line-height: 1.4;
}

/* Percentage */
.bkbg-pb-percentage {
    font-size: var(--bkbg-pb-percentage-size);
    font-weight: 600;
    color: var(--bkbg-pb-percentage-color);
    font-variant-numeric: tabular-nums;
}

/* Track (background) */
.bkbg-pb-track {
    width: 100%;
    height: var(--bkbg-pb-bar-height);
    background: var(--bkbg-pb-track-color);
    border-radius: var(--bkbg-pb-bar-radius);
    overflow: hidden;
    position: relative;
}

/* Progress bar (filled part) */
.bkbg-pb-bar {
    height: 100%;
    border-radius: var(--bkbg-pb-bar-radius);
    transition: width var(--bkbg-pb-animation-duration) ease-out;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    position: relative;
}

/* Percentage inside bar */
.bkbg-pb-percentage-inside {
    font-size: calc(var(--bkbg-pb-bar-height) * 0.6);
    font-weight: 600;
    color: #fff;
    padding-right: 8px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    white-space: nowrap;
}

/* Percentage above bar */
.bkbg-pb-above {
    position: relative;
    height: 24px;
    margin-bottom: 4px;
}

.bkbg-pb-percentage-above {
    position: absolute;
    transform: translateX(-50%);
    font-size: var(--bkbg-pb-percentage-size);
    font-weight: 600;
    color: var(--bkbg-pb-percentage-color);
    font-variant-numeric: tabular-nums;
    transition: left var(--bkbg-pb-animation-duration) ease-out;
}

/* ========================================
   Layout: Default
   ======================================== */

/* Already defined above */

/* ========================================
   Layout: Rounded
   ======================================== */

.bkbg-pb-rounded .bkbg-pb-track {
    border-radius: 50px;
}

.bkbg-pb-rounded .bkbg-pb-bar {
    border-radius: 50px;
}

/* ========================================
   Layout: Flat
   ======================================== */

.bkbg-pb-flat .bkbg-pb-track {
    border-radius: 0;
}

.bkbg-pb-flat .bkbg-pb-bar {
    border-radius: 0;
}

/* ========================================
   Layout: Thin
   ======================================== */

.bkbg-pb-thin .bkbg-pb-track {
    height: calc(var(--bkbg-pb-bar-height) * 0.5);
}

.bkbg-pb-thin .bkbg-pb-bar {
    height: 100%;
}

.bkbg-pb-thin .bkbg-pb-percentage-inside {
    display: none;
}

/* ========================================
   Layout: Thick
   ======================================== */

.bkbg-pb-thick .bkbg-pb-track {
    height: calc(var(--bkbg-pb-bar-height) * 1.5);
}

/* ========================================
   Effects: Stripes - applied via inline styles
   ======================================== */

.bkbg-pb-striped-animated .bkbg-pb-bar {
    animation: bkbg-pb-stripes 1s linear infinite;
}

@keyframes bkbg-pb-stripes {
    0% {
        background-position: 40px 0, 0 0;
    }
    100% {
        background-position: 0 0, 0 0;
    }
}

/* ========================================
   Effects: Glow - applied via inline styles
   ======================================== */

/* ========================================
   Effects: Gradient - shimmer animation
   ======================================== */

.bkbg-pb-gradient-animated .bkbg-pb-bar {
    animation: bkbg-pb-gradient-shift 3s ease infinite;
}

@keyframes bkbg-pb-gradient-shift {
    0%, 100% {
        background-position: 0% 50%, 0 0;
    }
    50% {
        background-position: 100% 50%, 0 0;
    }
}

/* ========================================
   Animation: Initial state (for scroll animation)
   ======================================== */

.bkbg-pb-wrap[data-animate="1"]:not(.bkbg-pb-animated) .bkbg-pb-bar {
    width: 0 !important;
}

.bkbg-pb-wrap[data-animate="1"]:not(.bkbg-pb-animated) .bkbg-pb-percentage-above {
    left: 0 !important;
}

/* ========================================
   Editor Styles
   ======================================== */

.bkbg-pb-clickable {
    cursor: pointer;
    border: 1px dashed transparent;
    padding: 2px 4px;
    margin: -2px -4px;
    border-radius: 4px;
    transition: border-color 0.2s, background-color 0.2s;
}

.bkbg-pb-clickable:hover {
    border-color: var(--wp-admin-theme-color, #007cba);
    background-color: rgba(0, 124, 186, 0.05);
}

.bkbg-pb-input-active {
    border: 1px solid var(--wp-admin-theme-color, #007cba);
    outline: none;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: inherit;
    background: #fff;
}

input.bkbg-pb-title.bkbg-pb-input-active {
    font-size: var(--bkbg-pb-title-size);
    font-weight: 700;
    color: var(--bkbg-pb-title-color);
    width: 100%;
    margin-bottom: 24px;
}

input.bkbg-pb-label.bkbg-pb-input-active {
    font-size: var(--bkbg-pb-label-size);
    font-weight: var(--bkbg-pb-label-weight);
    color: var(--bkbg-pb-label-color);
}

/* Inspector Controls Styles */
.bkbg-pb-item-control {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
}

.bkbg-pb-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e5e7eb;
}

.bkbg-pb-item-title {
    font-weight: 600;
    font-size: 13px;
    color: #374151;
}

.bkbg-pb-item-actions {
    display: flex;
    gap: 4px;
}

.bkbg-pb-color-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
}

.bkbg-pb-color-row span {
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 500;
    color: #6b7280;
}

.bkbg-pb-color-btn {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    border: 2px solid #e5e7eb;
    cursor: pointer;
    transition: border-color 0.2s;
}

.bkbg-pb-color-btn:hover {
    border-color: #9ca3af;
}

.bkbg-pb-add-btn {
    width: 100%;
    justify-content: center;
    margin-top: 8px;
}

/* ========================================
   Editor: Item Hover States
   ======================================== */

/* Individual item hover */
.bkbg-pb-item {
    position: relative;
    padding: 8px;
    margin: -8px;
    margin-bottom: calc(var(--bkbg-pb-bar-spacing) - 8px);
    border-radius: 6px;
    transition: background-color 0.15s;
}

.bkbg-pb-item:last-child {
    margin-bottom: -8px;
}

.bkbg-pb-item:hover,
.bkbg-pb-item.bkbg-pb-item-hovered {
    background-color: rgba(0, 0, 0, 0.02);
}

/* Item actions toolbar */
.bkbg-pb-item .bkbg-pb-item-actions {
    position: absolute;
    top: 50%;
    right: -44px;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 2px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s, visibility 0.15s;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    padding: 4px;
    z-index: 10;
}

.bkbg-pb-item:hover .bkbg-pb-item-actions,
.bkbg-pb-item.bkbg-pb-item-hovered .bkbg-pb-item-actions {
    opacity: 1;
    visibility: visible;
}

.bkbg-pb-item .bkbg-pb-item-actions .components-button {
    min-width: 28px;
    height: 28px;
    padding: 0;
    justify-content: center;
}

.bkbg-pb-item .bkbg-pb-item-actions .components-button:hover {
    background: #f3f4f6;
}

.bkbg-pb-item .bkbg-pb-item-actions .components-button.is-destructive:hover {
    background: #fef2f2;
    color: #dc2626;
}

/* Add button UI is standardized via assets/css/editor.css (.bkbg-editor-actions) */

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 768px) {
    .bkbg-pb-wrap {
        --bkbg-pb-bar-height: 16px;
        --bkbg-pb-label-size: 14px;
        --bkbg-pb-percentage-size: 12px;
    }
    
    .bkbg-pb-header {
        flex-wrap: wrap;
        gap: 4px;
    }
    
    .bkbg-pb-item .bkbg-pb-item-actions {
        right: -40px;
    }
}
