.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    backdrop-filter: blur(8px);
    padding: 20px;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    width: 70%;
    max-width: 700px;
    background-color: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    transform: scale(0.95);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

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

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.15s ease;
}

.modal-close:hover {
    background-color: var(--bg-tertiary);
    transform: scale(1.05);
}

.modal-close:active {
    transform: scale(0.95);
}

.modal-close .material-symbols-outlined {
    font-size: 20px;
    color: var(--text-secondary);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-body label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px 20px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.modal-button {
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.modal-button:active {
    transform: scale(0.97);
}

.modal-button.secondary {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.modal-button.secondary:hover {
    background-color: var(--bg-tertiary);
}

.modal-button.primary {
    background-color: var(--accent-primary);
    border: none;
    color: var(--bg-primary);
}

.modal-button.primary:hover {
    opacity: 0.85;
    box-shadow: 0 4px 16px rgba(124, 176, 138, 0.3);
}

.settings-section {
    margin-bottom: 0;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 14px;
}

.section-title .material-symbols-outlined {
    font-size: 20px;
    color: var(--accent-primary);
}

.settings-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 24px 0;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.section-hint {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 18px;
    line-height: 1.5;
}

.incognito-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
}

.incognito-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

.incognito-icon {
    font-size: 16px !important;
    transition: color 0.3s ease;
}

.section-header.incognito-active .incognito-label {
    color: var(--incognito-accent);
}

.section-header.incognito-active .incognito-icon {
    color: var(--incognito-accent);
}

.personalization-fields {
    display: flex;
    flex-direction: column;
    gap: 18px;
    transition: opacity 0.3s ease, filter 0.3s ease;
}

.personalization-fields.disabled {
    opacity: 0.4;
    pointer-events: none;
    filter: grayscale(0.5);
}

.field-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 18px;
}

.field-group:last-child {
    margin-bottom: 0;
}

.field-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.field-group label .material-symbols-outlined {
    font-size: 16px;
    color: var(--accent-primary);
}

.toggle-group {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0;
}

.toggle-info {
    flex: 1;
}

.toggle-info label {
    margin-bottom: 4px;
    cursor: pointer;
}

.toggle-info .section-hint {
    margin-bottom: 0;
}

.chat-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-list-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.chat-list-empty .material-symbols-outlined {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.chat-list-empty p {
    font-size: 14px;
}

.chat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    background-color: var(--bg-tertiary);
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
    border: 1px solid transparent;
}

.chat-item:hover {
    background-color: var(--bg-primary);
    border-color: var(--border-color);
}

.chat-item:active {
    transform: scale(0.99);
}

.chat-item.active {
    background-color: var(--accent-muted);
    border-color: var(--accent-secondary);
}

.chat-item-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background-color: var(--bg-secondary);
    border-radius: 50%;
    flex-shrink: 0;
}

.chat-item-icon .material-symbols-outlined {
    font-size: 18px;
    color: var(--accent-primary);
}

.chat-item-content {
    flex: 1;
    min-width: 0;
}

.chat-item-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-item-preview {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.chat-item-date {
    font-size: 11px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.chat-item-delete {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease, background-color 0.2s ease;
}

.chat-item:hover .chat-item-delete {
    opacity: 1;
}

.chat-item-delete:hover {
    background-color: rgba(255, 100, 100, 0.2);
}

.chat-item-delete .material-symbols-outlined {
    font-size: 16px;
    color: var(--text-muted);
}

.chat-item-delete:hover .material-symbols-outlined {
    color: #ff6b6b;
}

.skills-intro {
    margin-bottom: 20px;
    padding: 16px;
    background-color: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.skills-intro p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.skills-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.skill-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background-color: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.skill-item:hover {
    background-color: var(--bg-primary);
    border-color: var(--accent-secondary);
}

.skill-item-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent-muted), var(--bg-secondary));
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.skill-item-icon .material-symbols-outlined {
    font-size: 20px;
    color: var(--accent-primary);
}

.skill-item-icon.built-in {
    background: linear-gradient(135deg, var(--incognito-bg), var(--bg-secondary));
}

.skill-item-icon.built-in .material-symbols-outlined {
    color: var(--incognito-accent);
}

.skill-item-content {
    flex: 1;
    min-width: 0;
}

.skill-item-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.skill-item-description {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.skill-item-badge {
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 12px;
    background-color: var(--incognito-bg);
    color: var(--incognito-accent);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.skill-item-actions {
    display: flex;
    gap: 4px;
}

.skill-item-actions button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    opacity: 0.5;
    transition: all 0.2s ease;
}

.skill-item-actions button:hover {
    opacity: 1;
    background-color: var(--bg-secondary);
}

.skill-item-actions button .material-symbols-outlined {
    font-size: 16px;
    color: var(--text-secondary);
}

.skill-item-actions button.delete-skill:hover .material-symbols-outlined {
    color: #ff6b6b;
}

.skill-editor {
    background-color: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.skill-editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
}

.skill-editor-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.skill-editor-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.skill-editor-close:hover {
    background-color: var(--bg-tertiary);
}

.skill-editor-close .material-symbols-outlined {
    font-size: 18px;
    color: var(--text-secondary);
}

.skill-editor-body {
    padding: 16px;
}

.skills-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--text-muted);
    text-align: center;
}

.skills-empty .material-symbols-outlined {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.skills-empty p {
    font-size: 13px;
}

.modal-button.secondary .material-symbols-outlined {
    font-size: 18px;
    margin-right: 4px;
    vertical-align: middle;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}
