/* Product Merger Tool - Modern UI */

/* ===== Base & Typography ===== */
:root {
    --pm-primary: #6366f1;
    --pm-primary-light: #818cf8;
    --pm-primary-dark: #4f46e5;
    --pm-accent: #06b6d4;
    --pm-success: #10b981;
    --pm-warning: #f59e0b;
    --pm-danger: #ef4444;
    --pm-dark: #1e1b4b;
    --pm-surface: #f8fafc;
    --pm-border: #e2e8f0;
    --pm-text: #334155;
    --pm-text-muted: #94a3b8;
    --pm-card-shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --pm-card-shadow-lg: 0 10px 15px -3px rgba(0,0,0,.07), 0 4px 6px -4px rgba(0,0,0,.05);
    --pm-radius: 0.75rem;
}

body {
    background: var(--pm-surface);
    color: var(--pm-text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ===== Navbar ===== */
.pm-navbar {
    background: linear-gradient(135deg, var(--pm-dark) 0%, #312e81 100%);
    border-bottom: none;
    padding: .6rem 1rem;
    box-shadow: 0 4px 12px rgba(30,27,75,.15);
}

.pm-navbar .navbar-brand {
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: -.02em;
    color: #fff !important;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.pm-navbar .navbar-brand .brand-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--pm-primary-light), var(--pm-accent));
    border-radius: .5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .9rem;
}

.pm-navbar .nav-link {
    color: rgba(255,255,255,.7) !important;
    font-weight: 500;
    font-size: .875rem;
    padding: .5rem .85rem !important;
    border-radius: .5rem;
    transition: all .15s;
}

.pm-navbar .nav-link:hover,
.pm-navbar .nav-link.active {
    color: #fff !important;
    background: rgba(255,255,255,.12);
}

/* ===== Cards ===== */
.card {
    border: 1px solid var(--pm-border);
    border-radius: var(--pm-radius);
    box-shadow: var(--pm-card-shadow);
    overflow: hidden;
}

.card-header {
    background: #fff;
    border-bottom: 1px solid var(--pm-border);
    font-weight: 600;
    font-size: .9rem;
    padding: .75rem 1rem;
}

.card-footer {
    background: var(--pm-surface);
    border-top: 1px solid var(--pm-border);
}

/* ===== Tables ===== */
.table {
    font-size: .85rem;
    margin-bottom: 0;
}

.table thead th {
    font-weight: 600;
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--pm-text-muted);
    background: var(--pm-surface);
    border-bottom: 2px solid var(--pm-border);
    padding: .65rem .75rem;
    white-space: nowrap;
}

.table-dark-header thead th {
    background: var(--pm-dark);
    color: rgba(255,255,255,.9);
    border-bottom-color: var(--pm-dark);
}

.table tbody td {
    padding: .55rem .75rem;
    vertical-align: middle;
    border-color: var(--pm-border);
}

.table-hover tbody tr:hover {
    background: #eef2ff;
}

/* ===== Buttons ===== */
.btn {
    font-weight: 500;
    font-size: .85rem;
    border-radius: .5rem;
    padding: .4rem .85rem;
    transition: all .15s;
}

.btn-primary {
    background: var(--pm-primary);
    border-color: var(--pm-primary);
}
.btn-primary:hover {
    background: var(--pm-primary-dark);
    border-color: var(--pm-primary-dark);
    box-shadow: 0 4px 12px rgba(99,102,241,.3);
}

.btn-success {
    background: var(--pm-success);
    border-color: var(--pm-success);
}
.btn-success:hover {
    background: #059669;
    border-color: #059669;
    box-shadow: 0 4px 12px rgba(16,185,129,.3);
}

.btn-danger {
    background: var(--pm-danger);
    border-color: var(--pm-danger);
}

.btn-outline-secondary {
    border-color: var(--pm-border);
    color: var(--pm-text);
}
.btn-outline-secondary:hover {
    background: var(--pm-surface);
    border-color: #cbd5e1;
    color: var(--pm-text);
}

/* ===== Badges ===== */
.badge {
    font-weight: 500;
    font-size: .75rem;
    padding: .3em .6em;
    border-radius: .35rem;
}

.badge-enabled { background: var(--pm-success); }
.badge-disabled { background: var(--pm-danger); }
.badge-visible { background: var(--pm-primary); }
.badge-not-visible { background: var(--pm-text-muted); }

/* ===== Form Controls ===== */
.form-select, .form-control {
    border-color: var(--pm-border);
    border-radius: .5rem;
    font-size: .85rem;
}

.form-select:focus, .form-control:focus {
    border-color: var(--pm-primary-light);
    box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}

.form-label {
    font-weight: 500;
    font-size: .82rem;
    color: var(--pm-text);
}

.form-check-input:checked {
    background-color: var(--pm-primary);
    border-color: var(--pm-primary);
}

/* ===== Wizard Steps ===== */
.wizard-steps {
    display: flex;
    gap: 0;
    padding: 0;
}

.wizard-step {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem 1.2rem;
    color: var(--pm-text-muted);
    position: relative;
    flex: 1;
    justify-content: center;
}

.wizard-step:not(:last-child)::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    border-left: 8px solid var(--pm-border);
}

.wizard-step .step-number {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #e2e8f0;
    color: var(--pm-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .8rem;
    flex-shrink: 0;
    transition: all .2s;
}

.wizard-step.active .step-number {
    background: var(--pm-primary);
    color: #fff;
    box-shadow: 0 0 0 4px rgba(99,102,241,.2);
}

.wizard-step.completed .step-number {
    background: var(--pm-success);
    color: #fff;
}

.wizard-step.active {
    color: var(--pm-primary);
    font-weight: 600;
}

.wizard-step.completed {
    color: var(--pm-success);
}

.wizard-step .step-label {
    font-size: .82rem;
    white-space: nowrap;
}

/* ===== Validation Matrix ===== */
.val-ok {
    background-color: #ecfdf5 !important;
}

.val-missing {
    background-color: #fef2f2 !important;
    border-left: 3px solid var(--pm-danger) !important;
}

.val-duplicate {
    background-color: #fffbeb !important;
    border-left: 3px solid var(--pm-warning) !important;
}

/* ===== Product Grid ===== */
#productTable tbody tr {
    cursor: pointer;
    transition: background .1s;
}

#productTable tbody tr.selected {
    background-color: #eef2ff !important;
    border-left: 3px solid var(--pm-primary);
}

