body {
    font-family: Arial, sans-serif;
    background: #eef3f8;
    margin: 0;
    padding: 20px;
    color: #222;
}

/* Center UI with better padding */
.container {
    max-width: 700px;
    margin: 0 auto;
    padding: 0 15px;
}

.card {
    background: #fff;
    padding: 28px;
    border-radius: 10px;
    box-shadow: 0 3px 14px rgba(0,0,0,0.08);
}

/* Top Title */
h1 {
    text-align: center;
    margin-top: 0;
    margin-bottom: 24px;
}

/* Form elements and alignment */
.form-group {
    margin-bottom: 18px;
}

label {
    font-weight: 600;
    margin-bottom: 6px;
    display: block;
}

input, select {
    width: 100%;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #ccc;
    font-size: 15px;
    box-sizing: border-box;
}

/* Main Action Buttons (Search) */
button {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    background: #0074d9;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease;
}

button:hover {
    background: #005fa3;
}

/* Inline model select + rebuild alignment */
.model-row {
    display: flex;
    flex-direction: row;
    gap: 10px;
    align-items: center;
}

/* Secondary button for rebuild vector index */
.secondary-btn {
    width: auto;
    padding: 8px 14px;
    font-size: 14px;
    background: #ccc;
    color: #222;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .2s;
}

.secondary-btn:hover {
    background: #bbb;
}

.tiny-hint {
    font-size: 11px;
    opacity: 0.65;
    margin-top: 3px;
}

/* Weight slider + label */
#weight-label {
    font-size: 13px;
    opacity: 0.8;
    display: block;
    margin-top: 6px;
}

/* Results styling */
#results {
    margin-top: 25px;
}

.result-item {
    padding: 14px;
    border-radius: 6px;
    border: 1px solid #ddd;
    margin-bottom: 12px;
    transition: background 0.2s, transform 0.15s;
    cursor: pointer;
}

.result-item:hover {
    background: #f6fbff;
    transform: translateY(-1px);
}

.score {
    font-size: 13px;
    color: #555;
    margin-top: 4px;
}

/* Highlight matched search tokens */
.highlight {
    background: #fff29c;
    padding: 1px 3px;
    border-radius: 2px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    overflow-y: auto;
    padding-top: 40px;
}

.modal-content {
    width: 600px;
    margin: 0 auto 80px auto;
    position: relative;
    background: #fff;
    border-radius: 10px;
    padding: 24px;
}

.close {
    position: absolute;
    right: 16px;
    top: 14px;
    cursor: pointer;
    font-size: 22px;
    color: #444;
}

/* Loading spinner */
.spinner {
    border: 5px solid #ddd;
    border-top: 5px solid #0074d9;
    border-radius: 50%;
    width: 42px; height: 42px;
    margin: 14px auto;
    animation: spin 0.9s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Code Explorer */
.sub-item {
    padding: 6px 12px;
    cursor: pointer;
    border-radius: 4px;
}

.sub-item:hover {
    background: #e0efff;
}

.parents, .children {
    margin-top: 14px;
}

.parents div, .children div {
    font-size: 14px;
}

/* Toast Notification System */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: #fff;
    padding: 16px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    min-width: 280px;
    max-width: 400px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease;
    pointer-events: all;
    border-left: 4px solid #0074d9;
}

.toast.success { border-left-color: #28a745; }
.toast.error { border-left-color: #dc3545; }
.toast.warning { border-left-color: #ffc107; }
.toast.info { border-left-color: #17a2b8; }

.toast-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    font-size: 14px;
    line-height: 1.4;
}

.toast-close {
    cursor: pointer;
    opacity: 0.6;
    font-size: 20px;
    line-height: 1;
    padding: 0 4px;
}

.toast-close:hover {
    opacity: 1;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

.toast.hiding {
    animation: slideOut 0.3s ease forwards;
}

/* Confirmation Modal */
.confirm-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 9998;
    align-items: center;
    justify-content: center;
}

.confirm-modal.show {
    display: flex;
}

.confirm-modal-content {
    background: #fff;
    padding: 28px;
    border-radius: 10px;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.confirm-modal h3 {
    margin-top: 0;
    margin-bottom: 12px;
    color: #333;
}

.confirm-modal p {
    color: #666;
    line-height: 1.6;
    margin-bottom: 24px;
}

.confirm-modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.confirm-modal-buttons button {
    width: auto;
    padding: 10px 24px;
    font-size: 14px;
}

.confirm-modal-buttons .btn-cancel {
    background: #6c757d;
}

.confirm-modal-buttons .btn-cancel:hover {
    background: #5a6268;
}

.confirm-modal-buttons .btn-confirm {
    background: #dc3545;
}

.confirm-modal-buttons .btn-confirm:hover {
    background: #c82333;
}

/* Progress Bar for Rebuild */
.progress-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.progress-overlay.show {
    display: flex;
}

.progress-card {
    background: #fff;
    padding: 32px;
    border-radius: 10px;
    min-width: 350px;
    text-align: center;
}

.progress-card h3 {
    margin-top: 0;
    margin-bottom: 16px;
    color: #333;
}

.progress-card p {
    color: #666;
    margin-bottom: 20px;
    font-size: 14px;
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #0074d9, #00a8ff, #0074d9);
    background-size: 200% 100%;
    animation: progressAnimation 1.5s ease-in-out infinite;
    border-radius: 4px;
}

@keyframes progressAnimation {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.progress-status {
    font-size: 13px;
    color: #0074d9;
    font-weight: 600;
}