/* Konrix-Inspired Design System for MBS Pricing Dashboard */

:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --slate: #1e293b;
    --text-primary: #334155;
    --text-muted: #94a3b8;
    --bg-body: #f5f5f5;
    --bg-card: #ffffff;
    --border-color: #e5e7eb;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    font-size: 0.875rem;
}

/* Navigation */
.navbar {
    background: var(--slate) !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 0.75rem 1rem;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--primary) !important;
}

.navbar-brand span { 
    color: #fff; 
}

.brand-subtitle {
    color: #fff;
    font-weight: 400;
    font-size: 0.75rem;
    margin-left: 0.5rem;
    opacity: 0.85;
}

/* Cards */
.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    background: var(--bg-card);
    margin-bottom: 1.5rem;
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    color: var(--text-primary);
    padding: 1rem 1.5rem;
    font-size: 0.95rem;
}

.card-body { 
    padding: 1.5rem; 
}

/* Typography */
h1 {
    font-weight: 700;
    font-size: 1.75rem;
    color: var(--slate);
    margin-bottom: 1.5rem;
}

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

.table th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border-color);
    padding: 0.75rem 0.5rem;
    white-space: nowrap;
}

.table td {
    padding: 0.75rem 0.5rem;
    vertical-align: middle;
}

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

/* Badges */
.badge {
    font-weight: 500;
    font-size: 0.65rem;
    padding: 0.25em 0.5em;
    border-radius: 4px;
}

.badge-warning {
    background-color: var(--warning);
    color: #fff;
}

.badge-secondary {
    background-color: #64748b;
}

/* Forms */
.form-control, .form-control-sm {
    font-size: 0.8rem;
    border-radius: 6px;
    border-color: var(--border-color);
}

.form-control:focus, .form-control-sm:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.1);
}

.form-label {
    font-size: 0.75rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.input-group-text {
    font-size: 0.8rem;
    background: #f8fafc;
    border-color: var(--border-color);
}

/* Editable Fields */
.editable-field {
    transition: all 0.2s;
}

.editable-field:hover {
    background: #fffbeb;
    border-color: var(--warning);
}

.editable-field.saving {
    background: #ecfdf5;
    border-color: var(--success);
}

.editable-field.saved {
    background: #ecfdf5;
    border-color: var(--success);
}

/* Override Indicator */
.override-indicator {
    color: var(--warning);
    font-weight: 700;
    margin-left: 2px;
}

/* Accordion */
.accordion-item {
    border: none;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 1rem;
}

.accordion-button {
    font-weight: 600;
    font-size: 0.9rem;
    padding: 1rem 1.5rem;
    background: var(--bg-card);
    color: var(--text-primary);
}

.accordion-button:not(.collapsed) {
    background: var(--bg-card);
    color: var(--primary);
    box-shadow: none;
}

.accordion-button:focus {
    box-shadow: none;
    border-color: var(--border-color);
}

.accordion-button::after {
    filter: brightness(0.5);
}

.accordion-body {
    padding: 0;
}

/* Category Override Panel */
.category-override-panel {
    background: #fafafa;
    border-bottom: 1px solid var(--border-color);
}

/* Footer */
footer { 
    color: var(--text-muted); 
    font-size: 0.75rem;
    padding: 2rem 0;
}

/* Save Feedback Animation */
@keyframes checkmark {
    0% { opacity: 0; transform: scale(0.5); }
    50% { opacity: 1; transform: scale(1.2); }
    100% { opacity: 0; transform: scale(1); }
}

.save-checkmark {
    display: inline-block;
    color: var(--success);
    font-weight: 700;
    animation: checkmark 1s ease-out;
}

/* Search */
.search-container {
    position: relative;
}

#productSearch {
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem;
}

.search-results-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 1050;
    max-height: 320px;
    overflow-y: auto;
}

.search-result-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: 0.85rem;
    border-bottom: 1px solid #f1f5f9;
}

.search-result-item:hover {
    background: #f0f7ff;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item mark {
    background: #fef08a;
    padding: 0;
    border-radius: 2px;
}

/* Highlight flash for search jump */
@keyframes highlightFlash {
    0% { background: #fef08a; }
    100% { background: transparent; }
}

.highlight-flash {
    animation: highlightFlash 2s ease-out;
}

/* Sort dropdown */
#categorySort {
    min-width: 180px;
}

/* Inline Editing (Phase 2) */
.inline-editable {
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
}

.inline-editable:hover {
    background: #fffbeb !important;
    outline: 1px solid var(--warning);
}

.inline-editable:focus {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}

.inline-edit-input {
    width: 100%;
    border: 2px solid var(--primary);
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    border-radius: 4px;
    background: #fff;
}

.inline-edit-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.save-flash {
    animation: saveFlash 1.5s ease-out;
}

@keyframes saveFlash {
    0% { background: #d1fae5; }
    100% { background: transparent; }
}

/* Product name clickable */
.product-name-cell {
    cursor: pointer;
    color: var(--primary);
    font-weight: 500;
}

.product-name-cell:hover {
    text-decoration: underline;
}

/* Category override fields */
.category-override-field {
    transition: all 0.2s;
}

.category-override-field:hover {
    background: #fffbeb;
    border-color: var(--warning);
}

/* Modal improvements */
.modal-content {
    border-radius: 12px;
    border: none;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    background: #f8fafc;
    border-radius: 12px 12px 0 0;
}

.modal-body {
    padding: 2rem;
}

/* Add product button */
.add-product-btn {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
}
