/* Admin interface styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
}

.admin-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.admin-header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
}

.admin-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-color);
}

.header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.user-info {
    color: var(--text-secondary);
    font-size: 0.9rem;
    padding-right: 1rem;
    border-right: 1px solid var(--border-color);
}

/* Tab Navigation */
.tab-navigation {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border-color);
    background: var(--card-bg);
}

.tab-btn {
    padding: 1rem 2rem;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: var(--primary-color);
    background: var(--bg-color);
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: grid;
}

.admin-content {
    flex: 1;
    grid-template-columns: 350px 1fr;
    gap: 0;
    height: calc(100vh - 145px);
}

/* Pipelines Panel */
.pipelines-panel {
    background: var(--card-bg);
    border-right: 1px solid var(--border-color);
    padding: 1.5rem;
    overflow-y: auto;
}

.pipelines-panel h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.pipelines-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.pipeline-item {
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.pipeline-item:hover {
    border-color: var(--primary-color);
    background: #f0f7ff;
}

.pipeline-item.active {
    background: #eff6ff;
    border-color: var(--primary-color);
}

.pipeline-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.pipeline-item-header h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.step-count {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    background: var(--primary-color);
    color: white;
    border-radius: 0.25rem;
}

.pipeline-item-desc {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Editor Panel */
.editor-panel {
    background: var(--bg-color);
    padding: 2rem;
    overflow-y: auto;
}

.editor-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
}

.editor-placeholder svg {
    margin-bottom: 1rem;
}

.pipeline-editor {
    max-width: 900px;
    margin: 0 auto;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
}

.editor-header h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.pipeline-name-input {
    font-size: 1.25rem;
    font-weight: 600;
    padding: 0.5rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    width: 100%;
    max-width: 400px;
}

.pipeline-name-input:disabled {
    background: var(--bg-color);
    cursor: not-allowed;
}

.editor-actions {
    display: flex;
    gap: 0.75rem;
}

.editor-body {
    background: var(--card-bg);
    border-radius: 0.75rem;
    padding: 2rem;
    box-shadow: var(--shadow);
}

/* Form elements */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-checkbox {
    width: 1.25rem;
    height: 1.25rem;
    cursor: pointer;
}

/* Steps section */
.steps-section {
    margin-top: 2rem;
}

.steps-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.steps-header h3 {
    font-size: 1.25rem;
    color: var(--text-primary);
}

.steps-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
    background: var(--bg-color);
    border: 2px dashed var(--border-color);
    border-radius: 0.5rem;
}

/* Step card */
.step-card {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1.25rem;
}

.step-card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.step-info {
    flex: 1;
}

.step-info h4 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.step-model {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.step-actions {
    display: flex;
    gap: 0.5rem;
}

.step-card-body {
    margin-top: 0.75rem;
}

.config-empty {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-style: italic;
}

.config-items {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.config-item {
    font-size: 0.875rem;
    padding: 0.25rem 0.75rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-danger {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: white;
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

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

.btn-danger:hover {
    background: #dc2626;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
}

.btn-icon:hover:not(:disabled) {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-icon:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.btn-icon.btn-danger:hover {
    background: var(--danger-color);
    color: white;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 0.75rem;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.25rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.25rem;
}

.modal-close:hover {
    background: var(--bg-color);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.step-description {
    margin-bottom: 1.5rem;
}

.description-text {
    color: var(--text-secondary);
    font-size: 0.875rem;
    padding: 0.75rem;
    background: var(--bg-color);
    border-radius: 0.5rem;
}

.step-config {
    margin-top: 1.5rem;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    animation: slideIn 0.3s ease;
}

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

.toast-success {
    background: var(--success-color);
    color: white;
}

.toast-error {
    background: var(--danger-color);
    color: white;
}

.toast-info {
    background: var(--primary-color);
    color: white;
}

/* File upload styles */
.file-upload-wrapper {
    position: relative;
    display: block;
}

.file-input {
    /* Hide the file input but keep it functional */
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}


.file-upload-box {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    background: var(--bg-color);
    transition: all 0.2s;
    cursor: pointer;
}

.file-upload-box:hover {
    border-color: var(--primary-color);
    background: #f0f7ff;
}

.file-upload-box .upload-icon {
    font-size: 1.5rem;
}

.file-upload-box .upload-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.weights-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

.weights-status.uploading {
    background: #dbeafe;
    color: #1e40af;
}

.weights-status.success {
    background: #d1fae5;
    color: #065f46;
}

.weights-status.error {
    background: #fee2e2;
    color: #991b1b;
}

.weights-status.exists {
    background: #d1fae5;
    color: #065f46;
}

.weights-status.missing {
    background: #fef3c7;
    color: #92400e;
}

.form-hint {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.form-control[readonly] {
    background: var(--bg-color);
    cursor: not-allowed;
}

/* ========== Info Icon & Tooltip Styles ========== */

.info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    font-size: 12px;
    font-weight: bold;
    font-style: normal;
    cursor: help;
    margin-left: 6px;
    flex-shrink: 0;
    transition: all 0.2s;
}

.info-icon:hover {
    background: var(--primary-hover);
    transform: scale(1.1);
}

.label-with-info {
    display: flex;
    align-items: center;
    gap: 0;
}

/* Tooltip container */
.tooltip-container {
    position: relative;
    display: inline-flex;
    align-items: center;
}

/* Tooltip content - uses fixed positioning to avoid overflow clipping */
.tooltip-content {
    position: fixed;
    background: #1e293b;
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.5;
    width: 320px;
    max-width: 90vw;
    max-height: 400px;
    overflow-y: auto;
    z-index: 10000;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
}

/* Tooltip arrow - hidden with fixed positioning */
.tooltip-content::after {
    display: none;
}

/* Show tooltip on hover */
.tooltip-container:hover .tooltip-content {
    opacity: 1;
    visibility: visible;
}

/* Tooltip sections */
.tooltip-section {
    margin-bottom: 10px;
}

.tooltip-section:last-child {
    margin-bottom: 0;
}

.tooltip-section strong {
    color: #93c5fd;
    display: block;
    margin-bottom: 4px;
}

.tooltip-recommendation {
    background: rgba(16, 185, 129, 0.2);
    padding: 8px 10px;
    border-radius: 4px;
    border-left: 3px solid #10b981;
}

.tooltip-recommendation strong {
    color: #6ee7b7;
}

.tooltip-impact-list,
.tooltip-options-list {
    margin: 4px 0 0 0;
    padding-left: 16px;
    list-style: none;
}

.tooltip-impact-list li,
.tooltip-options-list li {
    margin-bottom: 4px;
    position: relative;
}

.tooltip-impact-list li::before,
.tooltip-options-list li::before {
    content: '>';
    position: absolute;
    left: -12px;
    color: #64748b;
}

.impact-level {
    color: #fbbf24;
    font-weight: 600;
}

.tooltip-options-list code {
    background: rgba(255, 255, 255, 0.15);
    padding: 1px 5px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 12px;
}

/* Step type info in modal header */
.step-type-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Responsive tooltip */
@media (max-width: 768px) {
    .tooltip-content {
        width: 280px;
    }
}
