/* Behavior Modal (extracted from legacy inline styles in index.html) */
.behavior-modal-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Важно: атрибут hidden должен реально убирать контейнер из layout.
   Иначе overlay будет перехватывать клики даже в "закрытом" состоянии. */
.behavior-modal-container[hidden] {
    display: none;
}

.behavior-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0px);
}

.behavior-modal {
    position: relative;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 2px solid rgba(138, 43, 226, 0.5);
    border-radius: 12px;
    padding: 24px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.behavior-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(138, 43, 226, 0.3);
}

.behavior-modal-header h2 {
    margin: 0;
    font-size: 20px;
    color: #BA55D3;
}

.behavior-modal-close {
    background: none;
    border: none;
    color: #aaa;
    font-size: 32px;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease;
}

.behavior-modal-close:hover {
    color: #fff;
}

.behavior-modal-description {
    margin-bottom: 16px;
    font-size: 13px;
    color: #ccc;
}

.behavior-modal-description strong {
    color: #BA55D3;
}

.behavior-modal-description ul {
    margin: 8px 0;
    padding-left: 20px;
}

.behavior-modal-description li {
    margin: 4px 0;
    color: #aaa;
}

.behavior-modal-textarea {
    width: 100%;
    padding: 12px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(138, 43, 226, 0.4);
    border-radius: 6px;
    color: #fff;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 12px;
}

.behavior-modal-textarea:focus {
    outline: none;
    border-color: rgba(138, 43, 226, 0.8);
    box-shadow: 0 0 0 3px rgba(138, 43, 226, 0.2);
}

.behavior-modal-status {
    min-height: 20px;
    padding: 8px;
    margin-bottom: 12px;
    border-radius: 6px;
    font-size: 13px;
}

.behavior-modal-status--success {
    background: rgba(76, 175, 80, 0.2);
    border: 1px solid rgba(76, 175, 80, 0.5);
    color: #4CAF50;
}

.behavior-modal-status--error {
    background: rgba(239, 83, 80, 0.2);
    border: 1px solid rgba(239, 83, 80, 0.5);
    color: #EF5350;
}

.behavior-modal-status--info {
    background: rgba(100, 181, 246, 0.2);
    border: 1px solid rgba(100, 181, 246, 0.5);
    color: #64B5F6;
}

.behavior-modal-buttons {
    display: flex;
    gap: 12px;
}

.behavior-modal-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

.behavior-modal-btn--cancel {
    background: rgba(100, 100, 100, 0.3);
    color: #ccc;
}

.behavior-modal-btn--cancel:hover {
    background: rgba(150, 150, 150, 0.3);
}

.behavior-modal-btn--submit {
    background: linear-gradient(135deg, #8E44AD 0%, #9B59B6 100%);
    color: white;
}

.behavior-modal-btn--submit:hover:not(:disabled) {
    background: linear-gradient(135deg, #9B59B6 0%, #AB47BC 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(138, 43, 226, 0.4);
}

.behavior-modal-btn--submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Behavior Modal Tabs */
.behavior-modal-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    border-bottom: 1px solid rgba(138, 43, 226, 0.3);
    padding-bottom: 8px;
}

.behavior-modal-tab {
    flex: 1;
    padding: 10px 16px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(138, 43, 226, 0.3);
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    color: #ccc;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.behavior-modal-tab:hover {
    background: rgba(138, 43, 226, 0.2);
    color: #fff;
}

.behavior-modal-tab.active {
    background: rgba(138, 43, 226, 0.3);
    border-color: rgba(138, 43, 226, 0.6);
    color: #BA55D3;
    font-weight: bold;
}

.behavior-modal-tab-content {
    display: none;
}

.behavior-modal-tab-content.active {
    display: block;
}

/* Behaviors List */
.behaviors-list {
    max-height: 400px;
    overflow-y: auto;
    padding: 8px;
}

.behaviors-loading,
.behaviors-empty,
.behaviors-error {
    text-align: center;
    padding: 40px 20px;
    color: #aaa;
    font-size: 14px;
}

.behaviors-error {
    color: #EF5350;
}

/* Behavior Card */
.behavior-card {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(138, 43, 226, 0.4);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    transition: all 0.2s ease;
}

.behavior-card:hover {
    border-color: rgba(138, 43, 226, 0.6);
    background: rgba(138, 43, 226, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.behavior-card-name {
    font-size: 16px;
    font-weight: bold;
    color: #BA55D3;
    margin-bottom: 8px;
}

.behavior-card-prompt {
    font-size: 13px;
    color: #ccc;
    margin-bottom: 10px;
    line-height: 1.4;
}

.behavior-card-meta {
    display: flex;
    gap: 12px;
    font-size: 11px;
    color: #888;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.behavior-card-meta span {
    display: inline-block;
}

.behavior-card-meta .outdated {
    color: #FF9800;
    font-weight: bold;
}

.behavior-card-btn {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, #8E44AD 0%, #9B59B6 100%);
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

.behavior-card-btn:hover {
    background: linear-gradient(135deg, #9B59B6 0%, #AB47BC 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(138, 43, 226, 0.4);
}

.behaviors-list::-webkit-scrollbar {
    width: 6px;
}

.behaviors-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.behaviors-list::-webkit-scrollbar-thumb {
    background: rgba(138, 43, 226, 0.5);
    border-radius: 3px;
}

.behaviors-list::-webkit-scrollbar-thumb:hover {
    background: rgba(138, 43, 226, 0.7);
}

/* Current behavior banner */
.behavior-modal-current {
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 16px;
}

.behavior-modal-current--custom {
    background: rgba(76, 175, 80, 0.2);
    border: 1px solid rgba(76, 175, 80, 0.5);
}

.behavior-modal-current--default {
    background: rgba(170, 170, 170, 0.2);
    border: 1px solid rgba(170, 170, 170, 0.5);
}

.behavior-modal-current-prompt {
    display: block;
    margin-top: 4px;
    color: #bbb;
    font-size: 12px;
}

