/* ==================== ADD PRICE PANEL – PRICE MODULE ==================== */

/* Main container for the add-price panel */
.add-price-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 8px 0;
}

.add-price-search {
    position: relative;
    width: 100%;
}
.add-price-search .search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-size: 0.9rem;
    z-index: 1;
}
.add-price-search-input {
    padding-left: 34px;
    width: 100%;
    height: 38px;
    font-size: 0.9rem;
}
.add-price-product-display {
    background: #f5f5f5;
    border-radius: 4px;
    padding: 8px 10px;
    font-size: 0.9rem;
    color: var(--text-dark);
    border: 1px solid color-mix(in srgb, var(--theme-accent) 20%, transparent);
}
.add-price-product-display .selected-product-label {
    font-weight: 500;
}
#selected-product-name {
    font-weight: 600;
    color: var(--theme-accent);
}

/* Two‑column layout: matrix left, grade tiles right */
.add-price-two-columns {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin: 10px 0;
}

/* Matrix container – flex column, fill height */
.price-matrix-container {
    background: #fafafa;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    padding: 12px;
    margin-bottom: 0;
    overflow-x: auto;
    display: flex;
    flex-direction: column;
    flex: 1;
}
.price-matrix-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #ddd;
    flex-shrink: 0;
}
.price-matrix-header h4 {
    margin: 0;
    font-size: 1rem;
    color: var(--theme-accent);
}
.no-update-grade-btn {
    background: color-mix(in srgb, var(--theme-accent) 10%, transparent);
    border: 1px solid var(--theme-accent);
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--theme-accent);
    white-space: nowrap;
}
.no-update-grade-btn.active {
    background: var(--theme-accent);
    color: white;
}
.price-matrix-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
    border-radius: 10px;
    overflow: hidden;
    flex: 1;
}
.price-matrix-table th,
.price-matrix-table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: center;
    vertical-align: middle;
}
.price-matrix-table th {
    background: #f0e6f5;
    font-weight: 600;
}
.price-matrix-table thead {
    border-bottom: none;
}
.price-matrix-table thead th {
    border-top: none;
}
.price-matrix-variation-cell {
    background: #f8f9fa;
    font-weight: 500;
    text-align: left;
    position: sticky;
    left: 0;
    background-color: #f8f9fa;
    z-index: 1;
}
.price-matrix-input {
    width: 100%;
    min-width: 80px;
    padding: 6px;
    text-align: center;
    border: 1px solid #ccc;
    border-radius: 4px;
}
.price-matrix-input:disabled {
    background: #f0f0f0;
    color: #999;
}
.price-matrix-input.input-error {
    border-color: #f44336;
    background-color: #ffebee;
}

/* Lock icon styling */
.price-matrix-cell {
    position: relative;
}
.lock-icon {
    display: block;
    margin-top: 4px;
    font-size: 0.7rem;
    cursor: pointer;
    color: #c8a2c8;
    transition: color 0.2s;
}
.lock-icon.active {
    color: #f44336;
}
.lock-icon:hover {
    opacity: 0.8;
}

/* Grade tiles */
.grade-tiles-column {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 500px;
    overflow-y: auto;
    padding-right: 5px;
}
.grade-tile {
    background: white;
    border: 1px solid color-mix(in srgb, var(--theme-accent) 30%, transparent);
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 88%;
    margin: 0 auto;
}
.grade-tile .grade-tile-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.grade-tile .grade-tile-icon {
    font-size: 1.4rem;
    color: var(--theme-accent);
}
.grade-tile .grade-tile-code {
    font-weight: 600;
    font-size: 0.9rem;
    flex: none;
    text-align: center;
    color: var(--theme-accent);
}
.grade-tile .grade-tile-name {
    font-size: 0.65rem;
    color: #aaa;
    text-align: center;
    margin-top: 0;
    line-height: 1.2;
}
.active-grade-tile {
    background: var(--theme-accent);
    border-color: var(--theme-accent);
    color: white;
    box-shadow: var(--theme-glow-box-hover);
}
.active-grade-tile .grade-tile-icon,
.active-grade-tile .grade-tile-code,
.active-grade-tile .grade-tile-name {
    color: white;
}
.disabled-grade-tile {
    background: #f9f9f9;
    border: 1px dashed #c8a2c8;
}
.disabled-grade-tile .grade-tile-icon,
.disabled-grade-tile .grade-tile-code {
    color: #c8a2c8;
}
.disabled-grade-tile .grade-tile-name {
    color: #aaa;
}
.grade-tile:not(.active-grade-tile):hover {
    background: color-mix(in srgb, var(--theme-accent) 10%, white);
    transform: translateY(-1px);
}
/* Grade tile with price updates (non-zero price exists) */
.grade-tile.has-updates:not(.disabled-grade-tile) {
    border: 1px solid var(--theme-accent);
    background: white;
}
.grade-tile.has-updates:not(.disabled-grade-tile) .grade-tile-icon,
.grade-tile.has-updates:not(.disabled-grade-tile) .grade-tile-code {
    color: var(--theme-accent);
}
.grade-tile.has-updates:not(.active-grade-tile):hover {
    background: color-mix(in srgb, var(--theme-accent) 10%, white);
}
/* If a grade has updates but is also globally disabled, keep disabled styling but add a green dot */
.grade-tile.has-updates.disabled-grade-tile .grade-tile-icon,
.grade-tile.has-updates.disabled-grade-tile .grade-tile-code {
    color: #c8a2c8;
}
.grade-tile.has-updates::after {
    content: '';
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    background-color: #4caf50;
    border-radius: 50%;
    box-shadow: 0 0 2px rgba(0,0,0,0.2);
}

/* Reduce space between modifications and grades description */
.add-price-modifications {
    margin-bottom: 5px;
}
#grades-description {
    margin-top: 0;
    margin-bottom: 6px;
}

/* Checkbox and action buttons */
.add-price-checkbox {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 12px 0;
    padding: 8px 0;
    justify-content: center;
}
.add-price-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
}
.add-price-checkbox label {
    margin: 0;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-dark);
    line-height: 1.4;
}
.add-price-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    justify-content: center;
}
.add-price-apply-all-btn,
.add-price-cancel-btn {
    background: var(--theme-accent);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 0 1 auto;
    min-width: 120px;
}
.add-price-apply-all-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.add-price-cancel-btn {
    background: transparent;
    color: var(--theme-accent);
    border: 1px solid var(--theme-accent);
}
.add-price-cancel-btn:hover {
    background: var(--theme-accent);
    color: white;
}
.add-price-apply-all-btn:hover:not(:disabled) {
    background: var(--theme-accent-light);
    box-shadow: var(--theme-glow-box-hover);
}

/* Modifications chips */
.add-price-modifications {
    margin-bottom: 5px;
}
.modifications-label {
    font-size: 0.85rem;
    color: var(--text-dark);
    margin-bottom: 8px;
    font-weight: 500;
}
.modifications-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.modification-chip {
    background: color-mix(in srgb, var(--theme-accent) 10%, transparent);
    border: 1px solid var(--theme-accent);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--theme-accent);
}
.modification-chip:hover,
.modification-chip.active {
    background: var(--theme-accent);
    color: white;
}