:root {
    --primary-color: #4A90E2;
    --primary-dark: #357ABD;
    --secondary-color: #6C757D;
    --success-color: #28A745;
    --danger-color: #DC3545;
    --warning-color: #FFC107;
    --light-bg: #F8F9FA;
    --white: #FFFFFF;
    --dark-text: #212529;
    --gray-text: #6C757D;
    --border-color: #DEE2E6;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: var(--dark-text);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--white);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--white);
    padding: 30px;
    text-align: center;
    position: relative;
}

.btn-logout {
    position: absolute;
    top: 20px;
    right: 30px;
    background: rgba(255, 255, 255, 0.2);
    color: var(--white);
    border: 2px solid rgba(255, 255, 255, 0.5);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: var(--white);
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 8px;
    font-weight: 700;
}

.subtitle {
    font-size: 1rem;
    opacity: 0.9;
}

/* Navigation Tabs */
.tabs {
    display: flex;
    background: var(--light-bg);
    border-bottom: 2px solid var(--border-color);
}

.tab-btn {
    flex: 1;
    padding: 18px 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-text);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
}

.tab-btn .icon {
    font-size: 1.3rem;
}

.tab-btn:hover {
    background: rgba(74, 144, 226, 0.1);
    color: var(--primary-color);
}

.tab-btn.active {
    background: var(--white);
    color: var(--primary-color);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-color);
}

/* Tab Content */
.tab-content {
    display: none;
    padding: 30px;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Section Header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.section-header h2 {
    font-size: 1.8rem;
    color: var(--dark-text);
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary-color);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn-secondary {
    background: var(--secondary-color);
    color: var(--white);
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-danger {
    background: var(--danger-color);
    color: var(--white);
}

.btn-danger:hover {
    background: #c82333;
}

/* Search Box */
.search-box {
    margin-bottom: 24px;
}

.search-box input {
    width: 100%;
    padding: 14px 20px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

/* Questions List */
.questions-list {
    display: grid;
    gap: 16px;
}

.question-card {
    background: var(--white);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
}

.question-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow);
}

.question-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    gap: 16px;
}

.question-text {
    flex: 1;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--dark-text);
}

.question-actions {
    display: flex;
    gap: 8px;
}

.icon-btn {
    background: transparent;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    background: var(--light-bg);
}

.answer-text {
    color: var(--gray-text);
    margin-bottom: 12px;
    line-height: 1.6;
}

.keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.keyword-tag {
    background: var(--light-bg);
    color: var(--primary-color);
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 0.85rem;
    font-weight: 600;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-text);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 16px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 2px solid var(--border-color);
}

.modal-header h3 {
    font-size: 1.5rem;
    color: var(--dark-text);
}

.close-btn {
    background: transparent;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--gray-text);
    transition: color 0.2s ease;
    line-height: 1;
}

.close-btn:hover {
    color: var(--danger-color);
}

/* Form */
#questionForm {
    padding: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--dark-text);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
}

.field-hint {
    margin-top: 8px;
    padding: 12px;
    background: #e8f4f8;
    border-left: 4px solid var(--primary-color);
    border-radius: 4px;
    font-size: 0.9rem;
    color: #555;
    line-height: 1.6;
}

.node-type-select {
    font-weight: 600;
    cursor: pointer;
}