.dataTables_wrapper .dataTables_filter input {
    margin-left: .5rem;
    border-radius: .5rem;
    border: 1px solid var(--pm-border);
    padding: .3rem .6rem;
    font-size: .85rem;
}

.dataTables_wrapper .dataTables_length select {
    border-radius: .5rem;
    border: 1px solid var(--pm-border);
}

.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_length label {
    font-size: .82rem;
    color: var(--pm-text-muted);
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--pm-primary) !important;
    color: #fff !important;
    border-color: var(--pm-primary) !important;
    border-radius: .4rem;
}

/* ===== Merge Suggestions Panel ===== */
.suggestions-panel {
    border: 1px solid #c7d2fe;
    border-radius: var(--pm-radius);
    background: linear-gradient(135deg, #eef2ff 0%, #f0f9ff 100%);
}

.suggestion-group {
    background: #fff;
    border: 1px solid var(--pm-border);
    border-radius: .6rem;
    padding: .75rem 1rem;
    margin-bottom: .5rem;
    transition: all .15s;
    cursor: pointer;
}

.suggestion-group:hover {
    border-color: var(--pm-primary-light);
    box-shadow: 0 2px 8px rgba(99,102,241,.1);
}

.suggestion-group.selected {
    border-color: var(--pm-primary);
    background: #eef2ff;
    box-shadow: 0 0 0 2px rgba(99,102,241,.15);
}

.suggestion-group .sg-header {
    font-weight: 600;
    font-size: .9rem;
    color: var(--pm-dark);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.suggestion-group .sg-count {
    background: var(--pm-primary);
    color: #fff;
    padding: .15em .5em;
    border-radius: .3rem;
    font-size: .75rem;
    font-weight: 600;
}

.suggestion-group .sg-products {
    font-size: .8rem;
    color: var(--pm-text-muted);
    margin-top: .4rem;
    line-height: 1.5;
}

.suggestion-group .sg-variant {
    display: inline-block;
    background: #f1f5f9;
    padding: .1em .5em;
    border-radius: .3rem;
    margin: .1rem .15rem;
    font-size: .78rem;
}

/* ===== Preview Colors ===== */
.op-insert { color: var(--pm-success); font-weight: 600; }
.op-update { color: var(--pm-warning); font-weight: 600; }
.op-delete { color: var(--pm-danger); font-weight: 600; }

/* ===== Merge Log Status ===== */
.status-completed { color: var(--pm-success); }
.status-failed { color: var(--pm-danger); }
.status-undone { color: var(--pm-text-muted); }
.status-running { color: var(--pm-primary); }
.status-pending { color: var(--pm-warning); }

/* ===== Category Checkboxes ===== */
.category-checkbox {
    display: block;
    padding: 2px 0;
}
.category-checkbox label {
    font-size: .82rem;
}

/* ===== Attribute Checkboxes ===== */
#attributeCheckboxes .form-check {
    padding: 5px 0 5px 1.5em;
}

/* ===== Filter Bar ===== */
.filter-bar {
    background: #fff;
    border: 1px solid var(--pm-border);
    border-radius: var(--pm-radius);
    padding: .65rem 1rem;
    box-shadow: var(--pm-card-shadow);
    margin-bottom: .75rem;
}

.filter-bar label {
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--pm-text-muted);
    margin-bottom: .15rem;
}

