/* ============================================
   3M Filter Product - Style Override
   ============================================ */

@import url('../../css/design-system.css');

:root {
    --md-primary: #10b981;
    --md-primary-light: #34d399;
    --md-primary-container: #d1fae5;
    --md-on-primary: #ffffff;
    --md-on-primary-container: #065f46;
    --bg: #f0fdf4;
}

body { background-color: var(--bg); }

.top-bar { background: rgba(240,253,244,0.88); border-bottom-color: rgba(16,185,129,0.12); }

/* --- Dialog Stats --- */
.dialog__stats {
    display: flex;
    gap: 12px;
    margin: 0 12px;
}
.dialog__stat {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: var(--md-shape-full);
}
.dialog__stat--success { background: var(--md-success-container); color: #065f46; }
.dialog__stat--warning { background: #fef3c7; color: #92400e; }
.dialog__stat--info { background: #dbeafe; color: #1e40af; }

/* --- Dialog Filter Select --- */
.dialog__filter-select {
    min-height: 36px;
    padding: 0 32px 0 12px;
    border-radius: var(--md-shape-sm);
    border: 1px solid var(--line);
    background: var(--surface);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--ink);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235f6368' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}
.dialog__filter-select:focus { outline: none; border-color: var(--md-primary); }

/* --- Dialog Toolbar Spacer --- */
.dialog__toolbar-spacer { flex: 1; }

/* --- Status Badge --- */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: var(--md-shape-full);
    font-size: 0.72rem;
    font-weight: 700;
}
.status-badge--matched { background: var(--md-success-container); color: #065f46; }
.status-badge--excluded { background: #fef3c7; color: #92400e; }
.status-badge--new { background: #dbeafe; color: #1e40af; }

/* --- Score Bar --- */
.score-bar {
    width: 50px;
    height: 5px;
    background: var(--line);
    border-radius: 3px;
    overflow: hidden;
    display: inline-block;
    margin-right: 4px;
    vertical-align: middle;
}
.score-bar__fill { height: 100%; border-radius: 3px; }
.score-bar__fill--high { background: var(--md-success); }
.score-bar__fill--medium { background: #f59e0b; }
.score-bar__fill--low { background: var(--md-error); }

/* --- Table Actions --- */
.data-table__actions { display: flex; gap: 4px; }
.data-table__action-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    font-size: 0.75rem;
}
.data-table__action-btn--edit { background: #dbeafe; color: #1d4ed8; }
.data-table__action-btn--edit:hover { background: #bfdbfe; }
.data-table__action-btn--delete { background: #fee2e2; color: #dc2626; }
.data-table__action-btn--delete:hover { background: #fecaca; }

/* --- New Item Highlight --- */
.row--new { background: #eff6ff !important; }

/* --- Dialog Extensions --- */
.dialog__container--large { max-width: 950px; width: 95%; max-height: 85vh; }
.dialog__container--medium { max-width: 500px; width: 95%; }
.dialog__container--small { max-width: 450px; width: 95%; }

/* --- Auto-Learn --- */
.auto-learn-info { font-size: 0.88rem; color: var(--muted); margin-bottom: 16px; line-height: 1.5; }
.auto-learn-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 16px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: var(--md-shape-md);
    margin-bottom: 16px;
}
.auto-learn-item__name { font-weight: 700; color: var(--ink); font-size: 0.95rem; }
.auto-learn-item__price { font-size: 0.85rem; color: var(--muted); }

/* --- Button Variants --- */
.filled-button--success { background: var(--md-success); color: white; }
.filled-button--success:hover { background: #059669; }
.tonal-button--danger { color: var(--md-error); }
.tonal-button--danger:hover { background: var(--md-error-container); }

/* --- Loading Spinner --- */
.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--line);
    border-top-color: var(--md-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --- Loading Bar --- */
.loading-bar {
    width: 200px;
    height: 6px;
    background: var(--line);
    border-radius: 3px;
    overflow: hidden;
}
.loading-bar__fill {
    height: 100%;
    background: var(--md-primary);
    border-radius: 3px;
    transition: width 0.2s;
    width: 0%;
}

/* --- Inline Actions (approve/dismiss in table) --- */
.inline-actions {
    display: flex;
    gap: 4px;
    white-space: nowrap;
}
.btn-inline {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: none;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.btn-inline--approve {
    background: #dcfce7;
    color: #15803d;
}
.btn-inline--approve:hover {
    background: #bbf7d0;
}
.btn-inline--dismiss {
    background: #fee2e2;
    color: #dc2626;
}
.btn-inline--dismiss:hover {
    background: #fecaca;
}
.row--pending {
    background: #f0f9ff;
}

/* --- Tabs --- */
.dialog__tabs {
    display: flex;
    gap: 4px;
    margin-left: 16px;
}
.dialog__tab {
    padding: 6px 16px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.dialog__tab:hover {
    background: var(--surface-alt);
}
.dialog__tab--active {
    background: var(--md-primary-container);
    color: var(--md-primary);
}

/* --- Toolbar Text --- */
.dialog__toolbar-text {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--muted);
    padding-left: 12px;
}

/* --- Form Fields --- */
.form-field { margin-bottom: 12px; }
.form-field:last-child { margin-bottom: 0; }
.form-field__label {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 6px;
}
.form-field__input {
    width: 100%;
    min-height: 40px;
    padding: 0 12px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--surface-soft);
    font-family: var(--md-font-family);
    font-size: 0.88rem;
    color: var(--ink);
    outline: none;
    transition: all 0.15s;
}
.form-field__input:focus { border-color: var(--md-primary); box-shadow: 0 0 0 3px rgba(16,185,129,0.1); }

/* --- Varian List (Add/Edit Dialog) --- */
.varian-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 8px;
}
.varian-row {
    display: flex;
    gap: 6px;
    align-items: center;
}
.varian-row__nama {
    flex: 1;
    min-height: 36px !important;
    padding: 0 10px !important;
    font-size: 0.82rem !important;
}
.varian-row__kode {
    width: 110px;
    min-height: 36px !important;
    padding: 0 10px !important;
    font-size: 0.82rem !important;
    font-family: var(--md-font-mono) !important;
}
.varian-row__remove {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: none;
    background: #fee2e2;
    color: #dc2626;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    flex-shrink: 0;
    transition: all 0.15s;
}
.varian-row__remove:hover { background: #fecaca; }
.varian-add-btn {
    font-size: 0.8rem !important;
    min-height: 34px !important;
}

/* --- Varian Badge (Database Table) --- */
.varian-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    background: #dbeafe;
    color: #1e40af;
    font-size: 0.72rem;
    font-weight: 600;
    margin: 1px 2px;
}
.muted { color: var(--muted); }

/* --- Varian Tag (Results Table) --- */
.varian-tag {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    background: #fef3c7;
    color: #92400e;
    font-size: 0.7rem;
    font-weight: 600;
    margin-left: 4px;
}

/* --- Status Note --- */
.status-note {
    font-size: 0.7rem;
    color: #92400e;
    font-style: italic;
}

/* --- Checkbox --- */
.data-table input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--md-primary);
    cursor: pointer;
}

/* --- Form Error --- */
.form-field__error {
    display: block;
    font-size: 0.72rem;
    color: var(--md-error);
    margin-top: 4px;
    font-weight: 500;
}

.form-field__hint {
    display: block;
    font-size: 0.72rem;
    color: var(--md-on-surface-variant);
    margin-top: 4px;
}

/* --- Autocomplete Dropdown --- */
.form-field--autocomplete {
    position: relative;
}
.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    max-height: 240px;
    overflow-y: auto;
    z-index: 100;
    margin-top: 4px;
}
.autocomplete-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.1s;
    font-size: 0.82rem;
}
.autocomplete-item:hover,
.autocomplete-item--active {
    background: var(--md-primary-container);
}
.autocomplete-kode {
    font-family: var(--md-font-mono);
    font-weight: 700;
    color: var(--md-primary);
    white-space: nowrap;
    font-size: 0.78rem;
}
.autocomplete-nama {
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.autocomplete-nama strong {
    color: var(--md-primary);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .dialog__stats { flex-wrap: wrap; gap: 6px; }
    .dialog__stat { font-size: 0.7rem; padding: 3px 8px; }
    .varian-row { flex-wrap: wrap; }
    .varian-row__kode { width: 100%; }
}