.input-config {
    margin-top: 8px;
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

/* Chat Container */
.chat-container {
    background: var(--light-bg);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.chat-messages {
    height: 500px;
    overflow-y: auto;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--white);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.message {
    display: flex;
    gap: 12px;
    animation: messageSlide 0.3s ease;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-message {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.bot-message .message-avatar {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
}

.user-message .message-avatar {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.5;
}

.bot-message .message-content {
    background: var(--light-bg);
    border-bottom-left-radius: 4px;
}

.user-message .message-content {
    background: var(--primary-color);
    color: var(--white);
    border-bottom-right-radius: 4px;
}

.message-time {
    font-size: 0.75rem;
    color: var(--gray-text);
    margin-top: 4px;
}

.user-message .message-time {
    color: rgba(255, 255, 255, 0.8);
}

.chat-input-container {
    display: flex;
    gap: 12px;
}

#chatInput {
    flex: 1;
    padding: 14px 20px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

#chatInput:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.chat-status {
    display: flex;
    justify-content: center;
    margin-top: 16px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--light-bg);
    border-radius: 20px;
    font-size: 0.9rem;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--success-color);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.status-indicator.disconnected .status-dot {
    background: var(--danger-color);
}

/* Footer */
.footer {
    background: var(--light-bg);
    padding: 20px;
    text-align: center;
    color: var(--gray-text);
    font-size: 0.9rem;
    border-top: 1px solid var(--border-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .header h1 {
        font-size: 1.8rem;
    }

    .tab-content {
        padding: 20px;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .tab-btn {
        padding: 14px 16px;
        font-size: 0.9rem;
    }

    .message-content {
        max-width: 85%;
    }

    .chat-messages {
        height: 400px;
    }

    .modal-content {
        width: 95%;
    }
}

/* Loading Spinner */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--white);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Scrollbar Styling */
.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: var(--light-bg);
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* Login Page Styles */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-container {
    width: 100%;
    max-width: 450px;
    padding: 20px;
}

.login-card {
    background: var(--white);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.login-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--white);
    padding: 40px 30px;
    text-align: center;
}

.login-icon {
    font-size: 4rem;
    margin-bottom: 16px;
}

.login-header h1 {
    font-size: 2rem;
    margin-bottom: 8px;
}

.login-header p {
    opacity: 0.9;
}

.login-form {
    padding: 40px 30px;
}

.btn-block {
    width: 100%;
    margin-top: 8px;
}

.error-message {
    background: #fee;
    color: var(--danger-color);
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 16px;
    display: none;
    font-size: 0.9rem;
    border: 1px solid var(--danger-color);
}

.login-footer {
    background: var(--light-bg);
    padding: 20px;
    text-align: center;
    color: var(--gray-text);
    font-size: 0.9rem;
}

/* Config Section Styles */
.config-section {
    background: var(--light-bg);
    padding: 24px;
    border-radius: 12px;
    margin-bottom: 24px;
}

.config-section h3 {
    margin-bottom: 16px;
    color: var(--dark-text);
    font-size: 1.3rem;
}

.btn-success {
    background: var(--success-color);
    color: var(--white);
}

.btn-success:hover {
    background: #218838;
}

/* Flow Nodes Styles */
.flow-nodes {
    display: grid;
    gap: 20px;
    margin-top: 20px;
}

.node-card {
    background: var(--white);
    border: 2px solid var(--border-color);
    border-left: 4px solid #4A90E2;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
}

.node-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow);
}

.node-card-start {
    border-left-color: #28a745;
    background: linear-gradient(to right, #f0fff4 0%, white 10%);
}

.node-card-orphan {
    border-left-color: #ffc107;
    background: linear-gradient(to right, #fffbeb 0%, white 10%);
}

.start-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    color: #28a745;
    background: #d4edda;
    padding: 2px 8px;
    border-radius: 4px;
    margin-right: 8px;
}

.orphan-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    color: #856404;
    background: #fff3cd;
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 8px;
}