/* ===== Select2 Overrides (filter bar) ===== */
.filter-bar .select2-container--bootstrap-5 .select2-selection {
    font-size: .875rem;
    min-height: calc(1.5em + .5rem + 2px);
    padding: .25rem .5rem;
    border-color: var(--pm-border);
    border-radius: .375rem;
}

.filter-bar .select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    padding: 0;
    line-height: 1.5;
}

.select2-container--bootstrap-5 .select2-dropdown {
    border-color: var(--pm-border);
    border-radius: .5rem;
    box-shadow: var(--pm-card-shadow-lg);
}

.select2-container--bootstrap-5 .select2-results__option--selected {
    background-color: #eef2ff;
}

.select2-container--bootstrap-5 .select2-results__option--highlighted {
    background-color: var(--pm-primary);
}

/* ===== Nav Index Status ===== */
#indexStatus {
    cursor: pointer;
}
#indexStatus:hover {
    color: #fff !important;
}

/* ===== Alerts ===== */
.alert {
    border-radius: .6rem;
    font-size: .875rem;
    border: none;
}

.alert-success { background: #ecfdf5; color: #065f46; }
.alert-danger { background: #fef2f2; color: #991b1b; }
.alert-warning { background: #fffbeb; color: #92400e; }
.alert-info { background: #eff6ff; color: #1e40af; }

/* ===== Modal ===== */
.modal-content {
    border: none;
    border-radius: var(--pm-radius);
    box-shadow: 0 25px 50px -12px rgba(0,0,0,.15);
}

.modal-header {
    border-bottom: 1px solid var(--pm-border);
    padding: .85rem 1.25rem;
}

.modal-body .table {
    font-size: .82rem;
}

/* ===== Login Page ===== */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--pm-dark) 0%, #312e81 50%, #4338ca 100%);
}

.login-card {
    background: #fff;
    border-radius: 1rem;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,.25);
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
}

.login-card .brand-icon-lg {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--pm-primary-light), var(--pm-accent));
    border-radius: .85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.4rem;
    color: #fff;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ===== Spinner ===== */
.spinner-border {
    color: var(--pm-primary);
}

/* ===== Misc ===== */
code {
    color: var(--pm-primary-dark);
    font-size: .82em;
}

.loading-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: inherit;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .wizard-step .step-label { display: none; }
    .wizard-step::after { display: none; }
}