.node-stats {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.stat-badge {
    font-size: 11px;
    color: #666;
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 4px;
}

.stat-badge-incoming {
    font-size: 11px;
    color: #0066cc;
    background: #e6f2ff;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.option-broken {
    background: #fff0f0 !important;
    border-left: 3px solid #dc3545 !important;
}

.option-next-broken {
    color: #dc3545 !important;
    font-weight: bold;
}

.node-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.node-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.node-id-badge {
    background: var(--primary-color);
    color: var(--white);
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
}

.final-badge {
    background: var(--success-color);
    color: var(--white);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.dropdown-badge {
    background: #3498db;
    color: var(--white);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.input-badge {
    background: #8e44ad;
    color: var(--white);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.node-actions {
    display: flex;
    gap: 8px;
}

.node-question {
    font-size: 1.1rem;
    color: var(--dark-text);
    margin-bottom: 16px;
    line-height: 1.5;
}

.node-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.option-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--light-bg);
    border-radius: 8px;
    font-size: 0.9rem;
}

.option-number {
    background: var(--primary-color);
    color: var(--white);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.option-text {
    flex: 1;
    color: var(--dark-text);
}

.option-arrow {
    color: var(--gray-text);
    font-weight: 700;
}

.option-next {
    background: var(--white);
    color: var(--primary-color);
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.8rem;
    border: 1px solid var(--primary-color);
}

/* Modal Styles for Nodes */
.modal-large {
    max-width: 800px;
}

.option-field {
    display: grid;
    grid-template-columns: 2fr 2fr auto;
    gap: 12px;
    margin-bottom: 12px;
    align-items: center;
}

.option-text-input,
.option-next-input {
    padding: 10px 14px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.option-text-input:focus,
.option-next-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn-remove-option {
    background: var(--danger-color);
    color: var(--white);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.2s ease;
}

.btn-remove-option:hover {
    background: #c82333;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.9rem;
}

/* Chat Options (Buttons in chat) */
.chat-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px 0;
    animation: fadeIn 0.3s ease;
}

.chat-option-btn {
    background: var(--white);
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 14px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    text-align: left;
}

.chat-option-btn:hover {
    background: var(--primary-color);
    color: var(--white);
    transform: translateX(5px);
}

.chat-option-btn:active {
    transform: translateX(5px) scale(0.98);
}

/* Chat input for free text input nodes */
.chat-input-container {
    display: flex;
    gap: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 10px;
    align-items: center;
}

.chat-text-input {
    flex: 1;
    padding: 14px 16px;
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
}

.chat-text-input:focus {
    outline: none;
    border-color: #2980b9;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.chat-submit-btn {
    padding: 14px 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.chat-submit-btn:hover {
    background: #2980b9;
    transform: scale(1.05);
}

.chat-submit-btn:active {
    transform: scale(0.98);
}

/* Chat dropdown with search */
.chat-dropdown-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    max-width: 500px;
}

.chat-dropdown-search {
    padding: 12px 16px;
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
}

.chat-dropdown-search:focus {
    outline: none;
    border-color: #2980b9;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.chat-dropdown-select {
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    background: white;
    min-height: 200px;
    cursor: pointer;
}

.chat-dropdown-select option {
    padding: 10px;
    cursor: pointer;
}

.chat-dropdown-select option:hover {
    background: var(--light-bg);
}

.chat-dropdown-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Section Header Inline */
.section-header-inline {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.section-header-inline h3 {
    margin: 0;
}

.view-toggle {
    display: flex;
    gap: 8px;
}

/* Tree View Styles */
.flow-tree-view {
    background: var(--white);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
    max-height: 600px;
    overflow-y: auto;
}

.tree-container {
    font-family: 'Courier New', monospace;
}

.tree-root {
    margin-bottom: 30px;
}

.tree-start-label {
    background: var(--primary-color);
    color: var(--white);
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 700;
    margin-bottom: 16px;
    display: inline-block;
}

.tree-node {
    margin: 10px 0;
    padding: 12px;
    background: var(--light-bg);
    border-left: 3px solid var(--primary-color);
    border-radius: 6px;
    transition: all 0.2s ease;
}

.tree-node:hover {
    background: #e3e8ef;
    transform: translateX(5px);
}

.tree-node-orphan {
    border-left-color: var(--danger-color);
    background: #fee;
}

.tree-node-reference {
    background: #f0f0f0;
    border-left-color: var(--secondary-color);
    padding: 8px 12px;
    font-style: italic;
}

.tree-node-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.tree-icon {
    font-size: 1.2rem;
}

.tree-node-id {
    background: var(--primary-color);
    color: var(--white);
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.85rem;
    font-family: 'Courier New', monospace;
}

.tree-badge {
    background: var(--success-color);
    color: var(--white);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

.tree-node-question {
    color: var(--dark-text);
    padding-left: 32px;
    font-size: 0.95rem;
}

.tree-option {
    margin: 8px 0;
    padding: 8px 12px;
    background: var(--white);
    border-left: 2px solid var(--success-color);
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.tree-option-number {
    background: var(--success-color);
    color: var(--white);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
}

.tree-option-text {
    color: var(--dark-text);
    font-size: 0.9rem;
}

.tree-edit-btn,
.tree-delete-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
    margin-left: auto;
}

.tree-edit-btn:hover {
    background: var(--light-bg);
}

.tree-delete-btn:hover {
    background: #fee;
}

.tree-orphans {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px dashed var(--danger-color);
}

.tree-orphans-label {
    background: var(--warning-color);
    color: #856404;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 700;
    margin-bottom: 16px;
    display: inline-block;
}

.tree-label {
    color: var(--gray-text);
    font-size: 0.85rem;
    font-style: italic;
}

/* Improved Option Field with Select */
.option-field {
    display: grid;
    grid-template-columns: 2fr 2fr auto;
    gap: 12px;
    margin-bottom: 12px;
    align-items: center;
}

.option-next-select {
    padding: 10px 14px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.95rem;
    background: var(--white);
    cursor: pointer;
    transition: all 0.3s ease;
}

.option-next-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.option-next-select option {
    padding: 8px;
}

/* Small helper text */
small {
    display: block;
    color: var(--gray-text);
    font-size: 0.85rem;
    margin-top: 4px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .option-field {
        grid-template-columns: 1fr;
    }
    
    .btn-logout {
        position: static;
        margin-top: 16px;
        width: 100%;
    }
    
    .header {
        padding: 20px;
    }

    .section-header-inline {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .tree-node,
    .tree-option {
        margin-left: 10px !important;
    }
}
